3 ms·
Because students can understand "code being run every x seconds" easier than "reference to function being resolved then called every x seconds". Once they do,
by BiteCode_dev 7y ago
Because students can understand "code being run every x seconds" easier than "reference to function being resolved then called every x seconds".
Once they do, you show the problems with it and show why callbacks are better.
When it comes to pedagogy, I'll use every trick I can.
And I always win.
- nicoburns 7y agoI feel like you could start with manually calling the function, and then introduce callbacks as a way to get your code to run in response to some event. A callback is no different to a regular function after all. If your way works, then it works though I suppose.
- inkeddeveloper 7y agoAgreed. In my class I always start with the hard/wrong way. Point out why it's hard/wrong. Let them hate it. Then show the easy/correct way. You can't just point them at something and say, "Do it this way or else." That's not teaching. That's directing.
- nicoburns 7y agoWhat do you do when they decide that they prefer the wrong way? Eval is pretty compelling to beginners!