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

Domain-Driven Design

Sponsored · Your Podcast. Everywhere. Effortlessly. Share. Educate. Inspire. Entertain. You do you. We'll handle the rest. →
Avatar for mfogliatto mfogliatto
January 16, 2014
97

Domain-Driven Design

Avatar for mfogliatto

mfogliatto

January 16, 2014

Transcript

  1. What is DDD? • Understanding of the domain • Results

    in a software that is a reflection of the domain • Abstract the domain in a model that can be expressed in code
  2. Ubiquitous Language • Common language • For developers and stakeholders

    • No translation needed • Strongly connected to the model
  3. Design techniques • Analysis model – Analysts separated from developers

    – Result: Model with no software implementation specifics considerations – Issues: Model may not be codeable, so developers will have to adapt the model, perhaps losing its nature
  4. Design techniques • Agile model – Developers are included in

    the modeling process – Result: Model that can be appropiately be expressed in software – Issues: If arise, they can be detected at an early stage
  5. Design patterns • Layered Architecture – Cohesive layers that depend

    on the layers below and provide loose coupling to the layers above – Separate domain concerns from technology specific concerns – 4 layers: UI, App Layer, Domain Layer, Infrastructure Layer
  6. DDD Important Concepts • Entities – Have an identity that

    remains throughout the life of the software – Examples: Person, Bank Account, etc. • Value Objects – Describes certain aspects of a domain – Don’t have an identity – Examples: Address, Account State, etc.
  7. DDD Important Concepts • Services – Refer to operations that

    don’t belong to an Entity or Value Object – Provide a point of connection for many objects – Should be isolated in its corresponding layer
  8. DDD Important Concepts • Modules – Sometimes its necessary to

    organize the model into modules (Composition) – Provide high level of cohesion and low coupling • Communicational Cohesion • Functional Cohesion
  9. DDD Important Concepts • Aggregates – Domain pattern used to

    define object ownership and boundaries – Group of associated objects (root and components) considered as one unit – Other objects can only hold references to the root
  10. DDD Important Concepts • Factories – Factories are used to

    encapsulate the knowledge necessary for object creation – Use for complex object creation instead on constructors
  11. DDD Important Concepts • Repositories – Encapsulate all logic needed

    to objatin object references and abstracts the model – Model regains clarity and focus
  12. Preserving model integrity • Several techiniques to: – Maintain internal

    consistency – Reduce coordination efforts – Avoid conflict of interests
  13. Preserving model integrity • Bounded Context – Necessary conditions which

    need to be applied to make sure that the terms used in the model have a specific meaning – Explicitly define context and boundaries in which the model applies – Multiple teams and multiple models • Continuous Integration – Having various contexts breaks down integration and coherence – CI is needed to make sure everything fits harmoniously
  14. Preserving model integrity • Context Map – Document which outlines

    the different BCs and relationships between them • Shared Kernel – Subset of the domain model that teams agree to share – Reduces duplication
  15. Preserving model integrity • Customer-Supplier / Conformist – One system

    depends on the other – Similar to Shared Kernel, but only one part changes code – Conformist: Design a model without having to give a thought about the supplier’s model
  16. Preserving model integrity • Anticorruption Layer – Natural part of

    the model – Stands between out client model and the external one – Talks to the external model using the external language • Separate Ways – Smaller applications that have little or nothing in common – Pointless to integrate – Not visible from the user’s perspective, but from the design point of view
  17. Preserving model integrity • Open Host Service – Subsytem used

    by several clients – Use a provider of services • Distillation – Generates a Core Domain – Generates Generic Subdomains as a result of the distillation – Small core