Part 0

Introduction

Monolith, microservices, modular monolith and distributed monolith are four words that mix up two separate questions.

When people call a system a monolith or microservices, they usually mean how it is deployed. The reasons to change an architecture are usually about something else: how many places a small change has to touch. So there are two questions. Are the boundaries in the right place, and how many deployment units are there? Each of the four words is one combination of the answers.

Physical: how many deployment units? one many Logical: where are the boundaries? by entityor by layer by reasonto change Big ball of mudthe classic monolith Distributed monolithmany units, old boundaries Modular monolithgood boundaries, one unit Microservicesgood boundaries, many units the usual move first later, if needed

Try it

Click a quadrant, or show a path.

Figure 1. The four words as combinations of two answers.

A common route to microservices only changes the deployment. The old boundaries stay, so a change still touches several parts, and those parts now talk to each other over the network. That is a distributed monolith. The alternative is to fix the boundaries first, inside one application, and to move a module into its own process only when there is a reason for it. On that path, the organization is usually harder to change than the code. Part 5 shows how to go step by step.

Why the logical view comes first

Wrong boundaries do not hurt on the first day. They hurt later, when the system has grown and every change has to cross more parts than it should. Martin Fowler calls the idea that design pays back over time the design stamina hypothesis, and says himself that it cannot be proven.1

Try it

Figure 2. Delivered functionality over time for the four combinations of figure 1. An illustration after Fowler, not a measurement.

Splitting a ball of mud into services keeps every crossing and makes each one more expensive. It also makes the boundaries harder to move, because moving a rule then means moving data between databases. That is why this course starts with the logical view.

One question at a time

Philippe Kruchten described four views of an architecture in 1995.2 We use them as a coat rack for these questions.

Logicalwhere are the boundaries? Developmenthow is the code organized? Processhow do the parts work together? Physicalwhat runs where? no arrow scenarios
Figure 3. Kruchten’s four views, redrawn from his paper. The arrows show which view follows from which.

The design starts with the logical view. The process and development views follow from it, and the physical view comes last.

The logical view has the most impact on the architecture. The other views follow from it, so a wrong boundary shows up in all of them: in the messages, in the repositories and in the deployment. A wrong choice in the physical view is much cheaper to change.

There is no arrow from logical to physical, which is the point Udi Dahan makes:3

The misunderstanding is that logical design is the same as physical design.

The next parts go through the views in that order.

References

  1. Martin Fowler, Design Stamina Hypothesis, 2007.
  2. Philippe Kruchten, Architectural Blueprints: The “4+1” View Model of Software Architecture, IEEE Software, 1995. Figure 3 follows his Figure 1.
  3. Udi Dahan, Logical and Physical Architecture, 2010. The sentence is from his reply in the comments.