introduction to domain driven design (webtlak #7)
TRANSCRIPT
![Page 1: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/1.jpg)
Introduction to DDD
Adam Štipák | @new_POPE | rekurzia.sk
![Page 2: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/2.jpg)
Who I am?
Adam Štipák@new_POPE
rekurzia.sk
● since 2006
● Sven Creative
● Sygic
● Diagnose.me
● and other “secret” projects
![Page 3: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/3.jpg)
What is DDD?
“is an approach to software development for complex needs by connecting the implementation to an evolving model”
- wikipedia.org
![Page 4: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/4.jpg)
● Useful and meaningful model of its Domain
● Domain Experts contribute to software design
● Better user experience
● Clear boundaries
● Better architecture organization
● Iterative and continuous modeling in an Agile fashion
● better tools, both strategic and tactical design
Why DDD?
![Page 5: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/5.jpg)
Architectural styles - old layered architecture
![Page 6: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/6.jpg)
Architectural styles - MVC
![Page 7: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/7.jpg)
Architectural styles - Hexagonal architecture
![Page 8: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/8.jpg)
The dependecy inversion principle
“High-level modules should not depend on low-level modules. Both should depend on abstractions.
Abstractions should not depend on details. Details should depend on abstractions.”
- Robert C. Martin
![Page 9: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/9.jpg)
Ubiquitous language
“When we recieve a new order, system sends a
notification”
![Page 10: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/10.jpg)
Ubiquitous language
What is the new order?
![Page 11: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/11.jpg)
Bounded context
![Page 12: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/12.jpg)
Building blocks
![Page 13: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/13.jpg)
Value Objects
● Immutable
● “comparable”
![Page 14: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/14.jpg)
Entities
● Identifiable
● Consistent
● Avoid ANEMIC MODEL
○ setSong(newSong)
○ replaceSong(newSong)
![Page 15: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/15.jpg)
Aggregates
● lists, maps, etc
● order, clinic visit, playlist
is a cluster of domain objects that can be treated as a single unit.
… says Martin Fowler
![Page 16: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/16.jpg)
Factories
● creates something
● create(...)
![Page 17: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/17.jpg)
Repositories
● Collection oriented
○ get(ID), add(), addAll(), remove()
● Persistent oriented
○ get(ID), save(), saveAll(), ...
![Page 18: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/18.jpg)
Services
● stateless
● singleton (not Singleton pattern)
○ e.g. ne instance in DI container
● SRP!
![Page 19: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/19.jpg)
Domain Events
● contains data
● immutable
E.g.
● born
● song replaced
● song on cassette was cleared
![Page 20: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/20.jpg)
Resources
● The blue book● The red book
● Domain Driven Design Quickly● Domain-Driven Design in PHP
![Page 21: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/21.jpg)
???Questions ???Adam Štipák | @new_POPE | rekurzia.sk
![Page 22: Introduction to Domain Driven Design (Webtlak #7)](https://reader034.vdocuments.mx/reader034/viewer/2022052705/58e8cdc51a28abb3398b50c7/html5/thumbnails/22.jpg)
Thank you!Adam Štipák | @new_POPE | rekurzia.sk