4 ms·
Studies of college students learning CS showed that students who built a consistent mental model of what the code was doing did considerably better in classes.
by hath995 6y ago
Studies of college students learning CS showed that students who built a consistent mental model of what the code was doing did considerably better in classes.
To that end when I was teaching students I would print out snippets of code and have them evaluate the code in their head/on paper and then have them run the code to see if there was anything wrong. Repeat this process until your mental model matches what the computer does.
- sciencewolf 6y agoTotally, 100% agree with this. I would even take it one step further, and say that there are really good tools for developing this mental model nowadays. I didn't really feel like I understood what code was doing until I used tools like chrome devtools, pythontutor.com, or algodaily.com to visualize and step through iteration. It's helpful to know what's happening at each line with the call stack, variables, references, etc. -- but it can be intimidating to start. Drawing it out on paper first might be a better way to begin.