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 Slide

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

    View Slide

  3. A company and its software

    View Slide

  4. View Slide

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

    View Slide

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

    View Slide

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

    View Slide

  8. Why do we fear the
    big rewrite?

    View Slide

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

    View Slide

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

  11. 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 Slide

  12. A digression on
    software design

    View Slide

  13. A non-obvious fact

    View Slide

  14. This is more complex…

    View Slide

  15. …than these

    View Slide

  16. Doing it wrong…

    View Slide

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

    View Slide

  18. 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 Slide

  19. How to connect A & B

    View Slide

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

    View Slide

  21. Design is fractal!

    View Slide

  22. And, similarly…

    View Slide

  23. Or worse!

    View Slide

  24. How to connect
    services?

    View Slide

  25. Domain Events
    to the rescue!

    View Slide

  26. A Domain Event

    View Slide

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

    View Slide

  28. So how do we deal
    with legacy code?

    View Slide

  29. View Slide

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

    View Slide

  31. 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 Slide

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

    View Slide

  33. Another example

    View Slide

  34. Strangler app
    antipatterns

    View Slide

  35. The router is inside the
    legacy app

    View Slide

  36. The new app is aware of the
    old one

    View Slide

  37. 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 Slide

  38. Conclusions?

    View Slide

  39. View Slide

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

    View Slide