Name Games: JS-1 and the naming of things #227
Replies: 4 comments 8 replies
-
This is a really lovely exercise! |
Beta Was this translation helpful? Give feedback.
-
Also really like it. (minor note, "identifier", not "string" - or "name"? "variable name"?) |
Beta Was this translation helpful? Give feedback.
-
Have some random code! const londonZooAnimals = ["Coati", "Lemurs", "Lions", "Otters", "Tamandua"];
const edinburghZooAnimals = ["Lemurs", "Otters", "Pandas", "Vicuna"];
let commonAnimals = londonZooAnimals.filter(animal => edinburghZooAnimals.includes(animal));
let justLondonAnimals = londonZooAnimals.filter(animal => !commonAnimals.includes(animal));
let justEdinburghAnimals = edinburghZooAnimals.filter(animal => !commonAnimals.includes(animal));
console.log(`Both zoos have: ${commonAnimals.join(", ")}`);
console.log(`Only London Zoo has: ${justLondonAnimals.join(", ")}`);
console.log(`Only Edinburgh Zoo has: ${justEdinburghAnimals.join(", ")}`); |
Beta Was this translation helpful? Give feedback.
-
First of all, apologies for the super late feedback :/ I love the concept, it's fun and simple. I think I'm a bit fuzzy on the exact steps of the game, but I'm sure that would be cleared up if we get this written up into the syllabus. Speaking of which, what are the next steps here? Turn this into a ticket on the board? Have you thought about specifically where in JS1 it would fit in? Based on the code snippets above, we'd probably have to fit it into week 3 (since they use array methods). And since you're looking for some snippets, how about this: const programmers = ['Ada Lovelace', 'Grace Hopper', 'Alexandra Elbakyan', 'Barbara Liskov', 'Dorothy Vaughan', 'Verónica Dahl']
const languages = ['JavaScript', 'Haskell', 'Rust', 'Groovy', 'C', 'Ada']
function search(searchString) {
const foundProgrammer = programmers.find((programmer) => {
return programmer.includes(searchString)
})
const foundLanguage = languages.find((language) => {
return language.includes(searchString)
})
if (foundProgrammer && foundLanguage) {
return `Programmer: ${foundProgrammer}, Language: ${foundLanguage}`
} else if (foundProgrammer) {
return `Programmer: ${foundProgrammer}`
} else if (foundLanguage) {
return `Language: ${foundLanguage}`
}
}
console.log(search('Ada'))
console.log(search('Grace'))
console.log(search('JavaScript')) |
Beta Was this translation helpful? Give feedback.
-
Which module(s) and week(s) does this change effect?
Module(s): JS Core
Week(s): Week 1 -3
What is the hypothesis?
I've just read through pages and pages of JS-1-W-3 submissions. Students seem to still be quite shaky on the naming of things, even some weeks in to the course. I've written some feedback in the marking guide, but perhaps we can do more to help our students grasp this foundational concept.
Why is this important?
We want our students to be loved by their colleagues. ;)
Supporting Resources
Naming and thinking systematically is a big challenge even for professional developers (and it isn't helped by foo and bar, the most stupid of all teaching ideas), but I think we can be a bit imaginative here. How about some group games we can run in the live lesson? I'm thinking something high energy and high impact -- would not want to spend more than 25 minutes on this in a live lesson!
example (very first draft!)
Game 1: the Outside Context Problem, 25 mins
Split into groups (max 6 including a TA). Each group gets a short function with a clear commented explanation and some random characters as identifiers, eg:
Spend ten minutes (maximum, set a timer) renaming each nonsense identifier and submit to exercise leader. The TA should feel free to guide the students through the code but understanding how the code works is not the challenge here. The challenge is to name the parts of the code. Stay in the breakout rooms. Example solution:
This part should now be revealed: Leaders, in the main room, quickly make a list of JUST the identifiers and give this list to another group. Each team then gets five minutes (set a countdown timer) to guess what the code is about from the names and nominate someone to say it or paste it in chat. Example list:
Come back to the main group, go around and share our guesses, now without time pressure. Getting it right or getting it wrong are both great learning opportunities in this exercise. The purpose of the exercise is learning to think about our own code from the perspective of someone who did not write it and does not know what it does.
Beta Was this translation helpful? Give feedback.
All reactions