Domain-Driven Design in legacy application
-
Upload
martraire-cyrille -
Category
Technology
-
view
1.243 -
download
3
description
Transcript of Domain-Driven Design in legacy application
![Page 1: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/1.jpg)
Legacy applicationLarge ambitions
A case study: how DDD helped deliver at Sungard Asset Arena
Cyrille Martraire - @cyriux -
![Page 2: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/2.jpg)
http://cutefunnyanimal.blogspot.in/2012/01/funny-tired-dogs-photos-images-2012.html
![Page 3: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/3.jpg)
LEGACY
![Page 4: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/4.jpg)
Passionate developer
PARISSince 1999
@cyriux
![Page 5: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/5.jpg)
Paris Software Craftsmanship Community
http://www.meetup.com/paris-software-craftsmanship/
![Page 6: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/6.jpg)
Arolla
Arolla.fr
![Page 7: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/7.jpg)
A Case Study
![Page 8: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/8.jpg)
From a recent project (contract)
Every example is made-up to protect the innocent IP.
![Page 9: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/9.jpg)
Once upon a time…
![Page 10: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/10.jpg)
Large Ambition
![Page 11: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/11.jpg)
Asset Management
![Page 12: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/12.jpg)
![Page 13: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/13.jpg)
Buy, Partner or Make?
![Page 14: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/14.jpg)
Buy, Partner or Make?
![Page 15: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/15.jpg)
Project Life
2010 2011 2012
+BA
+QA
+Dev Dev++
PHASE 1
PHASE 2 PHASE 3
PHASE 4
![Page 16: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/16.jpg)
“You’ve got the right
skillsWe trust you.
Deliver”
![Page 17: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/17.jpg)
So how do we do that?
![Page 18: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/18.jpg)
?
![Page 19: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/19.jpg)
Spike!
3-weeksDeliberate Discovery in mind
PHASE 1
![Page 20: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/20.jpg)
Codeanalysis[Greg Young]
Within 3 weeks1. Conversations with experts2. Code the understanding & note questions3. Iterate
http://skillsmatter.com/podcast/design-architecture/mystery-ddd/js-4401
![Page 21: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/21.jpg)
Find the Domain Experts
![Page 22: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/22.jpg)
The of!cial expert(former Asset Manager)
![Page 23: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/23.jpg)
Proxy Domain Experts
![Page 24: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/24.jpg)
Proxy Domain Experts
![Page 25: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/25.jpg)
Haz Context?
Sell-Side(Hedging) Broker
(A Vs. B)
Buy-Side(investment)
Accounting(tax, Basel etc)
Accounting(tax, accuracy, boring stuff)
+ fees!
“Trade” = ?
![Page 26: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/26.jpg)
Fossilized Domain Expertise
http://newspaper.li/fossil/
![Page 27: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/27.jpg)
Conversations !rst
• Ask *good* questions• Build respect and confidence
• Beware and care about synonyms and main concepts
http://journalism.about.com/od/reporting/tp/Finding-And-Developing-Ideas-For-News-Stories-And-Articles.htm
![Page 28: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/28.jpg)
Sketching
![Page 29: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/29.jpg)
Sketching
![Page 30: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/30.jpg)
Sketching
![Page 31: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/31.jpg)
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
Growing our Ubiquitous Language
Collecting scenarios
![Page 32: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/32.jpg)
Taking notes, in code
Class, interface names & documentationFieldsRelationships (if any)
+ Behavior!
![Page 33: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/33.jpg)
Code doesn’t lie
Got something wrong?Forgot something?
It shows!
![Page 34: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/34.jpg)
Found a metaphor
http://www.marksmart.net/gearhack/pogomoog/pogomoog.html
![Page 35: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/35.jpg)
Found a metaphorModular Synthesizer
Martin Russ - http://eetimes.com/design/audio-design/4238388
![Page 36: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/36.jpg)
Found a metaphorIn Java code
Output of a class/function is the input
of another
![Page 37: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/37.jpg)
![Page 38: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/38.jpg)
So let’s keep on coding and rebuilding
everything!
Sounds like a great idea!
![Page 39: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/39.jpg)
http://skillsmatter.com/podcast/design-architecture/talk-from-eric-evans
![Page 40: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/40.jpg)
Plenty of Legacy code working since 1993
Redoing = waste + risk
![Page 41: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/41.jpg)
Still need to redo some parts
How do we integrate with legacy?Where do we stop redoing?
![Page 42: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/42.jpg)
Legacy strategy
Know your enemiesAsset Capture & Strangler Application
Bubble Context & ACLScream it loud
PHASE 2
![Page 43: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/43.jpg)
Know your enemies[discover the app]
Read the documents
Interview peopleUse the application
Read the code
Fix bugs
![Page 44: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/44.jpg)
Visualize[primary "ow & support features]
http://www.fimarkets.com/pagesen/back-middle-front-office.php
![Page 45: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/45.jpg)
Visualize[primary "ow & support features]
http://www.fimarkets.com/pagesen/back-middle-front-office.php
![Page 46: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/46.jpg)
Visualize[primary "ow & support features]
http://www.fimarkets.com/pagesen/back-middle-front-office.php
![Page 47: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/47.jpg)
http://staff.bath.ac.uk/enssa/LPDev.htm
Asset Inventory
![Page 48: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/48.jpg)
Asset Capture
http://martinfowler.com/bliki/AssetCapture.html
Engine
Exhaust
Transmission
![Page 49: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/49.jpg)
Asset Capture
Focus on one single asset : the engine
http://martinfowler.com/bliki/AssetCapture.html
Engine
Exhaust
Transmission
![Page 50: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/50.jpg)
Strangler application
A new module will progressively
strangle the former one, for one single
asset only
http://www.flickr.com/photos/louisfoecy/4114597043
http://martinfowler.com/bliki/StranglerApplication.html
![Page 51: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/51.jpg)
Conservative by default
• Keep existing architecture– N-tiers, application server,
middleware– Same database– Same UI technology
– (Almost) all the legacy code
Diagrams shamelessly stolen from Eric Evans DDDx 2011 talk
![Page 52: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/52.jpg)
Bubble Context
• Create a little bubble of innovation
• Brand new model
• As clean as we like• Highly tested• High hygiene standards
![Page 53: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/53.jpg)
Bubble Context
• ACL to protect from the legacy code
• Translates legacy objects & services into new, cleaner ones
![Page 54: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/54.jpg)
Strangler (cont.)
• Progressively turn off legacy functionalities & turn on the new ones
![Page 55: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/55.jpg)
Agree on maxims[communicate the plan]
• “Only one work site at a time: instruments”
• “When in Rome, do as Romans do”
![Page 56: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/56.jpg)
Scaling development in the bubble context
Infect the teamCode as SPOT
High hygiene standardsFunctional-style
PHASE 3
![Page 57: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/57.jpg)
![Page 58: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/58.jpg)
I only care about Java EE 6
![Page 59: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/59.jpg)
Hey! Finance is cool!
![Page 60: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/60.jpg)
![Page 61: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/61.jpg)
Oh, this domain is
really cool!
![Page 62: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/62.jpg)
Oh, this domain is
really cool!I’d like to know it better!
![Page 63: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/63.jpg)
Invest in domain knowledge
• Bi-weekly 30mn training sessions
![Page 64: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/64.jpg)
Signal to Noise ratio
http://www.flickr.com/photos/28471130@N07/2666802097
![Page 65: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/65.jpg)
Signal to Noise Ratio
• SNR ≥ 80 %
• Signal: CashFlow, CashFlowSequence, CashFlowEngine, FinancialProduct, BankHolidays, ReferenceData
• Noise: CashFlowBuilder, CompositeEngine, ProductFactory, BankHolidaysDecorator
![Page 66: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/66.jpg)
“All what you explained is nice, but what about
the actual code and
design?”
-client
![Page 67: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/67.jpg)
Code as reference[export the glossary]
• Annotate domain-relevant classes
• Custom Doclet to export Excel-formatted glossary of every domain concept
• Send directly to end customers as reference documentation
![Page 68: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/68.jpg)
High hygiene standards[in the bubble context]
• Dependencies– Legacy– Middleware– Frameworks– Database stuff
null + TDD, BDD+ Clean Code
![Page 69: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/69.jpg)
“Functional-First” style
![Page 70: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/70.jpg)
“Functional-First” style
• Value Objects (Quantity, Range…) as much as possible– Immutable
• Side-effect-free functions• Closure of operations
– CashFlow and CashFlowsSequence add(), negate(), multiply()
![Page 71: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/71.jpg)
Legacy: the bigger picture
Clarify bubble boundariesEmerging contexts
Shock absorberResponsibility layers
PHASE 4
![Page 72: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/72.jpg)
First boundaries
<<ValueObject
<<ValueObject
<<ValueObject>><<ValueObje
ct<<ValueObject>>
<<Service>><<SPI>>
<<Service>><<API>>
<<Entity>><<Aggregate>>
![Page 73: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/73.jpg)
boundaries 2.0
<<ValueObject
<<ValueObject
<<ValueObject>><<ValueObje
ct<<ValueObject>>
<<Service>><<SPI>><<Service>>
<<API>>
<<Entity>><<Aggregate>>
Look Ma: no entity in there!
![Page 74: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/74.jpg)
boundaries 2.0
<<ValueObject
<<ValueObject
X<<ValueObject>>
<<ValueObject
<<ValueObject>>
<<Service>><<SPI>><<Service>>
<<API>>
X<<Entity>>
<<Aggregate>>
As Value Object inside
As Entity outside
![Page 75: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/75.jpg)
Just a lib & side-effect free!
<<ValueObject
<<ValueObject
<<ValueObject>><<ValueObje
ct<<ValueObject>>
<<Service>><<SPI>><<Service>>
<<API>>
Values in Values out
![Page 76: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/76.jpg)
API
SPI
![Page 77: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/77.jpg)
ACL-backed Domain service
• Unify *many* legacy services through one single & simple interface
• Hide the most unfriendly legacy code
<<ACL>><<Facade>>
<<old stuff I don’t want to deal with>>
![Page 78: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/78.jpg)
Initial journey toward our dream model
Bespoke custom DREAM MODEL
![Page 79: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/79.jpg)
Dream model must pass every scenario
Bespoke custom DREAM MODEL
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 80: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/80.jpg)
Deliberately easier by construction
Bespoke custom library
![Page 81: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/81.jpg)
Con"icting aspects suggest several contexts
“I don’t need all these data to do that, I just need these 3 fields”
![Page 82: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/82.jpg)
Context Game[Greg Young]
“What's your ideal <instrument>?”• Pre-trade: very liquid with a narrow bid – offer
spread• Trading: unique identifier easy to key in• Risk: has risk on a single risk factor• Back-office: very few cash-flows that are
certain and known long beforehand
![Page 83: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/83.jpg)
Trading<<legacy>>
Risk<<legacy>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Hibernate ORM
Contexts that emerged
![Page 84: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/84.jpg)
Trading<<legacy>>
Risk<<legacy>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Hibernate ORM
Contexts that emerged
![Page 85: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/85.jpg)
Trading<<legacy>>
Risk<<strangler>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Hibernate ORM
Contexts that emerged
![Page 86: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/86.jpg)
Trading<<legacy>>
Risk<<strangler>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Hibernate ORM
Team /manager invoke DRY
“I don’t want to maintain more models, it’s already hard enough!”
![Page 87: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/87.jpg)
Trading<<legacy>>
Risk<<strangler>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Hibernate ORM
Team /manager invoke DRY
“I don’t want to maintain more models, it’s already hard enough!”
No it’s less maintenance!
![Page 88: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/88.jpg)
Trading<<legacy>>
Risk<<strangler>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Hibernate ORM
How do we integrate?
?
![Page 89: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/89.jpg)
Trading<<legacy>>
Risk<<strangler>>
Cash-flows<<strangler>>
CRUD<<legacy POJO>>
DB<<legacy>>
Non DDD (anemic),
already there
Hibernate ORM
Contexts Mappings
![Page 90: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/90.jpg)
ACL as Shock Absorbers
http://www.directindustry.com/prod/herwarth-reich/flexible-couplings-elastic-couplings-19991-374565.html
![Page 91: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/91.jpg)
ACL as Shock Absorbers
http://www.monition.com/images/shaft-alignment-training.jpg
![Page 92: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/92.jpg)
“That’s useless code!”
![Page 93: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/93.jpg)
No, ACL’s are good!
![Page 94: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/94.jpg)
“Ok so I will automate”
![Page 95: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/95.jpg)
No, hand-crafted code is good!
![Page 96: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/96.jpg)
Happy End
Project deliveredOn required scope
On timeClient satisfaction
CONCLUSION
![Page 97: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/97.jpg)
Some remarks
• “DDD + R&D potential”: my projects selection criteria
• DDD: subtle, often not quite *sure*
• Don’t preach, tell the benefits
![Page 98: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/98.jpg)
The future
• Keep on growing the model in the bubble context
• Reuse in another context (e.g. accounting)? - To what extent?
• The bubble may break at some point
![Page 99: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/99.jpg)
Questions?
You can also ask me later!
![Page 100: Domain-Driven Design in legacy application](https://reader034.fdocuments.net/reader034/viewer/2022050801/548459475906b5c6158b4767/html5/thumbnails/100.jpg)
Merci