Strangler Fig pattern (2): Seams, and where to cut the old system open
Incremental replacement depends on having places in the system where it can be cut. Seams can sit at the network entry point, in messaging, in front-end pages, in the database, inside the code, or even in people. Each layer has its own approach and cost.
This is the second article in the series. The first article covered the skeleton of the Strangler Fig pattern: insert a layer between the caller and the old system, and move things over one piece at a time. This article covers the prerequisite: the system needs places where it can be cut.
Conclusions first
- A seam is a place where you can cut the system open so that the old and new parts are handled separately. Systems designed well enough to have seams from the start are rare; most of the time you have to find or insert them yourself (Fowler, 2024).
- Seams can appear at many layers: the network entry point, messaging, front-end pages, the database, inside the code, and human operations (Cartwright et al., 2024a).
- The database layer is the latest interception point. The source says that catching a change only when it reaches the database can be said to be already too late; changing existing write behavior here needs special care, because it can break important implicit contracts (Cartwright et al., 2024a).
- The interceptor itself has to be built and maintained. Changing the callers avoids it, but then the callers must take on the responsibilities the interceptor would have carried (Cartwright et al., 2024a).
1. What a seam is
Fowler says that software ideally consists of components that can be replaced on their own, but old systems rarely look like this, so considerable effort goes into working out how to split them into small pieces. This involves finding the seams where something can be inserted into the system and it can be cut open. He also says that well-designed systems with seams built in are so rare they can be called unicorns (Fowler, 2024).
On the direction of the cut, Fowler suggests looking at which business needs the system supports, and extracting the individual needs into new components (Fowler, 2024). Cartwright and colleagues also say that for legacy systems, one usually looks for the seams between the several business needs a large program is meant to satisfy, and then checks whether each can be pulled out and delivered on its own. They also observe that many organizations give up on this path after looking only at the technology or only at the business process, concluding it cannot work (Cartwright et al., 2024b, “Decide how to break the problem into smaller parts”).
2. Where seams can sit
Cartwright and colleagues define Event Interception as using integration points that already exist between the components of an old system: events passed between components are intercepted and redirected to new components, with the aim of changing the old components as little as possible (Cartwright et al., 2024a, “How it works”). The positions the articles cover are as follows:
| Layer | Approach | Source |
|---|---|---|
| Network entry point | A reverse proxy, API gateway or load balancer routes by URL. Hammant’s airline case uses a load balancer to route requests by URL to the old and new systems, with both sharing session storage | Cartwright et al., 2024a, “API gateway”; Hammant, 2013, “An airlines booking app” |
| Messaging | Filtering on headers within the messaging infrastructure, or a routing component that routes by content | Cartwright et al., 2024a, “Messaging infrastructure” |
| Front-end pages | Make one small change to an old page, placing a hook from which behavior can be loaded from outside, so that later new behavior does not have to follow the old system’s release cycle | Cartwright et al., 2024a, “Within a web app” |
| Database | Triggers or change data capture (CDC). Microsoft’s example is a system where the logic lives in stored procedures, is centred on the database, and whose code cannot easily be changed | Cartwright et al., 2024a, “Database layer – triggers”; Microsoft, n.d.-b, “Problems and considerations” |
| Inside the code | Wrap an abstraction around the code so that callers go through it (branch by abstraction, see the next article) | Fowler, 2014 |
| People | When an event comes from a user’s action, the user can do part of the work in the new system and part in the old one for a period of time (a so-called swivel-chair integration), at the cost of possibly worse experience and efficiency during that period | Cartwright et al., 2024a, “The human event interceptor” |
My view is that when what you are replacing is a module, library or framework inside the program, wrapping an abstraction inside the program is the natural choice. This is my own inference; the original text does not put it this way.
3. Be careful at the database layer
The Event Interception article gives an important warning about the database layer: by the time a change reaches the database, interception can be said to be too late; changing existing write behavior here calls for special care, because it can break important implicit contracts (Cartwright et al., 2024a, “Database layer – triggers”).
The article also distinguishes several kinds of hooks:
- Triggers that fire before a write can intercept the write.
- Triggers that fire after a write do not intercept it; they only produce notification events (Cartwright et al., 2024a, “Database triggers – post-commit”).
- CDC produces an event stream from the transaction log, and strictly speaking it does not count as interception either (Cartwright et al., 2024a, “Change data capture”).
4. The cost of an interceptor
An interceptor is an extra transitional component. The article discusses another route: change the caller directly so that it decides for itself whether to go to the old or the new system. This removes one transitional component, and one less thing that can go wrong and needs maintenance, but the caller then takes on the responsibilities that originally belonged to the interceptor, such as understanding the contract, handling errors, and logging and monitoring (Cartwright et al., 2024a, “Routing events within legacy”).
Hammant also notes that if URLs follow a directory structure that corresponds to the application’s sub-blocks, it is easier to handle them one block at a time (Hammant, 2013, “For those considering strangulation”); his airline case relied on a load balancer placed in front that split traffic by URL (Hammant, 2013, “An airlines booking app”).
This series
- Why not rewrite it all, and what is the Strangler Fig pattern
- Seams: where to cut the old system open (this article)
- Coexistence of old and new: anti-corruption layer, transitional architecture, branch by abstraction, parallel change
- Cutover and verification: leaving the step that cannot be undone to the end
- Pitfalls and situations where it is not suitable
- What academia says: evidence, gaps and a checklist
Sources
- Fowler, M. (2024, August 22). Strangler fig. martinfowler.com. (Blog post)
- Cartwright, I., Horn, R., & Lewis, J. (2024a, March 5). Event interception. martinfowler.com. (Pattern article)
- Cartwright, I., Horn, R., & Lewis, J. (2024b, March 5). Patterns of legacy displacement. martinfowler.com. (Pattern collection overview)
- Hammant, P. (2013, July 14). Legacy application strangulation: Case studies. Paul Hammant's blog. (Case collection)
- Microsoft. (n.d.-b). Strangler Fig pattern. Azure Architecture Center. Retrieved November 8, 2026. (Official documentation)
- Fowler, M. (2014, January 7). Branch by abstraction. martinfowler.com. (Blog post)
Email subscriptions will open later. For now, you can follow new articles and work with RSS.