Concurrency Programming is Like Thinking in 5 Dimensions

Concurrency is about thinking in 5 dimensions at once.

Let's consider a single code class to be a 2D space. In the end, it's flat and fits on one display.

File organization (either flat or with multiple folders) add another dimension - third one.

These are static dimensions, just like the height, width and depth in the real world.

Fourth dimension, time, has it's own analogue in the code world - execution of the code within a single thread. This is were the code comes to life and shines in its dynamics.

Concurrency brings another dimension to the mix - the fifth one, since you have to deal with multiple threads being executed. They are just like parallel dimensions in the real world. That brings us somewhat close to 5D.

So delivering reliable concurrent code is about thinking in 5 dimensions:

  • it takes a bit of time and exercise to get used to to it;
  • it is rather hard to visualize;
  • you may want to keep the basic logical pieces as simple as possible in order to manage and evolve the entire system efficiently in your head.

Adding distributed systems could pump the dimensionality count up a little bit as well, increasing the complexity and excitement of the delivery.

NB: thinking about an entity (software system, in our case) from completely different angles helps to find simpler solutions to existing problems and challenges in the code.

- by .