Bad Habits in Udacity’s HTML5 Game Development: An Example
Posted by Elf Sternberg as Uncategorized
This screenshot more or less perfectly illustrates what I consider wrong with the Udacity HTML5 game development class. We’re in the middle of a routine for drawing sprites to the screen, and so far this particular lesson, on asset atlasses and sprite packing and all the rest, has been fine, but there’s something in this particular code that makes me twitch hard. Take a look at the “hlf” object created in the middle of this function. What is it doing?
It’s doing nothing. It’s not a transformation. It’s not analysis. It’s not functional. It’s just a renaming of one variable (“center of x”) to another (“half of x”). It doesn’t even help the user understand what’s going on.
I understand that this is a basic course, and it’s going to be missing a lot of details. Memoization and hyper-functional up-front calculations are fairly advanced subjects. But there’s a difference between not covering advanced topics and actively teaching students a bad habit.