5 ms·
In college I got a LOT of mileage from printing out my code (this was in the 90s) and sitting down with a pencil and tracing through statement by statement. Dr
by teach 11y ago
In college I got a LOT of mileage from printing out my code (this was in the 90s) and sitting down with a pencil and tracing through statement by statement.
Draw little boxes for each variable, for pointers, for the stack, whatever. Change each value only when the execution gets there. Resist the urge to just skip over -- "this section does such-and-such."
I'm fairly certain it's the only reason I made an A in my assembly language courses.
- eric_bullington 11y agoGreat point. On a similar note, I've gotten a lot of use out of stepping through Python algorithmic code using PythonTutor [1], which maintains a visual dashboard of stack frames/variables and heap objects. Very useful, was just using it earlier today. Doing this manually with a pencil and paper is arguably even better for learning purposes, although significantly more arduous. I should try it. 1. http://pythontutor.com/ http://pythontutor.com/