strangler application patterns and antipatterns

40
STRANGLER APPLICATION PATTERNS AND ANTIPATTERNS Matteo Vaccari @xpmatteo

Upload: matteo-vaccari

Post on 07-Jan-2017

506 views

Category:

Engineering


10 download

TRANSCRIPT

Page 1: Strangler application patterns and antipatterns

STRANGLER APPLICATION PATTERNS AND ANTIPATTERNS

Matteo Vaccari @xpmatteo

Page 2: Strangler application patterns and antipatterns

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

A company and its software

Page 4: Strangler application patterns and antipatterns
Page 5: Strangler application patterns and antipatterns

Legacy code == code that is difficult to change

Page 6: Strangler application patterns and antipatterns

The core domain of a profitable company is always complex

Page 7: Strangler application patterns and antipatterns

Refactor or rewrite?

What to do with legacy code?

Page 8: Strangler application patterns and antipatterns

Why do we fear the big rewrite?

Page 9: Strangler application patterns and antipatterns

http://www.bonkersworld.net/building-software/

Page 10: Strangler application patterns and antipatterns

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

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

A digression on software design

Page 13: Strangler application patterns and antipatterns

A non-obvious fact

Page 14: Strangler application patterns and antipatterns

This is more complex…

Page 15: Strangler application patterns and antipatterns

…than these

Page 16: Strangler application patterns and antipatterns

Doing it wrong…

Page 17: Strangler application patterns and antipatterns

What are the factors that make the split work well?

Page 18: Strangler application patterns and antipatterns

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

How to connect A & B

Page 20: Strangler application patterns and antipatterns

Simplicity is achieved when…

• Things are loosely coupled

• Or, rather…

• … they are coupled appropriately

Page 21: Strangler application patterns and antipatterns

Design is fractal!

Page 22: Strangler application patterns and antipatterns

And, similarly…

Page 23: Strangler application patterns and antipatterns

Or worse!

Page 24: Strangler application patterns and antipatterns

How to connect services?

Page 25: Strangler application patterns and antipatterns

Domain Events to the rescue!

Page 26: Strangler application patterns and antipatterns

A Domain Event

Page 27: Strangler application patterns and antipatterns

How to connect services?REST apis

RSS-like event queue

Messaging service

Page 28: Strangler application patterns and antipatterns

So how do we deal with legacy code?

Page 29: Strangler application patterns and antipatterns
Page 30: Strangler application patterns and antipatterns

Patterns for incremental improvement

1. Pay down your technical debt

2. Bubble context

3. Strangler application

Page 31: Strangler application patterns and antipatterns

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

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

Another example

Page 34: Strangler application patterns and antipatterns

Strangler app antipatterns

Page 35: Strangler application patterns and antipatterns

The router is inside the legacy app

Page 36: Strangler application patterns and antipatterns

The new app is aware of the old one

Page 37: Strangler application patterns and antipatterns

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

Conclusions?

Page 39: Strangler application patterns and antipatterns
Page 40: Strangler application patterns and antipatterns

twitter.com/xpmatteo thoughtworks.com

THANK YOU

WE ARE HIRING! YES, IN ITALY!