Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork...

90
@cyriux @arollafr

description

Vous avez entendu parler de Domain-Driven Design (DDD) et vous voulez en savoir plus ? Nous vous offrons un tour d'horizon de concepts importants de DDD et leur application en pratique, avec des retours d'un projet récent. Vidéo de la présentation disponible : http://www.dailymotion.com/video/xq62pf_aroll-fterwork-du-11-avril-domain-driven-design_tech

Transcript of Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork...

Page 1: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

@cyriux @arollafr

Page 2: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Tour d’horizon Domain-Driven

DesignRetour sur un projet récent

Page 3: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

http://fr.gta.wikia.com/wiki/Easter_Eggs

Page 4: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Executive Summary

Domain-Driven Design :

• Priorité au domaine, devant la technique• Parler le langage du métier, pour tout le

monde, dans le code et dans les tests• Le code est le modèle (et vice-versa)• Mon arme secrète sur mes projets depuis

2005

Page 5: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla
Page 6: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla
Page 7: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

http://www.virtual-genius.com/blog/post/Domain-Driven-Design-Immersion-Course-e28093-Part-5.aspx

Page 8: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Seniors Developers

http://www.thisisio.ie/blog/article/149/hiring_senior_developer

Page 9: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

I. Putting the model to work

II. Building blocks (Tactical DDD)

III. Refactoring toward deeper insight

IV. Strategic DDD

Page 10: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

DDD + BDD +TDD = VERY GOOD FRIENDS!

http://www.alicia-logic.com/capspages/caps_viewall.asp?titleid=16

Page 11: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Souvent DénaturéSans outillage

spéci!que

CQRS: + populaire

Très respecté

Page 12: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Ambition

Page 13: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla
Page 14: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla
Page 15: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Objectif ambitieux

Grosse attente sponsor

Gros legacy

Page 16: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

?

Page 17: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

http://www.ratemyfunnypictures.com/index.php/8148/rate-my-one-at-a-time/

Page 18: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Agree on Maxims

“One at-a-time”

Page 19: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Visualize! Metaphors!

http://staff.bath.ac.uk/enssa/LPDev.htm

Page 20: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Asset Capture

1 seul concept d’intervention : “moteur”

http://martinfowler.com/bliki/AssetCapture.html

Moteur

Echappement

Transmission

Page 21: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Strangler application

Un nouveau moteur qui étranglera progressivement l’ancien

http://www.flickr.com/photos/louisfoecy/4114597043

http://martinfowler.com/bliki/StranglerApplication.html

Page 22: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Plan d’action

1 seul concept d’intervention : “produits financiers”

Strangler application sur ce concept seulement

Tout le reste : on garde sans modifier

Page 23: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

DU *VRAI* MODEL-DRIVEN DESIGN

Et maintenant

Page 24: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

UNE CURIOSITÉ SINCÈRE POUR LE MÉTIER

Au commencement :

http://jnchaintreuil.com/et-si-le-futur-appartenait-aux-curieux/

Page 25: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Changement culturel• Le métier c’est cool• Passer à la vitesse supérieure

http://rumors.automobilemag.com/feature-flick-2012-porsche-911-7-speed-manual-73509.html

Page 26: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Investir dans la connaissance métier

Mini-training 30mn bi-hebdo

http://www.femmeactuelle.fr/jardin/jardinage-les-conseils/arroser-son-jardin-pendant-les-vacances-00873

Page 27: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Accès à un expert du sujet

http://bakchich-old.static.ddz.fr/IMG/jpg_expert-2.jpg

Page 28: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Proxys d’experts métier

http://fr.m.wikipedia.org/wiki/Fichier:Crocodile_warning_sign_02.svg

Page 29: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Le langage compte!• La modélisation

commence avec le langage

• Attentions aux « synonymes » et aux mots centraux du métier

• Poser des bonnes (meilleures) questions

http://journalism.about.com/od/reporting/tp/Finding-And-Developing-Ideas-For-News-Stories-And-Articles.htm

Page 30: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Searching for the Ubiquitous Language

