The Programmer's Brain

How do people with exceptional coding and code-reading skills think? How are they different from me? I believe every engineer has pondered these questions at some point (probably).

The book The Programmer's Brain uses a cognitive science approach to scientifically analyze the creative process of coding. It's a must-read for those who want to understand how the brain works like a muscle.

Half-joking about the "muscle brain" part, but recently, I resumed my daily coding quizzes. While studying data structures and algorithms, I wondered if there was a way to train or improve the foundational aspects of my thinking. That's when I stumbled upon this book.

Here, I'll summarize some key points that caught my attention while reading this book.

Cognitive Load on Working Memory

The term "working memory" is a crucial keyword in this book and appears repeatedly until the final chapter.

When humans code, three cognitive processes are at work in the brain: long-term memory, short-term memory, and working memory.

Long-term and short-term memory are differentiated by their storage characteristics and retention periods. They function as storage units in the brain, with processes for retrieving data from these storages.

Working memory, on the other hand, acts as the brain's CPU, processing data from long-term and short-term memory.

When the cognitive load on working memory increases, it can lead to confusion while dealing with code.

To reduce this load, it's beneficial to enhance the performance of both long-term and short-term memory storages or adopt approaches to optimize performance.

Depending on whether the memory is long-term or short-term, different strategies can be employed to retrieve and train that memory effectively.

For details on various approaches, refer to the book itself.

Understanding Code ≒ Understanding Text

Research shows that reading code and reading natural language text share many similarities.

The ability to learn natural languages influences the ability to learn programming. Furthermore, approaches used for understanding natural language text can potentially be applied to understanding code as well.

I had heard this before, but it made a lot of sense to me.

People who are good at writing and reading code often seem to have strong natural language skills, so this idea resonated with me.

When reading complex application code with intricate specifications, I sometimes use an approach that combines reading the code with natural language explanations. It was interesting to realize that this method is scientifically effective.

Nowadays, editors are smarter, and debuggers are more advanced, making it easier to read code with these tools. I used to think it was unnecessary to involve natural language in the process, but now I see that considering a natural language approach can lead to deeper understanding.

Personal Thoughts

This book taught me that understanding how the brain works can reveal ways to train and hack it. I found it refreshing because I hadn't read any other books that approach coding from this perspective. There were several discoveries where things I had vaguely felt were scientifically explained.

Long-term memory can be trained (through repeated learning or memorization), but how do you train short-term memory?

While short-term memory might not need direct training, its performance can be supported through various approaches. However, if short-term memory could be trained, it would certainly become more powerful (like building muscle).

Apparently, there are ways to train working memory.

How to Train Your Brain's Working Memory: Boost Work Performance and Study Efficiency by Strengthening and Freeing Your Working Memory

I wonder if the "brain training" games that were popular in the past (are they still popular?) are also aimed at training working memory.