O slideshow foi denunciado.
Seu SlideShare está sendo baixado. ×

Domain Driven Design Big Picture Strategic Patterns

Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Anúncio
Carregando em…3
×

Confira estes a seguir

1 de 34 Anúncio

Mais Conteúdo rRelacionado

Diapositivos para si (20)

Semelhante a Domain Driven Design Big Picture Strategic Patterns (20)

Anúncio

Mais recentes (20)

Anúncio

Domain Driven Design Big Picture Strategic Patterns

  1. 1. Domain Driven Design Big Picture DDD-Meetup Cincinnati 2019-08-20 https://github.com/mwindholtz/presentations/tree/master/DDD Wikimedia Commons
  2. 2. Domain-driven design (DDD) An approach to software development for complex needs by connecting the implementation to an evolving model. The term was coined by Eric Evans
  3. 3. A Short Review or Overview …
  4. 4. Meeting Topic Areas 1. Strategic Patterns • Context Maps, Sub Domains, etc 2. Tactical Patterns • DomainEvents, Aggregates, etc 3. Communication Tips • Whirlpool, Knowledge Crunching, Event Storming 4. Code Examples • Build In Your Own Language: The Cargo Shipping Example
  5. 5. When to Apply Domain Design • For Simple systems • No worries. It fits inside a person’s head. • For Medium systems • No worries. Hire smart people so that .. • It fits inside a person’s head. Oh and write loads of Documentation! ** • For Complex systems • Starting is ok. It initially still fits inside a person’s head. • Then Documents help a while • But As It Grows … ** Documentation has an unknown expiration date. And may be wrong to begin with. Other restrictions may apply.
  6. 6. Typical “Agile” project progression • Feature story • Design, design, design :-) • Feature story, Feature story • Design. :-| • Feature story, Feature story, Feature story, Feature story, Feature story :-( • Feature story, Feature story, Feature story, Feature story, Feature story :-o
  7. 7. Code Structure: Big Ball Of Mud http://www.laputan.org/mud/ Process Diagnosis: Featureatitis
  8. 8. Software Craftsmanship — IS NOT ENOUGH — • Refactoring • Better names • Test Driven Design • Continuous Single Integration • Something is still missing
  9. 9. DDD Europe Videos 1999
  10. 10. “Doing” DDD • Find Bounded Contexts • Build Context Map • Focus on Core Domain • Apply Building Blocks • Engage Domain Experts to build Ubiquitous Language • Repeat … and Revisit :||
  11. 11. Application, as we Imagine it
  12. 12. Application, in Reality
  13. 13. Application with DDD added
  14. 14. Domain • A sphere of knowledge, influence, or activity. • The subject area to which the user applies a program is the domain of the software.
  15. 15. Why Now ? • Domain Driven Design, “Big Blue Book”, 2003 • Tactical Patterns get most of the attention • Micro-Services, 2012 • Bounded Context and Context Mapping for organization • Content of each Micro-Service • Relationships among Micro-Services
  16. 16. Why is DDD Difficult to Explain? • Since the Problem is Complex and Subtle • The Solution is also Complex and Subtle • Difficult to scale down into examples • Large Vocabulary of Interrelated Patterns • Pattern Languages
  17. 17. Building Blocks • Layered Architecture • Value Objects • Entities • Factories • Repositories • Aggregates • Services • Domain Events
  18. 18. Strategic Patterns Large projects involving multiple teams. Wikimedia Commons
  19. 19. DDD Reference • Domain-Driven Design Reference: Definitions and Pattern Summaries •
  20. 20. Model • A system of abstractions that describes selected aspects of a domain • Can be used to solve problems related to the domain << Some UML class diagram >>
  21. 21. Bounded Context • Large projects have multiple Models • Combining Models causes bugs • Model expressions only have meaning in a context • Therefore … • Define the context of the Model • Set boundaries in terms of team organization, parts of the application, code bases, and DB schemas Acme Internet of Things Manager
  22. 22. Ubiquitous Language • Translating between User speak and software developer speak is losses fidelity and is error prone. • Therefore … • Define a set of names for interrelated concepts from the domain • Use these names in the implementation code • User: Fuel onload price at a given port varies based on supplier and region • Dev: Price has a foreign key to the SupplierRegion table.
  23. 23. ContextMap • To develop a strategy, we need a large- scale view across our project and others we integrate with. • Therefore … • Define each Model and it’s BoundedContext • Describe the points of contact between Models. Identify … • Explicit translations • Sharing • Isolation mechanisms • Levels of influence Acme Internet of Things Manager Acme Smoke Detector Network Arrow points upstream Data flows to Manager from Network
  24. 24. Context Relationship Types • Shared Kernel • Customer/Supplier Teams • Conformist • Open Host Service • Separate Ways • Big Ball Of Mud Acme Internet of Things Manager Acme Smoke Detector Network
  25. 25. Shared Kernel • Designate some subset of the Domain Model that the two teams agree to share. Acme Internet of Things Manager Acme Smoke Detector Network Network Model Manager Model Event Model Shared Kernel
  26. 26. Customer/Supplier Teams • Establish Clear Customer/Supplier relationship • The Manager Team is a Customer to the Network Team • In Agile process Manager Team can add stories to Network Teams Backlog. • Or Tests to Network Teams test Suite. Acme Internet of Things Manager Acme Smoke Detector Network Customer/Supplier
  27. 27. Conformist • Upstream Team (ToastyCo.) has no interest in adapting to Acme’s needs • Eliminate the Complexity of translating the Event and Device Models, by using the them as-is from the Toasty Co. API • Also share the Toasty Co. Ubiquitous Language • Conformity simplifies Integration Acme Internet of Things Manager Network Model Manager Model Event Model Conformist Device Model Toasty Co. Smoke Detector Network
  28. 28. Anti-corruption Layer • As a downstream Client create an isolating layer to provide the functionality of the upstream (Acme Manager) • but translated into the (Client A) Model. • The layer translates in one or both directions Acme Internet of Things Manager Client A UI Anti-corruption Layer
  29. 29. Open Host Service • When a subsystem needs to be integrated with many others as a set of services. • Define an open protocol or API for all those that need to use it. Acme Internet of Things Manager Open Host Service Client A UI Client B UI Conformist Anti-corruption Layer
  30. 30. Separate Ways • If two sets of functionality have no significant relationships. • Cut them loose from each other. • So they can each develop simpler Models for their own needs. Acme Internet of Things Manager Separate Ways Acme Attendance Tracking
  31. 31. Big Ball Of Mud • Sometimes the other system grown over many years has no defined Model. Or multiple Models. • No well defined Context Boundaries. • Draw a boundary around the entire mess. Call it a bill of Mud. • Do not try to DDD inside of that boundary. • Watch out: The Ball of Mud will try to spread outside of its area. Acme Internet of Things Manager Big Ball Of Mud Mainframe Legal Agreement Service
  32. 32. The End Acme Internet of Things Manager Acme Smoke Detector Network

×