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

Microservices in a Legacy Environment

Microservices in a Legacy Environment

Principles and examples to help you reduce tech debt and enable new feature development, with microservices when you've got a whole lot of legacy applications.

David Julia

September 16, 2016
Tweet

More Decks by David Julia

Other Decks in Programming

Transcript

  1. Spring Boot Simple and cheap to spin up a new

    microservice! Autoconfiguration for standard boilerplate config
  2. Legacy Environment: An environment wherein many systems that are hard

    to change are in dire need of replacement or augmentation to meet business demands.
  3. This talk is for Developers. I want to show you

    how to get to microservices when you’re starting with a Big Ball of Mud.
  4. The Importance of DDD in Legacy Environments • Don’t couple

    your domain model to your legacy systems’ models • Represent the latest business processes in code
  5. Succession /səkˈseSHən/ Noun The art of taking a single conceptual

    change, breaking it into safe steps, and then finding an order for those steps that optimizes safety, feedback, and efficiency
  6. Strangler Pattern Gradually create a new system around the edges

    of the old, letting it grow slowly over several years until the old system is strangled
  7. An example: Large fast food restaurant chain writing a mobile

    app Replace rewards points vendor with their own system
  8. • Cut cost • Show reward points on iOS app

    • Set ourselves up to add new features Motivation
  9. What’s the plan? • “Sprout” a new class to hold

    the behavior we want • Start moving behavior into that class • Extract a component (JAR) and break dependencies Could stop here and use the library in our mobile API gateway. Or continue on and extract a service.
  10. “That differ thing won’t work for me!” • “I have

    mutating operations (edits/deletes)!” Same basic strategy, one modification: Noop in your new service implementation Log what you “would have done” • This is just one example of succession. Creativity is often required :)
  11. But first… A note on premature extraction • Extracting a

    service too early can be costly • It’s easier to refactor the system with an in-process component • Easier to change your abstractions (interface changes) • Only have to change things in one place
  12. Extract a service! Let’s say we want a separate service**

    • Extract a service, implement a remote façade at the seam we created • Point iOS application API Gateway at the service • Celebrate! **for more info on when to extract a microservice vs stay with shared libraries, see Mike Gehard’s talk
  13. What did we just see • Started with a ball

    of mud • Identified/Extracted behavior into new classes • Packaged classes as JAR • Created a new service • Did all of this safely and with high confidence • Conveniently left the complex topic of splitting out the data for a future talk ;)
  14. Appendix/Links Mike Barinek’s appcontinuum.io Simon Brown on Modular Monoliths http://www.codingthearchitecture.com/presentations/sa2015-modular-monoliths

    Mike Gehard on Microservices https://vimeo.com/album/4045988/video/172421431 Working Effectively With Legacy Code by Michael Feathers