strangler application patterns and antipatterns
TRANSCRIPT
STRANGLER APPLICATION PATTERNS AND ANTIPATTERNS
Matteo Vaccari @xpmatteo
Get a whiteboard, put on the colored stickies, and try not to be a pain in the arse.
#agile #inanutshell
A company and its software
Legacy code == code that is difficult to change
The core domain of a profitable company is always complex
Refactor or rewrite?
What to do with legacy code?
Why do we fear the big rewrite?
http://www.bonkersworld.net/building-software/
Things going against the big rewrite
• Same people and same methods: they will get the same results
• The old software contains knowledge and details that we’re not aware of
• While we are busy rewriting the old features, competitors are busy implementing new ones
• Why is there always time to do things over, but there is never time to do things right?
A tale of two companies• There once were two competing companies, with
equal market share
• One company rewrote their product…
• … and many customers migrated to the other!
• The company who kept the old codebase now has twice the market share
A digression on software design
A non-obvious fact
This is more complex…
…than these
Doing it wrong…
What are the factors that make the split work well?
Simplicity is achieved when…
• Each box is understandable in isolation
• Each box does only one thing
• Each box represents a single concept
• Each box is cohesive
How to connect A & B
Simplicity is achieved when…
• Things are loosely coupled
• Or, rather…
• … they are coupled appropriately
Design is fractal!
And, similarly…
Or worse!
How to connect services?
Domain Events to the rescue!
A Domain Event
How to connect services?REST apis
RSS-like event queue
Messaging service
So how do we deal with legacy code?
Patterns for incremental improvement
1. Pay down your technical debt
2. Bubble context
3. Strangler application
Strangler application
Database
nuovo
App Nuova
Database
legacy
App Legacy
Batch Sync
Utenti
ApachePerl filter
Utenti migrati Utenti non migrati
Router
Old and new apps
Update mechanism
A Strangler application is composed of:
• A router
• The old application
• The new application(s)
• An update mechanism
Another example
Strangler app antipatterns
The router is inside the legacy app
The new app is aware of the old one
For best results, the new app and the old
should not be aware of each other!
• A router
• The old application
• The new application(s)
• An update mechanism
Conclusions?
twitter.com/xpmatteo thoughtworks.com
THANK YOU
WE ARE HIRING! YES, IN ITALY!