domain driven design
DESCRIPTION
Short Domain Driven Design and UML RefresherTRANSCRIPT
![Page 1: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/1.jpg)
Thursday, March 1, 2012
![Page 2: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/2.jpg)
Domain Driven Designshort Refresher
FLOW3 Usergroup @AOEby Daniel Pötzinger
Thursday, March 1, 2012
![Page 3: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/3.jpg)
Thursday, March 1, 2012
![Page 4: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/4.jpg)
The problem that we want to solve
Thursday, March 1, 2012
![Page 5: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/5.jpg)
The problem
Thursday, March 1, 2012
![Page 6: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/6.jpg)
‣ We need to write an application that solves buissiness problems
The problem
Thursday, March 1, 2012
![Page 7: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/7.jpg)
‣ We need to write an application that solves buissiness problems
‣ We want to use OOP
The problem
Thursday, March 1, 2012
![Page 8: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/8.jpg)
‣ We need to write an application that solves buissiness problems
‣ We want to use OOP‣ We need to find a good design:
The problem
Thursday, March 1, 2012
![Page 9: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/9.jpg)
‣ We need to write an application that solves buissiness problems
‣ We want to use OOP‣ We need to find a good design:‣ understanding the problem and the buissiness
The problem
Thursday, March 1, 2012
![Page 10: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/10.jpg)
‣ We need to write an application that solves buissiness problems
‣ We want to use OOP‣ We need to find a good design:‣ understanding the problem and the buissiness‣ find understandable class-structure
The problem
Thursday, March 1, 2012
![Page 11: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/11.jpg)
‣ We need to write an application that solves buissiness problems
‣ We want to use OOP‣ We need to find a good design:‣ understanding the problem and the buissiness‣ find understandable class-structure‣ build maintainable software, that can be adjusted easy when the buissiness changes
The problem
Thursday, March 1, 2012
![Page 12: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/12.jpg)
Thursday, March 1, 2012
![Page 13: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/13.jpg)
Domain Model ?
Thursday, March 1, 2012
![Page 14: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/14.jpg)
Domain Model ?
Thursday, March 1, 2012
![Page 15: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/15.jpg)
‣ The domain model offers a simplified, abstract view of the problem
Domain Model
Domain Model
Thursday, March 1, 2012
![Page 16: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/16.jpg)
‣ The domain model offers a simplified, abstract view of the problem
Domain Model
Domain Model
Domain Experts
Thursday, March 1, 2012
![Page 17: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/17.jpg)
‣ The domain model offers a simplified, abstract view of the problem
Domain Model
Domain Model
Domain Experts
Implementators
Thursday, March 1, 2012
![Page 18: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/18.jpg)
‣ The domain model offers a simplified, abstract view of the problem
Domain Model
Domain Model
Domain Experts
Implementators
Thursday, March 1, 2012
![Page 19: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/19.jpg)
‣ The domain model offers a simplified, abstract view of the problem
Domain Model
Domain Model
Domain Experts
Implementators
Knowledge Crunching & Analysis
Thursday, March 1, 2012
![Page 20: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/20.jpg)
‣ The domain model offers a simplified, abstract view of the problem
Domain Model
Domain Model
Domain Experts
Implementators
Knowledge Crunching & Analysis
Thursday, March 1, 2012
![Page 21: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/21.jpg)
‣ a common language should be used to describe the problem
Domain Model
Domain Model
Domain Experts
Implementators
Ubiquitous Domain Language
Uses termsBoth understand
Thursday, March 1, 2012
![Page 22: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/22.jpg)
‣ a common language should be used to describe the problem
Domain Model
Domain Model
Domain Experts
Implementators
Ubiquitous Domain Language
Uses termsBoth understand
Thursday, March 1, 2012
![Page 23: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/23.jpg)
‣ The Domain Model can be represented as Text, Speech or Code...
Domain Model
Domain Model
Thursday, March 1, 2012
![Page 24: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/24.jpg)
‣ The Domain Model can be represented as Text, Speech or Code...
Domain Model
Domain Model
Text
A customer can have multiple contracts. The customer gets monthly bills to his
billing address.
Thursday, March 1, 2012
![Page 25: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/25.jpg)
‣ The Domain Model can be represented as Text, Speech or Code...
Domain Model
Domain Model
Text
UML
A customer can have multiple contracts. The customer gets monthly bills to his
billing address.
Thursday, March 1, 2012
![Page 26: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/26.jpg)
‣ The Domain Model can be represented as Text, Speech or Code...
Domain Model
Domain Model
Text
UML
A customer can have multiple contracts. The customer gets monthly bills to his
billing address.
Code
Thursday, March 1, 2012
![Page 27: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/27.jpg)
Thursday, March 1, 2012
![Page 28: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/28.jpg)
UML
Thursday, March 1, 2012
![Page 29: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/29.jpg)
•UML is perfect to describe, scetch or discuss a domain model.
UML
UML
Structural Diagrams Behavioral Diagrams
Class Diagrams Object Diagrams Sequence Diagrams Use Case Diagram ......
Thursday, March 1, 2012
![Page 30: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/30.jpg)
UML - Class Diagram
Thursday, March 1, 2012
![Page 31: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/31.jpg)
‣ class diagram describes the attributes and operations of a class and also the constraints imposed on the system.
UML - Class Diagram
Thursday, March 1, 2012
![Page 32: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/32.jpg)
‣ class diagram describes the attributes and operations of a class and also the constraints imposed on the system.
‣ Can be directly mapped to code (OOP)
UML - Class Diagram
Thursday, March 1, 2012
![Page 33: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/33.jpg)
‣ class diagram describes the attributes and operations of a class and also the constraints imposed on the system.
‣ Can be directly mapped to code (OOP)‣ Popular use-case is to explain conceptual important
parts => keep it simple („draw it on a paper“)
UML - Class Diagram
Thursday, March 1, 2012
![Page 34: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/34.jpg)
‣ classes with:‣ attributes (<name>:<type> )‣methods ‣ annotations and properties
‣ Associations‣Multiplicity, roles‣ Traversal‣Aggregation, Composition
‣ Inheritance, Dependency‣ Qualifier ‣ Association Class
UML - Class Diagram - Examples
Thursday, March 1, 2012
![Page 35: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/35.jpg)
‣ Depend on class diagrams‣ „Snapshot“ of instances and theire relations‣ Perfect to understand object behaviour and their
relationship from practical perspective
UML - Object Diagram
Thursday, March 1, 2012
![Page 36: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/36.jpg)
‣ Depend on class diagrams‣ Perfect to explain how objects work together to
„fulfill“ a use-case.‣ useful to detect weakness and improvements in your
design
UML - Sequence Diagram
Thursday, March 1, 2012
![Page 37: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/37.jpg)
Thursday, March 1, 2012
![Page 38: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/38.jpg)
Domain Driven DesignBasics
Thursday, March 1, 2012
![Page 39: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/39.jpg)
1. Layered Architecture2. Common Building Blocks and Rules3. Find a „supple design“4. See the big picture
Domain Driven Design - Basics
Thursday, March 1, 2012
![Page 40: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/40.jpg)
DDD - Layered Architecture
Thursday, March 1, 2012
![Page 41: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/41.jpg)
DDD - Layered Architecture
Infrastructure / SystemLogging
PersitenceSpeaking to Webservices
File Formats
Thursday, March 1, 2012
![Page 42: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/42.jpg)
DDD - Layered Architecture
Domain Model
Infrastructure / SystemLogging
PersitenceSpeaking to Webservices
File Formats
Core Business Logic
Thursday, March 1, 2012
![Page 43: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/43.jpg)
DDD - Layered Architecture
Domain Model
Application Layer (thin)
Infrastructure / SystemLogging
PersitenceSpeaking to Webservices
File Formats
Core Business Logic
Controller / (Export/Import)
Thursday, March 1, 2012
![Page 44: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/44.jpg)
DDD - Layered Architecture
Domain Model
Application Layer (thin)
Infrastructure / SystemLogging
PersitenceSpeaking to Webservices
File Formats
Core Business Logic
Controller / (Export/Import)User / Other Apps
Thursday, March 1, 2012
![Page 45: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/45.jpg)
DDD - Layered Architecture
Domain Model
Application Layer (thin)
View
Infrastructure / SystemLogging
PersitenceSpeaking to Webservices
File Formats
Core Business Logic
Controller / (Export/Import)
Templates / Presentation Objects
User / Other Apps
Thursday, March 1, 2012
![Page 46: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/46.jpg)
Thursday, March 1, 2012
![Page 47: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/47.jpg)
Building Blocks
Thursday, March 1, 2012
![Page 48: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/48.jpg)
Building Blocks
Thursday, March 1, 2012
![Page 49: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/49.jpg)
DDD - Building Blocks
Thursday, March 1, 2012
![Page 50: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/50.jpg)
DDD - Building Blocks
Entities
Thursday, March 1, 2012
![Page 51: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/51.jpg)
DDD - Building Blocks
Entities
Values
Thursday, March 1, 2012
![Page 52: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/52.jpg)
DDD - Building Blocks
Entities
Values
Services
Thursday, March 1, 2012
![Page 53: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/53.jpg)
DDD - Building Blocks
Entities
Values
Services
Repository
Thursday, March 1, 2012
![Page 54: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/54.jpg)
DDD - Building Blocks
Entities
Values
Services
Repository
Factory
Thursday, March 1, 2012
![Page 55: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/55.jpg)
DDD - Building Blocks
Thursday, March 1, 2012
![Page 56: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/56.jpg)
DDD - Building Blocks
Entities
Thursday, March 1, 2012
![Page 57: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/57.jpg)
DDD - Building Blocks
Entities
Object which is primary defined by its identity (not by attributes). For example "Person", "Car", "Costumer" or "BankTransaction".
Thursday, March 1, 2012
![Page 58: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/58.jpg)
DDD - Building Blocks
Entities
Object which is primary defined by its identity (not by attributes). For example "Person", "Car", "Costumer" or "BankTransaction".
• often has some ID value
Thursday, March 1, 2012
![Page 59: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/59.jpg)
DDD - Building Blocks
Entities
Object which is primary defined by its identity (not by attributes). For example "Person", "Car", "Costumer" or "BankTransaction".
• often has some ID value• continuity through livecycle
Thursday, March 1, 2012
![Page 60: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/60.jpg)
DDD - Building Blocks
Entities
Object which is primary defined by its identity (not by attributes). For example "Person", "Car", "Costumer" or "BankTransaction".
• often has some ID value• continuity through livecycle• keep class definition simple / focus on live cycle
Thursday, March 1, 2012
![Page 61: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/61.jpg)
DDD - Building Blocks
Thursday, March 1, 2012
![Page 62: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/62.jpg)
DDD - Building Blocks
Value
Thursday, March 1, 2012
![Page 63: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/63.jpg)
DDD - Building Blocks
Value
describe the characteristic of a thing and identity is not required. (We care what they are - not who) Example: address, color ...
Thursday, March 1, 2012
![Page 64: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/64.jpg)
DDD - Building Blocks
Value
describe the characteristic of a thing and identity is not required. (We care what they are - not who) Example: address, color ...
• should represent a whole value (conceptual thing )
Thursday, March 1, 2012
![Page 65: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/65.jpg)
DDD - Building Blocks
Value
describe the characteristic of a thing and identity is not required. (We care what they are - not who) Example: address, color ...
• should represent a whole value (conceptual thing )• Often passed as arguments
Thursday, March 1, 2012
![Page 66: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/66.jpg)
DDD - Building Blocks
Value
describe the characteristic of a thing and identity is not required. (We care what they are - not who) Example: address, color ...
• should represent a whole value (conceptual thing )• Often passed as arguments• No Identity gives freedom
Thursday, March 1, 2012
![Page 67: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/67.jpg)
DDD - Building Blocks
Value
describe the characteristic of a thing and identity is not required. (We care what they are - not who) Example: address, color ...
• should represent a whole value (conceptual thing )• Often passed as arguments• No Identity gives freedom• should be Immutable!
Thursday, March 1, 2012
![Page 68: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/68.jpg)
DDD - Building Blocks
Thursday, March 1, 2012
![Page 69: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/69.jpg)
DDD - Building Blocks
Service
Thursday, March 1, 2012
![Page 70: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/70.jpg)
DDD - Building Blocks
Service
“...if a single process or transformation in domain is not a natural responsibility of an entity or value => make it a standalone service with a nice interface."
Thursday, March 1, 2012
![Page 71: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/71.jpg)
DDD - Building Blocks
Service
“...if a single process or transformation in domain is not a natural responsibility of an entity or value => make it a standalone service with a nice interface."
• stateless
Thursday, March 1, 2012
![Page 72: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/72.jpg)
DDD - Building Blocks
Service
“...if a single process or transformation in domain is not a natural responsibility of an entity or value => make it a standalone service with a nice interface."
• stateless• offer a useful service or action and deals with other domain objects
Thursday, March 1, 2012
![Page 73: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/73.jpg)
DDD - Building Blocks
Service
“...if a single process or transformation in domain is not a natural responsibility of an entity or value => make it a standalone service with a nice interface."
• stateless• offer a useful service or action and deals with other domain objects• defined in common domain language
Thursday, March 1, 2012
![Page 74: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/74.jpg)
DDD - Building Blocks
Service
“...if a single process or transformation in domain is not a natural responsibility of an entity or value => make it a standalone service with a nice interface."
• stateless• offer a useful service or action and deals with other domain objects• defined in common domain language• do not mix with other layers
Thursday, March 1, 2012
![Page 75: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/75.jpg)
DDD - Building Blocks
Service
“...if a single process or transformation in domain is not a natural responsibility of an entity or value => make it a standalone service with a nice interface."
• stateless• offer a useful service or action and deals with other domain objects• defined in common domain language• do not mix with other layersExamples: FundTransferService / PackageRoutingService / SimCardActivationService
Thursday, March 1, 2012
![Page 76: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/76.jpg)
DDD - Building Blocks
Thursday, March 1, 2012
![Page 77: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/77.jpg)
DDD - Building Blocks
Repository
Thursday, March 1, 2012
![Page 78: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/78.jpg)
DDD - Building Blocks
Repository
For each object where you need global access create a repository object that can provide the illusion of an in memory collection of all objects of that type. Setup access through a well knows global interface.
Thursday, March 1, 2012
![Page 79: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/79.jpg)
DDD - Building Blocks
Repository
For each object where you need global access create a repository object that can provide the illusion of an in memory collection of all objects of that type. Setup access through a well knows global interface.
• typicaly methods for add() remove() and find*()
Thursday, March 1, 2012
![Page 80: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/80.jpg)
DDD - Building Blocks
Repository
For each object where you need global access create a repository object that can provide the illusion of an in memory collection of all objects of that type. Setup access through a well knows global interface.
• typicaly methods for add() remove() and find*()•find* methods communicate design decisions about how to access the data
Thursday, March 1, 2012
![Page 81: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/81.jpg)
DDD - Building Blocks
Repository
For each object where you need global access create a repository object that can provide the illusion of an in memory collection of all objects of that type. Setup access through a well knows global interface.
• typicaly methods for add() remove() and find*()•find* methods communicate design decisions about how to access the data• ..reconstitution?
Thursday, March 1, 2012
![Page 82: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/82.jpg)
DDD - Building Blocks
Thursday, March 1, 2012
![Page 83: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/83.jpg)
DDD - Building Blocks
Factory
Thursday, March 1, 2012
![Page 84: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/84.jpg)
DDD - Building Blocks
Factory
A factory hides logic for building objects - this is especially relevant for aggregates!
Thursday, March 1, 2012
![Page 85: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/85.jpg)
DDD - Building Blocks
Factory
A factory hides logic for building objects - this is especially relevant for aggregates!
• atomic (need to pass all essential parameters)
Thursday, March 1, 2012
![Page 86: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/86.jpg)
DDD - Building Blocks
Factory
A factory hides logic for building objects - this is especially relevant for aggregates!
• atomic (need to pass all essential parameters)• not allowed to give wrong results (exceptions)
Thursday, March 1, 2012
![Page 87: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/87.jpg)
DDD - Building Blocks
Factory
A factory hides logic for building objects - this is especially relevant for aggregates!
• atomic (need to pass all essential parameters)• not allowed to give wrong results (exceptions)• entity vs. value factories
Thursday, March 1, 2012
![Page 88: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/88.jpg)
DDD - Building Blocks
Factory
A factory hides logic for building objects - this is especially relevant for aggregates!
• atomic (need to pass all essential parameters)• not allowed to give wrong results (exceptions)• entity vs. value factories• (can also be used for reconstitution )
Thursday, March 1, 2012
![Page 89: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/89.jpg)
Thursday, March 1, 2012
![Page 90: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/90.jpg)
Find a Supple Design
Thursday, March 1, 2012
![Page 91: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/91.jpg)
Find a Supple Design
vs.
Thursday, March 1, 2012
![Page 92: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/92.jpg)
Supple Design „Speak in Domain Language“
Thursday, March 1, 2012
![Page 93: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/93.jpg)
‣ Try to explain scenarios loud with the use of the model and the ubiquitous language
Supple Design „Speak in Domain Language“
Thursday, March 1, 2012
![Page 94: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/94.jpg)
‣ Try to explain scenarios loud with the use of the model and the ubiquitous language
‣ Try to explain scenarios more simple/better (find easier ways to say what you need to say). => That helps refining the model.
Supple Design „Speak in Domain Language“
Thursday, March 1, 2012
![Page 95: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/95.jpg)
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 96: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/96.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 97: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/97.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
‣ traversal instead of bidirectional
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 98: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/98.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
‣ traversal instead of bidirectional‣ adding qualifier to reduce multiplicity (class missing?)
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 99: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/99.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
‣ traversal instead of bidirectional‣ adding qualifier to reduce multiplicity (class missing?)‣ eliminate non essential assoc.
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 100: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/100.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
‣ traversal instead of bidirectional‣ adding qualifier to reduce multiplicity (class missing?)‣ eliminate non essential assoc.‣ find and use aggregates
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 101: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/101.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
‣ traversal instead of bidirectional‣ adding qualifier to reduce multiplicity (class missing?)‣ eliminate non essential assoc.‣ find and use aggregates
=> Intuition and Refactoring
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 102: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/102.jpg)
‣ Avoid many association and use only a minimum of relations because they decrease maintainability!
‣ traversal instead of bidirectional‣ adding qualifier to reduce multiplicity (class missing?)‣ eliminate non essential assoc.‣ find and use aggregates
=> Intuition and Refactoring
... country / president example ...
Supple Design „Reduce Associations“
Thursday, March 1, 2012
![Page 103: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/103.jpg)
Supple Design - Aggregates
Thursday, March 1, 2012
![Page 104: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/104.jpg)
Supple Design - Aggregates
‣ An aggregate is a group of objects that belong together (a group of individual objects that represents a unit)
Thursday, March 1, 2012
![Page 105: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/105.jpg)
Supple Design - Aggregates
‣ An aggregate is a group of objects that belong together (a group of individual objects that represents a unit)
‣ ...car example... (root, boundary, invariants )
Thursday, March 1, 2012
![Page 106: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/106.jpg)
Supple Design - „Explicit constrains“
Thursday, March 1, 2012
![Page 107: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/107.jpg)
Supple Design - „Explicit constrains“
‣ name and make constrains explicit. That gives it a name you can talk about and the code is more understandable
Thursday, March 1, 2012
![Page 108: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/108.jpg)
Supple Design - „Explicit constrains“
‣ name and make constrains explicit. That gives it a name you can talk about and the code is more understandable
Bucket example
Thursday, March 1, 2012
![Page 109: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/109.jpg)
Supple Design - „Specifications“
Thursday, March 1, 2012
![Page 110: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/110.jpg)
Supple Design - „Specifications“
‣ you can use „Specifications“ to explicit express rules
Thursday, March 1, 2012
![Page 111: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/111.jpg)
Supple Design - „Specifications“
‣ you can use „Specifications“ to explicit express rules
examples:
Thursday, March 1, 2012
![Page 112: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/112.jpg)
Supple Design - „Specifications“
‣ you can use „Specifications“ to explicit express rules
examples:„InventoryDelinquentSpecification“->isSatisfied()
Thursday, March 1, 2012
![Page 113: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/113.jpg)
Supple Design - „Specifications“
‣ you can use „Specifications“ to explicit express rules
examples:„InventoryDelinquentSpecification“->isSatisfied()„GoldenCustomerSpecification“->isSatisfied($customer)
Thursday, March 1, 2012
![Page 114: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/114.jpg)
Supple Design - Modules
If your model tells a story a module is a chapterThursday, March 1, 2012
![Page 115: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/115.jpg)
Supple Design - Modules
Customer Order
Product
Customer Contract Basket Order
OrderItems
AbstractProduct
Prepaid
Thursday, March 1, 2012
![Page 116: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/116.jpg)
Supple Design - Modules
Customer Order
Product
Customer Contract Basket Order
OrderItems
AbstractProduct
Prepaid
• group by meaning in the domain
Thursday, March 1, 2012
![Page 117: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/117.jpg)
Supple Design - Modules
Customer Order
Product
Customer Contract Basket Order
OrderItems
AbstractProduct
Prepaid
• group by meaning in the domain• loose coupling between modules
Thursday, March 1, 2012
![Page 118: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/118.jpg)
Supple Design - What else
Thursday, March 1, 2012
![Page 119: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/119.jpg)
Supple Design - What else
• Intention Revalving Interfaces
Thursday, March 1, 2012
![Page 120: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/120.jpg)
Supple Design - What else
• Intention Revalving Interfaces• standalone classes where possible
Thursday, March 1, 2012
![Page 121: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/121.jpg)
Supple Design - What else
• Intention Revalving Interfaces• standalone classes where possible• closure of operations
Thursday, March 1, 2012
![Page 122: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/122.jpg)
Supple Design - What else
• Intention Revalving Interfaces• standalone classes where possible• closure of operations• side effect free functions
Thursday, March 1, 2012
![Page 123: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/123.jpg)
Thank you for great year!
Thursday, March 1, 2012
![Page 124: Domain Driven Design](https://reader034.vdocuments.us/reader034/viewer/2022051616/5550f3c5b4c90501448b45ca/html5/thumbnails/124.jpg)
Thank you for great year!Thanks
Thursday, March 1, 2012