Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Strangler application patterns and antipatterns

Strangler application patterns and antipatterns

A few observations about what makes success more likely in application rewrite effort

Matteo Vaccari

April 11, 2016
Tweet

More Decks by Matteo Vaccari

Other Decks in Technology

Transcript

  1. DEALING WITH LEGACY SOFTWARE
    PATTERNS AND ANTIPATTERNS
    Matteo Vaccari
    @xpmatteo

    View full-size slide

  2. Get a whiteboard, put on the colored stickies,
    and try not to be a pain in the arse.
    #agile #inanutshell

    View full-size slide

  3. A company and its software

    View full-size slide

  4. Legacy code == code that is difficult to change

    View full-size slide

  5. The core domain of a profitable company
    is always complex

    View full-size slide

  6. Refactor or rewrite?
    What to do with
    legacy code?

    View full-size slide

  7. Why do we fear the
    big rewrite?

    View full-size slide

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

    View full-size slide

  9. 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?

    View full-size slide

  10. 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

    View full-size slide

  11. A digression on
    software design

    View full-size slide

  12. A non-obvious fact

    View full-size slide

  13. This is more complex…

    View full-size slide

  14. …than these

    View full-size slide

  15. Doing it wrong…

    View full-size slide

  16. What are the factors that
    make the split work well?

    View full-size slide

  17. 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

    View full-size slide

  18. How to connect A & B

    View full-size slide

  19. Simplicity is achieved
    when…
    • Things are loosely coupled
    • Or, rather…
    • … they are coupled appropriately

    View full-size slide

  20. Design is fractal!

    View full-size slide

  21. And, similarly…

    View full-size slide

  22. How to connect
    services?

    View full-size slide

  23. Domain Events
    to the rescue!

    View full-size slide

  24. A Domain Event

    View full-size slide

  25. How to connect services?
    REST apis
    RSS-like event queue
    Messaging service

    View full-size slide

  26. So how do we deal
    with legacy code?

    View full-size slide

  27. Patterns for
    incremental improvement
    1. Pay down your technical debt
    2. Bubble context
    3. Strangler application

    View full-size slide

  28. Strangler application
    Database
    nuovo
    App Nuova
    Database
    legacy
    App Legacy
    Batch Sync
    Utenti
    Apache
    Perl filter
    Utenti migrati Utenti non migrati
    Router
    Old and new
    apps
    Update
    mechanism

    View full-size slide

  29. A Strangler application is
    composed of:
    • A router
    • The old application
    • The new application(s)
    • An update mechanism

    View full-size slide

  30. Another example

    View full-size slide

  31. Strangler app
    antipatterns

    View full-size slide

  32. The router is inside the
    legacy app

    View full-size slide

  33. The new app is aware of the
    old one

    View full-size slide

  34. 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

    View full-size slide

  35. Conclusions?

    View full-size slide

  36. twitter.com/xpmatteo
    thoughtworks.com
    THANK YOU
    WE ARE HIRING!
    YES, IN ITALY!

    View full-size slide