Domain Driven Design Up And Running

  • Upload
    iasa

  • View
    107

  • Download
    2

Embed Size (px)

DESCRIPTION

Domain Driven Design Up And Running - Vaugn Vernon Domain-Driven Design and using DomainMETHOD as a tool that supports Domain-Driven Design

Citation preview

  • 1. Domain-Driven Design Up and Running Vaughn VernonPrincipal Architect ShiftMETHOD Email: vvernon at shiftmethod dot comWeb: www.shiftmethod.com Copyright 2008 ShiftMETHOD. All rights reserved.

2. Topic Outline Background Domain-Driven Design Meets Reality Frameworks and Tools Solution Patterns Realizing Domain-Driven Design With DomainMETHOD 3. Background Experience: 26 years in software development Around 20 years in object-oriented Around 20 years in domain modeling, domain- driven design, and object-oriented development Experience has more or less followed Eric Evans' andMartin Fowler's core patterns, but with some departures Re-tuned my patterns to harmonize with Evans andFowler Vaughn Vernon Domain-Driven DesignUp and Running page 3 4. Domain-Driven Design Meets Reality Domain-Driven Design is a large space Core Implementation Patterns and Concepts Entity Aggregate Value Object Services (Domain) Factory Repository Persistence and Queries High-level available from Evans and Fowler Evans' book is awesome, but large and abstract Confusion: How do you actually implement? Vaughn VernonDomain-Driven DesignUp and Runningpage 4 5. Reality: Repository Repository I sort of know what a repository is supposed to do, butwhat does it really look like, how does it work, and how doI use it? Repository Is a Collection Does that mean it follows/implements Collectioninterface? Are there finder methods on Collection? Do add or do I save? Do I remove or do I delete? Can I use object-relational mapping and a tool? What else? Flushing, evicting, etc. Where does it live, and from where can I use it? Vaughn VernonDomain-Driven DesignUp and Runningpage 5 6. Reality: Non-Domain Layers and ORM Confusion About Non-Domain Layers What about using my domain model in my web userinterface? Data Transfer Objects How do I design my MVC Controller? How do I design my Application Service Layer? O-R Mapping Is a Huge Help, But... Will it really work with Domain-Driven Design? What about lazy-loading? Must I expose entity property setters for my ORM tool? How do I deal with domain model validation? Vaughn Vernon Domain-Driven DesignUp and Runningpage 6 7. Frameworks and Tools Evans and DDD community may speak against Rebecca Wirfs-Brock: 'I don't like object-relationalmapping tools' Such statements sometimes made by: Pure designers Those with very, very flush clients Reality dictates that we use frameworks and tools Cost Time to market UML Hibernate and NHibernate DomainMETHODVaughn VernonDomain-Driven DesignUp and Runningpage 7 8. Solution Patterns Execution Context, Speaks To: How do I design my MVC Controller? How do I design my Application Service Layer? Domain Dependency Resolver, Speaks To: What about lazy-loading? Domain Payload Object, Speaks To: What about using my domain model in my web userinterface? Atomic Model Change, Speaks To: Must I expose entity property setters for my ORM tool? How do I deal with domain model validation? Vaughn VernonDomain-Driven DesignUp and Running page 8 9. Execution Context Provides a context between a client and a service that is limited in scope only to the current execution bounds and that facilitates the safe access to crosscutting parameters to various application layers. Vaughn Vernon Domain-Driven DesignUp and Runningpage 9 10. Domain Dependency Resolver Define a strategy for resolving the dependencies that a use case or user story has on the domain model by ensuring that any lazy-loaded entity objects of a given aggregate required by the client are read from persistent storage while the required storage mechanisms are still available. Vaughn Vernon Domain-Driven DesignUp and Running page 10 11. Domain Payload Object A coarse-grained object that transports whole domain objects between architectural layers in order to reduce the number of necessary method invocations. Vaughn Vernon Domain-Driven DesignUp and Running page 11 12. Atomic Model Change Facilitates the full application of needed changes on a domain object while protecting the integrity of the model and providing validation. Vaughn Vernon Domain-Driven DesignUp and Running page 12 13. Realizing DDD With DomainMETHOD Tool for Applying Domain-Driven Design Supports Rapid Development Based on Domain-Specific Language (DSL) Meta Data Declarative Not UML; Text-based source syntax Project-based parser and source-level generator Core of full MVC generator Currently available with services Considering open-source licensingVaughn Vernon Domain-Driven DesignUp and Runningpage 13 14. DomainMETHOD Platforms Current: Java EE, Spring, Hibernate, MySQL Next: Oracle Next: .NET, C#, NHibernate, MS SQL Server Potential Relatively unlimited platforms, languages, frameworks Walk-through DSL syntax Features: Entities, Value Objects, Services Features: Properties, Validators, Finders, Traits Features: Source code generation Vaughn VernonDomain-Driven DesignUp and Running page 14 15. Conclusion Mini Book: Domain-Drive Design Quickly http://www.infoq.com/minibooks/domain-driven-design-quickly Patterns: http://www.shiftmethod.com Publications > Patterns (General) Patterns: http://www.shiftmethod.com Publications > Patterns (General) Email: vvernon at shiftmethod dot com Consulting Questions?Vaughn Vernon Domain-Driven DesignUp and Running page 15