Book Review: The Programmer's Brain - What every programmer needs to know about cognition by Felienne Hermans


Book cover for the Programmer's Brain.There are some books which make you feel smarter just by having them on your shelf. This is one of them! I would consider it essential for anyone working with code - whether a wide-eyed newbie or grizzled veteran.

How do human brains understand code? What neurological quirks do we all have? Which common mistakes can be easily avoided? Only by understanding our puny hardware ("Isn’t it a miracle that humans can do anything with no more than 1 byte of memory") can we understand how we should read, write, and think about code.

It is a relatively quick read - I burned through it on a 4 hour flight - but there are lots of practical exercises to do. And it is worth taking the time to think about the process of thinking about code.

Some of the insights are a little obvious - but it is worth spelling them out. For example:

when debugging, many programmers prefer to make small changes to their code (tweaks) and run it again to see if the bug is fixed rather than spending the energy to create a good mental model of the problem

It me! Why do I do that? Why do I think bashing around on a keyboard is more productive than taking 15 minutes to investigate my assumptions about what I'm trying to do - and what the previous programmer was trying to do? The book has answers - and some practical guides for helping you correct your behaviour.

Even "simple" things like naming conventions get a thorough examination, with plenty of academic references:

8.3.2 Snake case or camel case?
The results of Binkley’s study show that the use of camel case leads to higher accuracy among both programmers and non-programmers
8.4.1 Code with bad names has more bugs
Butler’s study found statistically significant associations between naming issues and code quality.

There are lots of footnotes if you want to go wandering into the academic studies - and there are many.

The book - rightly - throws a bit of shade on those of us who have got into bad habits, but haven't reflected on whether they're actually working for us.

11.2.5 Some thoughts on multitasking
The interesting thing is that people who multitask often feel very productive

Ha! True. The book goes into the studies of why people feel the way they do - and whether the data bears out those feelings.

I urge you to read this book. If you are just getting started, it will help you develop good habits. If you're an occasional coder, it will keep you from straying. If you've been doing this for so long that your code is indecipherable to anyone else - it will give you a much-needed reality check.

The book is available DRM free from publisher in PDF, ePub, and Mobi. At about £25, it's probably worth charging it as a business expense.

Thanks to the publishers for the review copy.


6 thoughts on “Book Review: The Programmer's Brain - What every programmer needs to know about cognition by Felienne Hermans

  1. There was something I read once that said humans don't multitask, they time slice. Old school mainframe style. That's why it takes so long to switch focus between coding projects/problems/convos. Can't remember the paper reference though sorry.



  2. DinoNerd says:

    Note that the book is also available in paperback, which increases the odds that I'll read it. (Other people following this blog may feel the same way about ebooks, even those that are DRM-free.)

  3. says:

    If only we could use the power of the computers we have to negate these arguments entirely - with IDEs that could switch casing and spacing based on user preferences.



  4. says:

    Yeah I've heard of these studies but I'm highly suspicious. Remember the science went back and forth about serif vs sans serif, line lengths etc. So many studies are rife with confounds and biases that I'm skeptical when they conclude something so obviously wrong.


  5. says:

    Curious about screen readers - I've seen tweets that say camel case make it easier for the screen reader, but I've not seen that compared with _.



Leave a Reply

Your email address will not be published. Required fields are marked *