How to have decoupled systems without setting your company on fire by Eduardo Bellani
Have you heard that having decoupled systems is paramount to dealing with complexity at the heart of software
?
Have you also seen companies waste piles of cash and lots of developer time trying to build decoupled systems?
This article might be of your interest, since my goal is to teach you how to build decoupled systems cheaply and using technology that is battle tested and that will keep you in control. How? By
- See the problems of the current widespread solution to coupling: microservices;
- See how to implement decoupled systems using a SQL DBMS;
- Visit a bit of the underlying theory about coupling/modularity/views in light of what was presented.
A summary of the comparison: Microservices vs SQL DBMS
Microservices
- Poor performance with serialization and networking
- Correctness problems over versioning in a distributed system
- Hard to manage multiple binaries and e2e testing
- Dangerous to change APIs
- Slow development because of lack of atomicity of changes
SQL DBMS
- Great performance with data colocation
- Correctness by default
- Single system, easy to test e2e
- Change is made safe by constraints
- ACID baby
The core point
this rule means: We have a module N which uses some module M, but only through its type (interface) A. M can be replaced by any other module with the same type, and N will continue to work. That’s modularity. (Koppel 2023)
Or, in non-alien language: It means that the relation between interfaces and implementations is many-to-many. That means that modularity is a logical property that can be implemented in many ways.
The canonical way of doing it in the relational model is through views.
So what about views?
You can have many views (interfaces) over the same base tables (implementations). (many to one)
The same view can have multiple ways of being deduced from the base tables. (one to many)
This implements modularity, as defined in the previous section
The original view (pun intended) about views
In contrast, the problems treated here are those of data independence-the independence of application programs and terminal activities from growth in data types and changes in data representation
…
Activities of users at terminals and … application programs should remain unaffected when the internal representation of data is changed and even when some aspects of the external representation are changed.
It used to be called logical data independence. It can also be called de-coupling.