http://synesthesiam.com/?p=218
slashdot:
slashdot:
How Experienced And Novice Programmers See Code
http://developers.slashdot.org/story/12/12/19/1711225/how-experienced-and-novice-programmers-see-code
Man, the novice took a long time to read the code. Their eyes dart all around the code, building a picture of where everything is and then trying to understand it all in one go.
That's a bit slower to do. What one should do is to skim the code, separate it into non-submersible units and then understand what each unit is doing. For more inter-connected/complex code, the first step will also include identifying the relationships between the non-submersible units.
It's an interesting difference that distinguishes experienced and less experienced people, and can ultimately make the difference between being able to trace the code and getting stuck in a loop of code-skimming. (I've been there.)
So the question I want to answer to know is if this can be taught. I think it can be, and there are two ways to do that. The first way is to try tracing code without this technique first and then applying the technique, to note the difference. The alternative is to learn the technique first and then always trace code in this structured way. Both seem fine, but to me, there's a crucial difference. Learning in the first way gives you self-knowledge and appreciation of intelligence the other does not. Perhaps the latter even feels a bit robotic and is more likely to be unlearnt. The reason for this is simple - there was no choice given. The learner has to just take it in or revert to his own natural method of reading code.
Hopefully, this example has given an illustration of the subtle and often overlooked importance of choice in learning.