Branch by abstraction
Replacing a component inside a codebase step by step: put an interface in front of it, build the new version behind it, switch, then delete the old one.
The strangler fig pattern routes requests at the edge of a system; branch by abstraction does the same inside the code, for things that have no URL, such as a persistence layer, a pricing engine or a library. All callers first go through a new abstraction; then a second implementation grows behind it while the main branch keeps shipping. Martin Fowler describes the steps.
The point is to avoid a long-lived branch with a big-bang merge, which fits trunk-based development. A feature flag picks the implementation per environment or per customer, and a parallel run can call both to compare. The last step, deleting the old implementation and often the abstraction, is the one teams forget.
Sources
- Martin Fowler: Branch By Abstraction martinfowler.com
Related terms
- Strangler fig pattern: Replacing a legacy system piece by piece, routing one feature at a time to new code until the old system can be switched off.
- Trunk-based development: Everyone merges small changes into one main branch at least daily, instead of keeping long-lived feature branches.
- Feature flags: Switches in code that turn a feature on or off for some or all users without a new deploy.
- Parallel run (shadow traffic): Running the old and new implementation side by side on real requests, using the old result and comparing the new one, before switching over.