An instrument is effective for a period of time (its life), that is the date range between the effective date and the expiry dateA swap is made of legs, each of them being an independent instrument on its own. Each leg defines two counterpartiesA payoff is a cash flow given by one counterparty to the other counterpartyInstruments generate cash flows during their life, in particular at expiry date (redemption, zero coupon) and at regular datesThere may be a date offset for settlements, fixings and cash flows paymentsFloating rate devices generate cash flows according to observation expressions based on some observable referenceFixed rate devices generate cash flows according to a predefined couponInflation-linked devices modulate the coupon, coupon rate or notional amount by the variation of some (inflation) observable referenceRegular dates may be predefined explicitly as a dates list, or as repeated dates defined by a period and a time direction (backward or forward), with stub convention and date adjustment rules, and according to some holiday calendarDate adjustment rules are defined by a day roll convention and a business centerA funding leg is a fixed rate device or a floating rate deviceA return leg is a leg that reproduces the exact cash flows of another instrument

A credit leg observes credit events from some identified instrument and triggers either a physical settlement or to a cash settlement. Typical credit events are bankruptcy, failure to pay, restructuringForward and Future means that the effective date is in the future. The difference between forward and future is that the former is OTC whereas the later is cleared, more standard, and involves frequent margin calls (hence a convexity bias between them)From a legal perspective, an option is the right to exercise some transaction, typically to buy/sell the underlying instrument at a predefined strike and volume, or to receive a payoff. Since investors are rational, we may also consider options to be essentially instruments with conditional transaction, in general payoffsOption styles are typically European (exercise only at expiry date), American (exercise anytime), Bermuda (exercise at regular dates), Canary (exercise at regular dates after some date or period)An underlying instrument is an instrument used to condition the exercise (which may be automatic) and often used to calculate the amount of the payoff or more that is directly the object of an exchange, in the case of an exchange of assetsSome instruments are subject to conversion, i.e. they can be replaced with another instrumentSome instruments involve one, two or no exchange(s) of principal(s)Compounding swaps capitalize interests earned for each period payment period

Cash Flow

Bank HolidayInterest rate

Page 31: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Ubiquitous Language

• Nommer•Facile à chercher•Prononçables•Sans abréviation

• Définir•Définition partagée•Comprendre, pas juste un vocabulaire

http://scalin.fr/rubrique-technique/glossaire

Page 32: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Our brain is a compiler

CC: Gaetan Lee / http://en.wikipedia.org/wiki/File:Chimp_Brain_in_a_jar.jpg

Page 33: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Invariants, symétries, On peut déjà refactoriser des

duplications en langage naturel:• « A chaque date anniversaire, une

obligation paie un coupon »• « A chaque fin de période, une jambe de

swap paie les intérêts sur la période »

= Un seul scénario !

Page 34: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Invariants« Le marché des instruments dérivés est

à somme nulle »

Σ Cash Flows (toutes les contreparties) = 0

Page 35: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Agile ➜ Confiance

Mais pas dans les documents texte !

Page 36: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

MS Word Docs Vs. POC’s

Vs.

http://www.hacknmod.com/wp-content/uploads/2008/12/dsc_2875.jpg

Page 37: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

MS Word Docs Vs. POC’s

Vs.

ContradictionsOublis essentiels

Si ça marche pas ça se

voit !

Page 38: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Codeanalysis• Modéliser, en code• Bloc-notes exécutable• Domain-Model-first• Antidote Analysis Paralysis (Greg

Young)• Spike isolé, jetable (ou non)• Deliberate Discovery (Dan North)

http://dannorth.net/2010/08/30/introducing-deliberate-discovery/http://codebetter.com/gregyoung/tag/analysis/

Page 39: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

*NOT* UML/MDA!

http://depinfo.u-cergy.fr/projets/close2u/fr/tag/uml/

Page 40: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

No Translation: Code == Model

• Ubiquitous Langage dans le code• Noms de classes & interfaces• Noms de méthodes• Code lisible en prose autant que possible

•≥ 80% noms de classes & méthodes lisibles par le métier

Page 41: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Code = Medium

• Raconte le métier• Auto-formation métier• Auto-formation patterns aussi :

• Export documentation de référence métier (Doclet)

Page 42: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Exemple d’export

42

PipeAdmission

Vilebrequin

Injecte l'essence et l'aire dans le moteur et passant par le vilebrequin pour le graissage des roulements puis monte dans le cylindre par les transferts

