Microservices divide a system into small, independently deployable modules. The alternative is the deployment monolith, which means the entire application with all its modules is deployed at once. Internally, deployment monoliths can be built from modules such as Java packages, namespaces, or libraries.

Microservices are currently attracting criticism because microservice systems often do not have a good structure. But microservices only define how the structure is implemented. How good the structure is does not depend on whether the modules are microservices or classic modules. Domain-driven Design (DDD) and Bounded Context are useful techniques to achieve a good structure. They are enjoying a renaissance thanks to microservices. If the outcome of the microservices discussion is an increased focus on DDD and better structured software, that’s an important success - no matter if modules are implemented as microservices or not.

Monoliths: usually poorly structured

To suggest deployment monoliths as a solution for poorly structured systems, seems absurd to me. I’ve done many reviews of deployment monoliths. The structures of the monoliths almost always left much to be desired. My explanation: Dependencies between modules sneak into the source code too easily. The only exception is when an architecture management tool is used or other measures are taken to enforce the module boundaries. But that was only the case with a few of the deployment monoliths I studied.

Because microservices have their own source code projects, and interfaces between the microservices are implemented, e.g. as REST interfaces, dependencies do not sneak in so easily with microservices. A developer would have to create a dependency on another source code project and call an interface. This is much more complicated than, for example, using a class from another Java package. The split into microservices thus supports compliance with the module boundaries.

Once a good structure has been established, it can be implemented with microservices. Deployment monoliths require further measures to enforce the structure in the long run.

Beyond the structure

It might seem that of these two alternatives, a deployment monolith is the better choice because of its lower complexity. Only one system has to be operated and deployed. But microservices have emerged as an architectural approach to solve real world problems:

Ultimately, microservices allow even more decoupling of the modules: technical decisions or deployment are limited to a microservice. Likewise, the failure of a process only leads to the crash of a single microservice. In addition, firewalls can create additional security barriers between microservices, and they can be scaled independently of each other. This results in a decoupling in terms of technologies, deployment, failure and security.

Thus, microservices support decoupling, which is a major goal of modules.

More or less effort?

Of course, microservices lead to increased complexity, during tests or for operations, for example. This additional complexity must be balanced against better modularization, greater decoupling, and independent deployment. After all, it only makes sense to choose an architectural approach if it is the simplest solution for the scenario. Microservices were originally invented because they were not just an easy solution for some scenario, but actually they were pretty much the only solution for large teams and fast deployment.

Excluding microservices as „too complex“ right from the start is just as unhelpful as condemning deployment monoliths. And it is important not only to ask the question, which modularization technology to use, but above all to implement a good split in modules.

tl;dr

Microservices and deployment monoliths are different approaches to modularization. They have pros and cons and fit different scenarios. Even more important than the chosen modularization approach is that the structure of the software is solid and useful.