Domaine Driven Design - Bordeaux IO

27
Domain Driven Design Gérôme Egron Nicolas Jozwiak

description

Introduction au principaux concepts de DDD avec un lien Github pour mettre en place ces derniers. Par Gérome Egron et Nicolas Jozwiak, consultants chez Xebia

Transcript of Domaine Driven Design - Bordeaux IO

Page 1: Domaine Driven Design - Bordeaux IO

Domain Driven DesignGérôme Egron !Nicolas Jozwiak

Page 2: Domaine Driven Design - Bordeaux IO

Programmeur et agiliste!!@njozwiak

Programmeur et agiliste!!@njozwiak

Page 3: Domaine Driven Design - Bordeaux IO

Xebia consultant since 2012.!!

@geromeegron

Page 4: Domaine Driven Design - Bordeaux IO

SOMMAIRE• Domain Driven Design!!• Les principaux concepts!!• Architecture hexagonale!!• Hands On!

Page 5: Domaine Driven Design - Bordeaux IO

Domain Driven Design

Page 6: Domaine Driven Design - Bordeaux IO

REFERENCES

Page 7: Domaine Driven Design - Bordeaux IO

DOMAIN

• Core business of the company!!• Represents a sphere of knowledge!!• Create best software by concentrating on the

problems related to the domain!

Page 8: Domaine Driven Design - Bordeaux IO

DOMAIN

• Not focus on technologies!!• Ubiquitous language !! structured language around the domain model and used by all team members 

Page 9: Domaine Driven Design - Bordeaux IO

MODEL DRIVEN DESIGN

• Represents the domain model in terms of software!!• Code modification means changing model!!• Model is adapted to a usage, a context

Page 10: Domaine Driven Design - Bordeaux IO

PATTERNS

Page 11: Domaine Driven Design - Bordeaux IO

ENTITIES

• entity = identity + state!!• long lifecycle!• has to have an operational way of applying identity!• Identity has to be guaranted unique within the system

Page 12: Domaine Driven Design - Bordeaux IO

ENTITIES

• The object state is the sum of its data values which define it at a precise moment in time!

!• Different stable state which occurs with transformations!!• Mutable and immutable attributes!

Page 13: Domaine Driven Design - Bordeaux IO

VALUE OBJECTS

• No conceptual identity!!• Immutable!!• Focus of their domain!!• Reflect constraints!

Page 14: Domaine Driven Design - Bordeaux IO

VALUE OBJECTS

• Help to define the state of other entities objects!!• Construction has to be meaningful and well formed

Page 15: Domaine Driven Design - Bordeaux IO

VALUE OBJECTS

void addCustomer(String, String)

void addCustomer(Name, PhoneNumber)

• Make implicit concepts explicit

Page 16: Domaine Driven Design - Bordeaux IO

AGGREGATES

• Treats domain objects as a single unit!!• Operations have to interfer with root!!• Ensure integrity of the whole!

Page 17: Domaine Driven Design - Bordeaux IO

SERVICES

• When a significant process or transformation in the domain is not a responsibility of an entity or value object!!• Define an interface in terms of language of the model!!• Have to be stateless!

Page 18: Domaine Driven Design - Bordeaux IO

SERVICE TYPES

• Domain service!!• Infrastructure service!!• Application service

Page 19: Domaine Driven Design - Bordeaux IO

REPOSITORIES

• Mediator between data access and domain layer!!• Root entity

Page 20: Domaine Driven Design - Bordeaux IO

BOUNDED CONTEXT

• Model has a limit!!• Communication with others domains!!• anticorruption layer!• conformist!• shared kernel!• customer/supplier relationship!• separate ways!• open host

Page 21: Domaine Driven Design - Bordeaux IO

ARCHITECTURE HEXAGONALE

Port and Adapter

Page 22: Domaine Driven Design - Bordeaux IO

Alistair Cockburn

Page 23: Domaine Driven Design - Bordeaux IO

Port / Adapter

Domain

X

Page 24: Domaine Driven Design - Bordeaux IO

Port / Adapter

Interface

Repository / Mock

Page 25: Domaine Driven Design - Bordeaux IO

Port / Adapter

Domain

Rest Adapter

Rest Port

Queue Adapter

Queue Port

Page 26: Domaine Driven Design - Bordeaux IO

Port / Adapter

Page 27: Domaine Driven Design - Bordeaux IO

https://github.com/xebia-france/workshop-ddd