Common issues with parallelism and concurrency
I’m convinced that the fundamental problem of software development is to mentally translate the static view of a system – the code – into its dynamic behavior, or what the program does when it runs. Programmers run code in their heads every time they’re considering a change, often automatically but always at the expense of mental energy. This is one of the reasons why I believe practices such as test-driven development (TDD) and incremental design are useful; they allow us to move part of this mental energy spending from our brains to running the tests repeatedly.
This fundamental problem is already difficult for single threads, but for parallel or concurrent designs, it adds a new level of challenge. We not only need to imagine what the code will do but also how the code will interact with the other parts of the code that run at the same time. So, imagination and the brain energy required to make sense of...