Monoliths

About

A software design choice where all components of an application are built into a single unit. (All-in-one)

circle-info

A monolithic system is a SINGLE Unit of Deployment.

Ex.: If you make a change in a Support module of your application, and to re-deploy it, the other modules like Financial modules also gets re-deployed.

circle-check
triangle-exclamation

When to use it

In new projects

Where the business domain is not clear enought or have too many instabilities/changes.

Avoids complexity in deployment.

Types

Single Process

These are the default (Unit of Deployment) applications.

Single process monotliths can be divided in three types:

High Coupling

There is no context. There is no segmentation, everything is coupled to everything.

There can be undesired side effects.

This can become quite caotic.

circle-info

Ex.: A User is only one Entity for the entire application, independent of which context they should belong to, because there are no contexts delimited.

circle-info

A good solution is to the Domain.

Modular

Where each context (bounded context) can become a isolated module in the application. And these modules access the same database.

This reduces the coupling between contexts.

And the modules can communicate with contracts/interfaces and facades.

circle-info

So instead of modules calling each other directly, they will use an abstract interface to do so.

External interfaces will still call the modules directly.

Drawing
circle-info

Entities can be duplicated, having only their context necessary attributes.

Ex.: You can have multiple types of User for different contexts, and they will only have attributes that are necessary for their contexts, but they will share the same ID. This way they can even communicate between them.

circle-check
circle-exclamation

Example of a Project:

Drawing
https://github.com/devfullcycle/fc-monolitoarrow-up-right

Modular with a segregated Database

Each module may have its own database.

circle-exclamation

Even though this seams familiar with Microservices, we still have:

  • Single Deploys. (Single Unit of Deployment)

  • Simplified Observability.

  • These modules communicate internally between them.

  • There is still only one language.

Distributed Monoliths

Black Box

These would be closed code software. (Private softwares, which we don't have access)

Last updated