Patterns and antipatterns in Docker image lifecycle as was presented at Scale 15x
Strangler application patterns and antipatterns
-
Upload
matteo-vaccari -
Category
Engineering
-
view
507 -
download
10
Transcript of Strangler application patterns and antipatterns
![Page 1: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/1.jpg)
STRANGLER APPLICATION PATTERNS AND ANTIPATTERNS
Matteo Vaccari @xpmatteo
![Page 2: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/2.jpg)
Get a whiteboard, put on the colored stickies, and try not to be a pain in the arse.
#agile #inanutshell
![Page 3: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/3.jpg)
A company and its software
![Page 4: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/4.jpg)
![Page 5: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/5.jpg)
Legacy code == code that is difficult to change
![Page 6: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/6.jpg)
The core domain of a profitable company is always complex
![Page 7: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/7.jpg)
Refactor or rewrite?
What to do with legacy code?
![Page 8: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/8.jpg)
Why do we fear the big rewrite?
![Page 9: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/9.jpg)
http://www.bonkersworld.net/building-software/
![Page 10: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/10.jpg)
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?
![Page 11: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/11.jpg)
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
![Page 12: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/12.jpg)
A digression on software design
![Page 13: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/13.jpg)
A non-obvious fact
![Page 14: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/14.jpg)
This is more complex…
![Page 15: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/15.jpg)
…than these
![Page 16: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/16.jpg)
Doing it wrong…
![Page 17: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/17.jpg)
What are the factors that make the split work well?
![Page 18: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/18.jpg)
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
![Page 19: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/19.jpg)
How to connect A & B
![Page 20: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/20.jpg)
Simplicity is achieved when…
• Things are loosely coupled
• Or, rather…
• … they are coupled appropriately
![Page 21: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/21.jpg)
Design is fractal!
![Page 22: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/22.jpg)
And, similarly…
![Page 23: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/23.jpg)
Or worse!
![Page 24: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/24.jpg)
How to connect services?
![Page 25: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/25.jpg)
Domain Events to the rescue!
![Page 26: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/26.jpg)
A Domain Event
![Page 27: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/27.jpg)
How to connect services?REST apis
RSS-like event queue
Messaging service
![Page 28: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/28.jpg)
So how do we deal with legacy code?
![Page 29: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/29.jpg)
![Page 30: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/30.jpg)
Patterns for incremental improvement
1. Pay down your technical debt
2. Bubble context
3. Strangler application
![Page 31: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/31.jpg)
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
![Page 32: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/32.jpg)
A Strangler application is composed of:
• A router
• The old application
• The new application(s)
• An update mechanism
![Page 33: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/33.jpg)
Another example
![Page 34: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/34.jpg)
Strangler app antipatterns
![Page 35: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/35.jpg)
The router is inside the legacy app
![Page 36: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/36.jpg)
The new app is aware of the old one
![Page 37: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/37.jpg)
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
![Page 38: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/38.jpg)
Conclusions?
![Page 39: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/39.jpg)
![Page 40: Strangler application patterns and antipatterns](https://reader034.fdocuments.us/reader034/viewer/2022052216/587085cb1a28ab57368b78ff/html5/thumbnails/40.jpg)
twitter.com/xpmatteo thoughtworks.com
THANK YOU
WE ARE HIRING! YES, IN ITALY!