3. Vaughn Vernon Domain-Driven Design—Up and Running page 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' and
Martin Fowler's core patterns, but with some departures
● Re-tuned my patterns to harmonize with Evans and
Fowler
4. Vaughn Vernon Domain-Driven Design—Up and Running page 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?
5. Vaughn Vernon Domain-Driven Design—Up and Running page 5
Reality: Repository
● Repository
● “I sort of know what a repository is supposed to do, but
what does it really look like, how does it work, and how do
I use it?”
● Repository “Is a” Collection
● “Does that mean it follows/implements Collection
interface?”
● “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?”
6. Vaughn Vernon Domain-Driven Design—Up and Running page 6
Reality: Non-Domain Layers and ORM
● Confusion About Non-Domain Layers
● “What about using my domain model in my web user
interface?”
● 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?”
7. Vaughn Vernon Domain-Driven Design—Up and Running page 7
Frameworks and Tools
● Evans and DDD community may speak against
● Rebecca Wirfs-Brock: 'I don't like object-relational
mapping 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
● DomainMETHOD
8. Vaughn Vernon Domain-Driven Design—Up and Running page 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 user
interface?”
● Atomic Model Change, Speaks To:
● “Must I expose entity property setters for my ORM tool?”
● “How do I deal with domain model validation?”
9. Vaughn Vernon Domain-Driven Design—Up and Running page 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.
10. Vaughn Vernon Domain-Driven Design—Up and Running page 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.
11. Vaughn Vernon Domain-Driven Design—Up and Running page 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.
12. Vaughn Vernon Domain-Driven Design—Up and Running page 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.
13. Vaughn Vernon Domain-Driven Design—Up and Running page 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 licensing
14. Vaughn Vernon Domain-Driven Design—Up and Running page 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
15. Vaughn Vernon Domain-Driven Design—Up and Running page 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?