
The Programmer's Brain explores the way your brain works when it's thinking about code. In it, you'll master practical ways to apply these cognitive principles to your daily programming life. You'll improve your code comprehension by turning confusion into a learning tool, and pick up awesome techniques for reading code and quickly memorizing syntax. This practical guide includes tips for creating your own flashcards and study resources that can be applied to any new language you want to master. By the time you're done, you'll not only be better at teaching yourself--you'll be an expert at bringing new colleagues and junior programmers up to speed.
The Programmer's Brain: What every programmer needs to know about cognition. By Felienne Hermans
It's interesting to see the somewhat conflicting suggestions of this book and the argument that something like ChatGPT / AI can be leveraged to solve the simple problems. We kind of discussed it a bit in the book club. For example, few programmers today worry about assembly / very low level solutions...it's just kind of back of mind / expected to work. I wonder if that will be true for programmers in the future, in relation to the foundation of a particular language. And if so, will the increased usage of AI be a positive or negative thing for the workers in the industry.?
From what I can tell, management / C-Suite seems to be pretty open to adoption and it's the developers that seem to be a bit more reluctant. Maybe that reluctance is coming from a place of concern about self preservation or maybe it's a valid concern about things like AI hiding / solving some of the fundamentals that allow one to learn the foundations of something...foundational knowledge that might make the more useful for solving the more complex problems.
I haven't really used AI...so maybe this observation is coming from a place of ignorance. It'll be interesting to see how things work out.
- Count Belisarius by Robert Graves
- The Bone Clocks by David Mitchell
- The Expanse (all of them)
- Project Hail Mary by Andy Weir
And the best books on software development were:
- Fundamentals of Software Architecture: An Engineering Approach by Mark Richards and Neal Ford
- Multithreaded JavaScript by Thomas Hunter II and Bryan English
- The Programmer's Brain by Felienne Hermans
You can, however, cast readability as a problem in the domain of cognitive science - how easy or hard it is to understand the ideas based on their textual descriptions.
We more-or-less know how human memory works: there's a working area, short-term memory, long-term memory, and the need to copy data between these segments. The working area is limited in capacity, short-term memory is volatile, and long-term memory is costly to access. In addition, we know that context switches are expensive, and if they last long enough, they can break the flow - or rather, make your working memory reset itself. You then need to reassemble all the pieces required for solving the problem again, from scratch.
Readability is a score that says how many operations your brain must perform before fully converting the description into understanding. The more readable description requires holding fewer pieces/concepts/ideas in your working memory, minimizes the need for context switches, and doesn't rely on long-term memory too much.
I felt this would be the case for a long while, but I only recently read a book where most of my suspicions were proved correct. The title is: "The Programmer's Brain - what every programmer should know about cognition," and I can't recommend it enough. It's a bit boring at times, but it provides a good explanation and practical guidelines for writing code that actively supports your cognitive process - or, in other words, is readable.
One example: to abbreviate or not? Abbreviation may look more readable because it doesn't obscure other nearby identifiers. On the other hand, each time you see an abbreviation, your brain has to expand it, adding to its workload. In this light, you might be tempted to say that we should never abbreviate identifiers. That is not so: other than the brain, between the code and its understanding sits an eye. AbstractFactoryOfConreteFactoryWorkerBean-style identifiers are just as bad as abbreviations, because then your eye has more work to do. So, keep your identifiers not abbreviated as long as you can see the whole identifier in a single glace - start abbreviating after that. Ideally, keep identifiers between 1 and 5 full words.
The book discusses a lot of similar characteristics of source code, presents empirical studies that back up many of its claims, and in general gives you quite a lot of insight into the mechanics of reading (and writing, but less so) programming languages.