Pièce sur laquelle est fixé le piston qui, grâce à l'explosion descend en faisant tourner le vilebrequin, qui fera tourner la roue en passant par l'embrayage et la boîte à vitesse (sur le ciao, la boîte à vitesse est placée dans la roue arrière

Bougie

Allumage

Carter

Cylindre

Piston

AxePiston

Le rôle de la bougie est de crée un petit arc électrique pour faire exploser, au bout du moteur, le mélange air-essence comprimé par le piston.

Déclenche l’étincelle dans la bougie

AllumageRupteur : bobine haute-tension pour allumage rustique

AllumageElectronique : circuit électronique haute-tension pour allumage précis

Coque fermée qui contient le vilebrequin

Le cylindre contient les transferts qui amènent l'essence dans la partie entre la fin du cylindre et la culasse où se passe la compression et de la lumière d'échappement (sortie des gaz vers le pot)

Elément clé du moteur qui subit la pression quand le mélange air-essence explose, il recule avec une force équivalente a 2000kg. et fait tourner le vilebrequin qui entraine le reste...

l'axe du piston sert à tenir le piston à la bielle.

Page 43: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Avantages

• Spécifications minces• Efficacité du langage partagé• Plus d’autonomie des développeurs / testeurs• Moins de malentendus

43

Page 44: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Avantages

• Economie grâce à la qualité de code: • pas de traduction : moins de gaspillage• moins de code (moins de cas particuliers)• meilleur rapport signal / bruit : lisible• code auto-documenté : facile à comprendre• concepts métier assez stables

44

Page 45: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

• Plus de valeur livrée

• Initiatives développeurs : «et si... ?»

• Motivation des développeurs brillants

http://www.flickr.com/photos/8681025@N03/3249399322/

Page 46: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

En code...

46

Page 47: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

« DayShift by -2 WORKING days »

No getter/setter

Immutable

Enum

Page 48: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

null

Code concentré en métier• 100% métier (ou presque)• No framework pollution

• Spring, Hibernate, logger• No javax.*• No SQL

• Only

http://code.google.com/p/guava-libraries/

Dans le modèle de domaine

Page 49: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Value Object• No particular identity, equality by value• Fowler patterns: ValueObject, Quantity,

Range• Immutable

• Constructor / Static Creator / Factory method

• Style FP• Side-effect-free

Mon choix par défaut,

sauf si vraiment pas

possible !

Page 50: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Equality by value

Value Object

Page 51: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

• Functional programming style• Immutable, clone to mutate• Capture values (snapshot) • History object of every version

• Builder pour aider à la création• par exemple :• String & StringBuilder

Value Object

Page 52: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Value Object

Page 53: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

// foreach(numberOfDays)

Page 54: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Défini par une identité arbitraire

Notion de continuité dans le temps

Entities

Page 55: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Une collection d’objets liés qui partagent une cohérence ensembles, avec une entité racine pour l’identité : Aggregate Root

Aggregates

http://www.boitearecettes.com/fruits_legumes/raisin-text.htm

Page 56: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Ni une valeur ni une entité

Services

http://www.andeka.co.cc/2011/07/postbox-251.html

Page 57: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Module (lib)

<<ValueObject

<<ValueObject

<<ValueObject>><<ValueObje

ct<<ValueObject>>

<<Service>><<SPI>>

<<Service>><<API>>

<<Entity>><<Aggregate>>

Module ==

library

Accès aux services

extérieurs

Page 58: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Module ==

library

Accès aux services

extérieurs

Page 59: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Façade sur le legacy

• Tout le code ne mérite pas la même attention et n'a pas vocation à être repris!

• Dette technique seulement si on paie des intérêts

<<ACL>><<Facade>>

Page 60: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

En gros

• DDD : façon d’aborder les problèmes + solutions

•Focus sur le métier•Focus sur le langage du métier

Page 61: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

AMBITIEUX == DANGEREUX

Page 62: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Big Bang == Big FailFrom Scratch == Casse-Gueule

StabilisationMaturationRetour des

bugs historiques

http://www.sciencesortof.com/2011/05/episode-84-the-big-bang/

Page 63: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Fort besoin d’un filet de tests complet

BDD

Page 64: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Stratégie de tests

“1000’s of unit tests”

“10% of unit tests number”

“10 overall”

Page 65: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Stratégie de tests

“1000’s of unit tests”

“10% of unit tests number”

“10 overall”

Blackbox

Whitebox

Page 66: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

En pratiqueJunit

Predefined implementations of the external service: total control of scenario data

http://greenarrow.deviantart.com/art/The-Flash-Wally-West-35885287

Page 67: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

http://nw.wea.org.uk/blogs/extending_learning_coversations.php

•Face to face IRL (travel)•Telephone•Chat•Email

Page 68: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

3 amigos

BA Dev Tester

http://sanslignebleue.files.wordpress.com/2010/02/3-amigos.jpg

Page 69: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

DONE criteria : DONE!Given a floating rate bond on EURIBOR 3MAnd a nominal of 15M EURAnd an issue date of 2011/06/15And an end date of 2012/06/14And an SEMI_ANNUAL calculation period

When the EURIBOR 3M evolves:| 2011/09/15 | 3.5% | | 2012/03/15 | 4.0% |

Then the cash-flows are:| 2011/12/13 | 23000 || 2012/06/14 | 25500 |

Page 70: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

http://nxadm.wordpress.com/tag/bug/

Page 71: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Remarques• GUI & DB testing • BDD scénarios & BA

• Faire générique (cross-asset) moins expressif

• DDD difficile à expliquer, avancer couvert, montrer les bénéfices 

Page 72: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

INTÉGRATION & LEGACY

Page 73: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Plus facile à intégrer par construction

lib sur-mesure

Page 74: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Hexagonal Architecture

http://pragprog.com/magazines/2009-12/going-naked

Depends on nothing

Page 75: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Hexagonal Architecture

Page 76: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Hexagonal Architecture

Scenario test data

Adapters

Page 77: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

INTÉGRATION & LEGACY

Page 78: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Bounded Contexts!

“The delimited applicability of a particular model”

Context X

Context Y

Same concept• Different contexts• Different focus• => Different models

Page 79: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Context Game

“What's your ideal <customer>?”

• sales : il a beaucoup d’argent et beaucoup d’envies

• marketing : il aime notre produit et il le dit à tout le monde sur les réseaux sociaux

• shipping : il habite à coté de l’entrepôt et est toujours chez lui

• facturation : il paie d’avance sans sourciller même si le produit n’est pas en stock

Page 80: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Context Game

“What's your ideal <instrument>?”

• pre-trade : il est très liquide avec un faible écart entre bid et offer

• trading : il a un identifiant unique et uniforme facile à saisir

• risk : il est risqué sur un seul facteur de risque

• back-office : il a peu de cash-flows et les cash-flows sont certains et connus longtemps avant

Page 81: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Context Game

“What's your ideal <instrument>?”

• pre-trade : il est très liquide avec un faible écart entre bid et offer

• trading : il a un identifiant unique et uniforme facile à saisir

• risk : il est risqué sur un seul facteur de risque

• back-office : il a peu de cash-flows et les cash-flows sont certains et connus longtemps avant

Page 82: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Contexts & mappers

Trading<<legacy>>

Risk<<legacy>>

Cash-flows<<strangler>>

CRUD<<legacy POJO>>

DB<<legacy>>

Non DDD

(anémique)

Hibernate ORM

Page 83: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Multiple Models ≠ Duplication

Trading<<legacy>>

Risk<<legacy>>

Cash-flows<<strangler>>

CRUD<<legacy POJO>>

DB<<legacy>>

Non DDD

(anémique)

Hibernate ORM

Page 84: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Adapter = Shock Absorber

http://www.directindustry.com/prod/herwarth-reich/flexible-couplings-elastic-couplings-19991-374565.html

DDD: Anti-Corruption

Layer

Page 85: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Adapter = Shock Absorber

http://www.directindustry.com/prod/herwarth-reich/flexible-couplings-elastic-couplings-19991-374565.html

Page 86: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Adapter = Shock Absorber

http://www.directindustry.com/prod/herwarth-reich/flexible-couplings-elastic-couplings-19991-374565.html

Page 87: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla
Page 88: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Merci !

http://cathy313.centerblog.net/539-bisounours

Page 89: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

Vos questions

Page 90: Tour d'horizon de Domain-Driven Design Avril 2012 autour d'un retour d'expérience - Aroll@fterwork Arolla

@cyriux @arollafr