Decorate your monolith away!

A few months back, in March, I was invited to talk at PHP Portugal #[Lisbon] v7 meetup. My talk was titled “Three strategies to split your monolith into services” where I briefly introduced The Strangler Fig, Branch by Abstraction, and The Decorating Collaborator patterns.

Of those three, my favourite is the last one, The Decorating Collaborator, because is the one that allows programmers to stop developing in the monolith immediately and focus on developing new functionality in a new service. To do so, it requires a proxy application that will be responsible for decorating – thus the name – new behaviour into the old monolith’s, making it look like we’re still calling the monolith when, in fact, we might be interacting with the new service.

Another trade-off to consider is that the more information is required for interacting with the new service, the more complex and tangled the proxy application implementation becomes.

This pattern is best used to compose responses and side effects from the inbound request and/or the response from the monolith but we can’t, or won’t, change the monolith itself. It can stay feature freeze, or even outside of our control, but it still can be evolved.

Maybe, gradually, replace features completely until the monolith ceases to exist.