Pattern: Branch By Abstraction

Written on

Co-exist two implementations of the same functionality in the same running process at the same time.

When making a significant change to how a piece of functionality is implemented, the challenge is how to work on this reimplementation over a period of time. With branch-by-abstraction, you create a single abstraction point over the functionality to be reimplemented, allowing both the existing functionality and the new implementation to co-exist inside the same running process at the same time.

This pattern offers significant benefits over use of long lived source code branches, but still allows both the existing and new functionality to co-exist safely. Feature toggles can allow which implementation of the abstraction is live, potentially allowing you to switch between implementations in a running system.

This pattern is used heavily as part of trunk-based development.

This pattern is explored in detail in my book, Monolith To Microservices.

See more patterns.