Branching the monolith

Last Friday, I discussed one of my favourite service migration patterns: The Decorating collaborator. Today, I want to discuss another cool pattern: Branch by Abstraction.

This one has fewer infrastructure requirements and allows for migrating subsystems of the application by switching concrete implementations that, instead of calling more subsystems of the monolith will call a dedicated service, instead. Obviously, this is dependent on the use of abstractions (e.g. interfaces) – thus the name.

The power of enabling this composition of applications doesn’t come without two big trade-offs: 1) it requires access to the source code of the application to migrate; and 2) it creates a dependency on the new service to execute, correctly, the part of the feature it’s responsible for when called upon doing it, requiring the new service to be healthy 100% of the time.

That dependency on the health and correctness of the service at the time of the execution (synchronous flow) can be removed and better handled, in my opinion, with an event-driven architecture (asynchronous).