Más contenido relacionado


Design principles to modularise a monolith codebase.pptx

  1. Design principles to modularise a monolith codebase - Prashant Kalkar
  2. Agenda How modules can help? Reusable module boundaries Principles of Cohesion Module dependencies (Coupling principles) Breaking up Dependencies
  3. How modules can help?
  4. Big ball of Mud (Class coupling) Reference: Neal Ford: "Building Evolutionary Architectures"
  5. Module 1 Module 2 Module breaks dependencies (disallow)
  6. Modules - What am I talking about ● Modules allowed by build tools like Maven, Gradle or others. ● In Repo, modules (multi-module project)
  7. Opposing requirements for a Reusable code
  8. Reusable module boundaries
  9. Where are the module boundaries?
  10. How changes affect clients Change Option 1 Option 2 Option3 Changes In Switch or Interface Yes Yes Yes Changes in Light Implementation Yes Yes Only Clients using Light Changes in Fan Implementation Yes Yes Only Clients using Fan
  11. Checkout Example
  12. Need to support Card Payments
  13. Payment as plugin/extension
  14. Support more payments without module changes
  15. ISP and OCP ISP - “Make fine grained interfaces that are client specific.” Interface consumer and Interfaces are named and packaged together. OCP - “Software entities (classes, modules, functions, etc.) should be open for extension but closed for modification.” Abstraction modules allows to satisfy Opposing requirements for a Reusable code.
  16. Real life examples JPA - Hibernate JDBC - MySQL client, PostgreSQL clients etc. Slf4j - Log4j, Logback etc. Kubernetes - CNI, CRI, CSI, CPI etc
  17. Principles of Cohesion
  18. CCP - “Classes that change together are packaged together.” “ When we make a change we want to be able to jump to a single clear point in the system and make the change.” - Refactoring: Improving the Design of Existing Code, Ch 03. Bad Smells. Divergent Change For, Layered architecture one change per layer. The Common Closure Principle
  19. How to apply Common Closure Principle
  20. Module dependencies (Coupling principles)
  21. Which module / class is more stable? A or B?
  22. What about now?
  23. Fan In, Fan Out Instability = Fan Out / (Fan In + Fan Out) Depend on things which are stable than you
  24. Dependency cycles
  25. Dependency cycles
  26. Modularity Dependency cycle prevent module creation Maven modules will not work. Java 9 modules will not work.
  27. Dependency direction towards Instability
  28. Ideal dependency graph ● Dependency flow downwards ● Depency direction flows toward stability ● No cycles.
  29. Ideal dependency graph
  30. Breaking up Dependencies
  31. Example Application codebase Orchestration framework which uses the DAG as inputs. Different type of nodes are supported like REST API services, or message passing brokers (like Kafka etc).
  32. IntelliJ Idea DSM
  33. Move classes
  34. Move classes (Cont)
  35. Dependency Inversion Principle (DIP)
  36. Architectural Tests
  37. References Agile Software Development, Principles, Patterns, and Practices Clean Architecture: A Craftsman's Guide to Software Structure and Design Refactoring: Improving the Design of Existing Code Building Evolutionary Architectures, 2nd Edition
  38. Thank You!