DEV Community

Discussion on: No More Foo, Bar, and Baz

Collapse
warrend profile image
Daniel Warren Author • Edited on

Thanks for reading. I agree about using abstract variables (like a(b+c)) to explain basic concepts. And I think something like this is just fine:

let foo = 'Ohio State'

let bar = 'USC'

console.log(foo + ' vs. ' + bar); // ‘Ohio State vs. USC'

But even here, and maybe it’s splitting hairs, wouldn’t it makes sense to just name the variables let osu and let usc? What is the benefit to using foo and bar here over something that expresses what the variable actually means?

I would argue that your algebra example is very different than an association example. When creating a tutorial with associations, or where one piece of code relates to another in some way, it just doesn’t make sense to ever use abstracted names like foo, bar, or baz. I would also argue that if someone reads the tutorial and thinks a join table would be better, they probably already understand the concept of associations pretty well, ha. I think we can have the best of both worlds — focus on the language/pattern but also have the example have real world meaning.

That being said, I’m sure there are cases where it’s just fine to use abstracted names. Thanks for weighing in. I appreciate your input and I think it’s a good discussion to have.