Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Tactical DDD (just better OOP?) - PHPBenelux 2017


Published on

A deep dive into the technical building blocks of your domain model… We’ll cover Domain-Driven Design patterns like entities, value objects, repositories and domain events. Besides the basics, we’ll cover in detail different guidelines for modelling your aggregates.

All of this is called ‘tactical DDD’ and it might just turn out to be about the fundamentals of object-oriented programming too! This workshop will lead you straight to the core of programming and ways in which you can improve your applications in general.

Published in: Software
  • Be the first to comment

Tactical DDD (just better OOP?) - PHPBenelux 2017

  1. 1. TACTICAL DDD Just better OOP? Matthias Noback @matthiasnoback
  2. 2. matthiasnoback/
 tactical-ddd-workshop Clone from GitHub Follow the instructions in
  3. 3. TACTICAL DDD As opposed to...
  4. 4. STRATEGIC DDD The big picture Ubiquitous language Domain and subdomains Bounded contexts Context mapping Collaboration Discovery
  5. 5. TACTICAL DDD Design patterns Aggregate Entity Value object Repository Domain service Factory
  6. 6. TACTICAL DDD Its concerns Performance Reliability Data integrity Insight
  7. 7. DDD Scaling your domain model Keep it consistent Keep it manageable Make it perform well Ubiquitous language Bounded contexts Aggregates
  8. 8. ENTITIES Change & identity Identity Provided by user, application or persistence mechanism Repository encapsulates identity generation Surrogate identity Mutability & individuality Validation & consistency (encapsulation)
  9. 9. ENTITIES Checklist Does the object need to be retrieved from a repository by its unique identity? Does the object need to track changes? Are two instances equivalent if they have the same identity?
  10. 10. VALUE OBJECTS Properties Descriptive Immutable Conceptual whole (composite) Replaceable Not identifiable but comparable Side-effect free behaviors
  11. 11. VALUE OBJECTS Checklist Is it irrelevant which exact instance of the object is used? Can the object be replaced, instead of modified? Are two objects of the same type equal if their properties contain equal values?
  12. 12. assignment/ Entities and value objects
  13. 13. AGGREGATES Consistency Consistency boundary Transactional consistency Eventual consistency
  14. 14. “When examining the use case (or story), ask whether it's the job of the user executing the use case to make the data consistent.
  15. 15. AGGREGATES Rules of thumb Small aggregates Reference aggregates by identity Use eventual consistency
  16. 16. AGGREGATES Implementation Root entity with unique identity Favor value object parts Use Law of Demeter and Tell, Don't Ask Optimistic concurrency Avoid dependency injection and references to static services
  17. 17. assignment/ Extract an aggregate
  18. 18. DOMAIN EVENTS Messages Immutable Relation with commands Authoritative Sufficient data
  19. 19. assignment/ Domain events
  20. 20. REPOSITORIES Persistence Collection or persistence oriented Persistence implementation Unit of Work, change set calculation Event-sourcing Reconstitution Querying
  21. 21. ASSIGNMENT/04.MD An aggregate repository with an event store Feedback?
  22. 22. APPLICATION SERVICES Clients of the domain model Task coordination of use case flows Transaction control No business domain logic
  23. 23. assignment/ Application services
  24. 24. THAT'S IT! Thanks Feedback?
  25. 25. Feedback?
  26. 26. Feedback?