Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Implementing DDD Concepts in PHP

30 887 vues

Publié le

A brief introduction to the concepts of domain driven design and their application to PHP.

Publié dans : Technologie

Implementing DDD Concepts in PHP

  1. 1. Implementing DDD Concepts in PHP Steve Rhoades Panasonic Avionics http://github.com/steverhoades @steverhoades http://linkedin.com/in/steverhoades http://stephenrhoades.com Aleksey Khudyakov Roave, LLC http://github.com/Xerkus http://roave.com Special Thanks Marco Pivetta, Roave LLC http://github.com/ocramius
  2. 2. Overview • Ubiquitous Language • Bounded Context • Value Object • Entity • Repository • Collection • Mapper • Identity Map • Unit of Work • Services
  3. 3. What is Domain Driven Design
  4. 4. Collection of principles and patterns that help developers craft elegant systems
  5. 5. Ubiquitous Language
  6. 6. Allows for precise communication of ideas between stakeholders and developers
  7. 7. Developers should speak the language as well as include the language in the code base
  8. 8. Bounded Context
  9. 9. Keep varying business processes separated
  10. 10. Overlapping of business concerns should communicate through services
  11. 11. Value Object
  12. 12. An object that contains attributes but does not have an identity
  13. 13. Value Objects are Immutable
  14. 14. Don’t forget behaviors!
  15. 15. Entity
  16. 16. An entity is an object in your application that has an identity.
  17. 17. Anemic Entity anti-pattern
  18. 18. Look like Value Objects but have identity
  19. 19. Lack behavior
  20. 20. Repository
  21. 21. A segregated interface that utilizes the ubiquitous language to hide the infrastructure layer
  22. 22. Storage, Memory, Remote Service
  23. 23. Collections
  24. 24. Mapper (Data Mapper)
  25. 25. Used to pull Entity data from persistence
  26. 26. Developers can create custom Data Mappers without affecting the rest of the application
  27. 27. • Unit Test • MongoDB • Redis • MySQL • Oracle • Web Services • File System
  28. 28. Identity Map
  29. 29. Caches Entities in memory to ensure there is only one instance in memory at any given time
  30. 30. Martin Fowler P of EAA READ THIS!
  31. 31. Services
  32. 32. Utilized when the natural processing on an Entity or a Value Object is no longer valid
  33. 33. Domain Services should not contain state
  34. 34. Application Services and Domain Services are often confused
  35. 35. Application Services orchestrate demands from a given use case or workflow
  36. 36. Application Services “should not” contain business logic will make calls to Domain and Infrastructure services as well as Entities
  37. 37. Helpful to think of an Application Service as a command object
  38. 38. Unit of Work (example of Application Service)
  39. 39. Maintains a list of objects affected by a business transaction and coordinates the writing out of changes and the resolution of concurrency - Martin Fowler, P of EAA
  40. 40. Further Resources • Domain Driven Design, Eric Evans • Patterns of Enterprise Application Architecture, Martin Fowler • Applying Domain-Driven Design and Patterns, Jimmy Nilsson • Implementing Domain Driven Design, Vernon Vaughn
  41. 41. Please Review https://joind.in/9594

×