Master the proven technique for safely modernizing legacy systems without the rewrite risk
Only 10-25% of full system rewrites succeed.
Most organizations can't afford to wait years for a rewrite that might fail.
Named after a vine in nature that Martin Fowler observed in Queensland, Australia.
The strangler fig:
Perfect metaphor for legacy modernization.
Replace legacy functionality incrementally while keeping the system running.
Three key components:
Both systems coexist during migration.
// Facade intercepts and routes requests
export class PaymentRouter {
async processPayment(order: Order) {
// Check if migrated to new service
if (await this.isMigrated(order.customerId)) {
return this.newPaymentService.process(order)
}
// Fallback to legacy
return this.legacyPaymentSystem.process(order)
}
}
Traffic flows through the facade, not directly to legacy.
Introduce a proxy between clients and legacy system. Initially routes 100% to legacy.
Map dependencies, identify lowest-risk features to migrate first.
Implement one piece of functionality as a microservice. Test thoroughly.
Update facade to route that feature's traffic to the new service.
Track metrics, ensure new service performs as expected.
Continue migrating features incrementally until legacy is retired.
Mid-size retailer with monolithic PHP application
18-month migration with zero downtime.
When new services must call legacy code, use an ACL:
// ACL adapts legacy interface to modern API
class LegacyCustomerAdapter {
async getCustomer(id: string): Promise<Customer> {
// Call legacy SOAP service
const xmlData = await this.legacySoap.GetCustomerById(id)
// Transform to modern format
return this.transformToModern(xmlData)
}
}
Prevents legacy patterns from infecting new code.
Perfect for:
Not ideal for:
| Strangler Fig | Big Bang Rewrite | | --------------------------------- | -------------------------- | | Incremental value delivery | No value until complete | | Low risk | High risk (10-25% success) | | Learn and adapt | All-or-nothing | | Can add features during migration | Feature freeze | | Requires routing infrastructure | Simpler architecture |
79% of developers report strangler implementations reduce project risk.
Replace one piece at a time, validate, repeat.
No big bang cutover, no extended downtime.
Deploy services to production early to learn fast.
The strangler fig pattern trades complexity for safety.
Week 1: Assess your monolith and map dependencies
Week 2-3: Design your facade/routing layer
Week 4: Identify the first feature to migrate (low risk, high value)
Month 2: Build and deploy your first microservice
Month 3+: Measure, learn, iterate, and scale
Resources: martinfowler.com/bliki/StranglerFigApplication.html