2 Speed reading for code

 

This chapter covers

  • Analyzing why reading code quickly is hard even for an experienced developer
  • Dissecting how the brain splits up new information into recognizable parts
  • Discovering how LTM and STM work together when analyzing information like words or code
  • Examining the role of iconic memory when processing code
  • Explaining how remembering code can be used as a tool for (self) diagnosis of coding level
  • Practicing writing code that is easier for others to read

Chapter 1 introduced three cognitive processes that play a role when programming and reading code. The first cognitive process we covered was LTM, which you can think of as a hard drive that stores memories and facts. The second cognitive process was STM, which is like random-access memory, storing information that comes into the brain for a short time. Finally, there’s the working memory, which acts a bit like a processor and processes information from LTM and STM to perform thinking.

The focus of this chapter is on reading code. Reading code is a larger part of a programmer’s working life than you might realize. Research indicates that almost 60% of programmers’ time is spent understanding rather than writing code.1 Thus, improving how quickly you can read code, without losing accuracy, can help you improve your programming skills substantially.

2.1 Quickly reading code

2.1.1 What just happened in your brain?

2.1.2 Reexamine your reproduction

2.1.3 Reexamining your second attempt at reproducing code

2.1.4 Why is reading unfamiliar code hard?

2.2 Overcoming size limits in your memory

2.2.1 The power of chunking

2.2.2 Expert programmers can remember code better than beginners

2.3 You see more code than you can read

2.3.1 Iconic memory

2.3.2 It’s not what you remember; it’s the way you remember it

2.3.3 Practice chunking

Summary