22
Introduction to DDD Adam Štipák | @new_POPE | rekurzia.sk

Introduction to Domain Driven Design (Webtlak #7)

Embed Size (px)

Citation preview

Page 1: Introduction to Domain Driven Design (Webtlak #7)

Introduction to DDD

Adam Štipák | @new_POPE | rekurzia.sk

Page 2: Introduction to Domain Driven Design (Webtlak #7)

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)

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)

● 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)

Architectural styles - old layered architecture

Page 6: Introduction to Domain Driven Design (Webtlak #7)

Architectural styles - MVC

Page 7: Introduction to Domain Driven Design (Webtlak #7)

Architectural styles - Hexagonal architecture

Page 8: Introduction to Domain Driven Design (Webtlak #7)

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)

Ubiquitous language

“When we recieve a new order, system sends a

notification”

Page 10: Introduction to Domain Driven Design (Webtlak #7)

Ubiquitous language

What is the new order?

Page 11: Introduction to Domain Driven Design (Webtlak #7)

Bounded context

Page 12: Introduction to Domain Driven Design (Webtlak #7)

Building blocks

Page 13: Introduction to Domain Driven Design (Webtlak #7)

Value Objects

● Immutable

● “comparable”

Page 14: Introduction to Domain Driven Design (Webtlak #7)

Entities

● Identifiable

● Consistent

● Avoid ANEMIC MODEL

○ setSong(newSong)

○ replaceSong(newSong)

Page 15: Introduction to Domain Driven Design (Webtlak #7)

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)

Factories

● creates something

● create(...)

Page 17: Introduction to Domain Driven Design (Webtlak #7)

Repositories

● Collection oriented

○ get(ID), add(), addAll(), remove()

● Persistent oriented

○ get(ID), save(), saveAll(), ...

Page 18: Introduction to Domain Driven Design (Webtlak #7)

Services

● stateless

● singleton (not Singleton pattern)

○ e.g. ne instance in DI container

● SRP!

Page 19: Introduction to Domain Driven Design (Webtlak #7)

Domain Events

● contains data

● immutable

E.g.

● born

● song replaced

● song on cassette was cleared

Page 20: Introduction to Domain Driven Design (Webtlak #7)

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)

???Questions ???Adam Štipák | @new_POPE | rekurzia.sk

Page 22: Introduction to Domain Driven Design (Webtlak #7)

Thank you!Adam Štipák | @new_POPE | rekurzia.sk