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

SOLID Monoliths / Microservices

SOLID Monoliths / Microservices

What if deploying a system as a monolith as a set of microservices was just an implementation detail? Can we create this option by designing the system well?

David Tanzer

June 07, 2016
Tweet

More Decks by David Tanzer

Other Decks in Programming

Transcript

  1. If you can't build a monolith, what makes you think

    microservices are the answer? Simon Brown http://www.codingthearchitecture.com/2014/07/06/distributed_big_balls_of_mud.html
  2. “Monolith First” This pattern has led many of my colleagues

    to argue that you shouldn't start a new project with microservices, even if you're sure your application will be big enough to make it worthwhile. Martin Fowler http://martinfowler.com/bliki/MonolithFirst.html
  3. Don’t start with a monolith … when your goal is

    a microservices architecture Stefan Tilkov http://martinfowler.com/articles/dont-start-monolith.html
  4. e.g. Open / Closed Principle “Software entities (classes, modules, functions,

    etc.) should be open for extension, but closed for modification“
  5. e.g. Open / Closed Principle Paraphrased: “I want to be

    able to add functionality without changing any existing code“ Like: Adding the option to deploy the system as a set of micro services to a monolithic software.
  6. Topics for today • The SOLID Principles • The Four

    Rules of Simple Design • DDD • CQRS • Monoliths / Micro Services • Spring Boot • Big / Some / No Design Upfront
  7. Commercial Break ;) David Tanzer (@dtanzer) [email protected] I help my

    clients to: • Work together more effectively as a team • Improve their technical practices • Improve their software quality / design • Re-gain control of their legacy code http://davidtanzer.net
  8. If you don’t want to create an “anemic domain model”,

    your domain model might get quite complicated… https://en.wikipedia.org/wiki/Anemic_domain_model
  9. Problems • Data is read/processed more often that it is

    written (in many apps) • Mapping the domain model to the DB • Re-creating the domain model from the DB • Translating domain model to / from UI data
  10. Single Responsibility Principle “Every module or class should have responsibility

    over a single part of the functionality provided by the software, and that responsibility should be entirely encapsulated by the class.“ “A class should have only one reason to change.”
  11. Open / Closed Principle “Software entities (classes, modules, functions, etc.)

    should be open for extension, but closed for modification“ “I want to be able to add functionality without changing any existing code“
  12. Liskov Substitution Principle “If S is a subtype of T,

    then objects of type T may be replaced with objects of type S (i.e. objects of type S may substitute objects of type T) without altering any of the desirable properties of that program (correctness, task performed, etc.)“ “Subclasses should not override behavior in an incompatible way“
  13. Interface Segregation Principle “No client should be forced to depend

    on methods it does not use.“ “The consumer defines what it needs from an interface. Every consumer gets their own interface.“
  14. Dependency Inversion Principle “High-level modules should not depend on low-level

    modules. Both should depend on abstractions. Abstractions should not depend on details. Details should depend on abstractions.“ “Your business logic should not depend on your infrastructure code.“
  15. Design that is simple… • …passes it’s tests. • …maximizes

    clarity. • …minimizes duplication. • …has fewer elements. http://quickglance.at/en/simple_design/overview
  16. Thank You! David Tanzer (@dtanzer) [email protected] I help my clients

    to: • Work together more efficiently as a team • Improve their technical practices • Improve their software quality / design • Re-gain control of their legacy code http://davidtanzer.net