Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Domain-Driven Design in legacy application

2 638 vues

Publié le

A software editor in finance was facing the challenge to extend substantially the capabilities of its main application, despite 20 years of legacy in multiple technologies. In this talk, Cyrille Martraire will report on how DDD has been applied to capture deep models of the domain, within bounded contexts that emerged in the course of the project, and how DDD also helped to build a strategy for dealing with the legacy code.

The video is available on Skillsmatter website: http://skillsmatter.com/podcast/design-architecture/applying-ddd-legacy-app

Publié dans : Technologie
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • DOWNLOAD THAT BOOKS INTO AVAILABLE FORMAT (2019 Update) ......................................................................................................................... ......................................................................................................................... Download Full PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download Full doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download PDF EBOOK here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download EPUB Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... Download doc Ebook here { http://bit.ly/2m6jJ5M } ......................................................................................................................... ......................................................................................................................... ................................................................................................................................... eBook is an electronic version of a traditional print book that can be read by using a personal computer or by using an eBook reader. (An eBook reader can be a software application for use on a computer such as Microsoft's free Reader application, or a book-sized computer that is used solely as a reading device such as Nuvomedia's Rocket eBook.) Users can purchase an eBook on diskette or CD, but the most popular method of getting an eBook is to purchase a downloadable file of the eBook (or other reading material) from a Web site (such as Barnes and Noble) to be read from the user's computer or reading device. Generally, an eBook can be downloaded in five minutes or less ......................................................................................................................... .............. Browse by Genre Available eBooks .............................................................................................................................. Art, Biography, Business, Chick Lit, Children's, Christian, Classics, Comics, Contemporary, Cookbooks, Manga, Memoir, Music, Mystery, Non Fiction, Paranormal, Philosophy, Poetry, Psychology, Religion, Romance, Science, Science Fiction, Self Help, Suspense, Spirituality, Sports, Thriller, Travel, Young Adult, Crime, Ebooks, Fantasy, Fiction, Graphic Novels, Historical Fiction, History, Horror, Humor And Comedy, ......................................................................................................................... ......................................................................................................................... .....BEST SELLER FOR EBOOK RECOMMEND............................................................. ......................................................................................................................... Blowout: Corrupted Democracy, Rogue State Russia, and the Richest, Most Destructive Industry on Earth,-- The Ride of a Lifetime: Lessons Learned from 15 Years as CEO of the Walt Disney Company,-- Call Sign Chaos: Learning to Lead,-- StrengthsFinder 2.0,-- Stillness Is the Key,-- She Said: Breaking the Sexual Harassment Story That Helped Ignite a Movement,-- Atomic Habits: An Easy & Proven Way to Build Good Habits & Break Bad Ones,-- Everything Is Figureoutable,-- What It Takes: Lessons in the Pursuit of Excellence,-- Rich Dad Poor Dad: What the Rich Teach Their Kids About Money That the Poor and Middle Class Do Not!,-- The Total Money Makeover: Classic Edition: A Proven Plan for Financial Fitness,-- Shut Up and Listen!: Hard Business Truths that Will Help You Succeed, ......................................................................................................................... .........................................................................................................................
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Domain-Driven Design in legacy application

  1. 1. Legacy application Large ambitions A case study: how DDD helped deliver at Sungard Asset ArenaCyrille Martraire - @cyriux -
  2. 2. http://cutefunnyanimal.blogspot.in/2012/01/funny-tired-dogs-photos-images-2012.html
  3. 3. LEGACY
  4. 4. Passionatedeveloper PARIS Since 1999 @cyriux
  5. 5. Paris SoftwareCraftsmanship Community http://www.meetup.com/paris-software-craftsmanship/
  6. 6. ArollaArolla.fr
  7. 7. A Case Study
  8. 8. From a recent project (contract) Every example is made-up to protect the innocent IP.
  9. 9. Once upon a time…
  10. 10. Large Ambition
  11. 11. Asset Management
  12. 12. Buy, Partner or Make?
  13. 13. Buy, Partner or Make?
  14. 14. Project Life +QA +Dev Dev++ +BA PH AS E12010 2011 PH 2012 PH AS AS E E PH 4 2 AS E 3
  15. 15. “You’ve got the right skills We trust you. Deliver”
  16. 16. So how do we do that?
  17. 17. ?
  18. 18. PH AS E 1 Spike! 3-weeksDeliberate Discovery in mind
  19. 19. Codeanalysis [Greg Young]Within 3 weeks 1. Conversations with experts 2. Code the understanding & note questions 3. Iteratehttp://skillsmatter.com/podcast/design-architecture/mystery-ddd/js-4401
  20. 20. Find the Domain Experts
  21. 21. The official expert(former Asset Manager)
  22. 22. Proxy Domain Experts
  23. 23. Proxy Domain Experts
  24. 24. Haz Context? “Trade” = ? Sell-Side (Hedging) Broker (A Vs. B) Buy-Side (investment) + fees!Accounting Accounting(tax, Basel etc) (tax, accuracy, boring stuff)
  25. 25. Fossilized Domain Expertisehttp://newspaper.li/fossil/
  26. 26. Conversations first • Ask *good* questions • Build respect and confidence • Beware and care about synonyms and main conceptshttp://journalism.about.com/od/reporting/tp/Finding-And-Developing-Ideas-For-News-Stories-
  27. 27. Sketching
  28. 28. Sketching
  29. 29. Sketching
  30. 30. Growing our Ubiquitous Language Collecting scenarios An instrument is effective for a period of time (its life), that is the date range between the effective date and the expiry date A credit leg observes credit events from some identified instrument and triggers either a physical settlement or to a cash settlement. A swap is made of legs, each of them being an independent Typical credit events are bankruptcy, failure to pay, restructuring other counterparty Cash instrument on its own. Each leg defines two counterparties A payoff is a cash flow given by one counterparty to the Instruments generate cash flows during their life, in Forward 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 particular at expiry date (redemption, zero coupon) and at transaction, typically to buy/sell the underlying instrument at a regular dates Flow There may be a date offset for settlements, fixings and cash flows payments 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 payoffsBank Floating rate devices generate cash flows according to Option styles are typically European (exercise only at expiry date), American (exercise anytime), Bermuda (exercise at regular dates), observation expressions based on some observable Canary (exercise at regular dates after some date or period) reference An underlying instrument is an instrument used to condition the Fixed rate devices generate cash flows according to a exercise (which may be automatic) and often used to calculate the predefined coupon amount of the payoff or more that is directly the object of an Inflation-linked devices modulate the coupon, coupon rate exchange, in the case of an exchange of assets or notional amount by the variation of some (inflation) Some instruments are subject to conversion, i.e. they can be observable reference replaced with another instrument Interest rateHoliday Regular 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 calendar Some instruments involve one, two or no exchange(s) of principal (s) Compounding swaps capitalize interests earned for each period payment period Date adjustment rules are defined by a day roll convention and a business center A funding leg is a fixed rate device or a floating rate device A return leg is a leg that reproduces the exact cash flows of another instrument
  31. 31. Taking notes, in codeClass, interface names & documentationFieldsRelationships (if any)+ Behavior!
  32. 32. Code doesn’t lieGot something wrong? Forgot something? It shows!
  33. 33. Found a metaphorhttp://www.marksmart.net/gearhack/pogomoog/pogomoog.html
  34. 34. Found a metaphor Modular SynthesizerMartin Russ - http://eetimes.com/design/audio-design/4238388
  35. 35. FoundJava code In a metaphor Output of a class/ function is the input of another
  36. 36. So let’s keep on coding and rebuilding everything! Sounds like a great idea!
  37. 37. http://skillsmatter.com/podcast/design-architecture/talk-from-eric-evans
  38. 38. Plenty of Legacy code working since 1993 Redoing = waste + risk
  39. 39. Still need to redo some parts How do we integrate with legacy? Where do we stop redoing?
  40. 40. PH AS E 2 Legacy strategy Know your enemiesAsset Capture & Strangler Application Bubble Context & ACL Scream it loud
  41. 41. Know your enemies [discover the app] Read the documents Interview people Use the application Read the code Fix bugs
  42. 42. Visualize [primary flow & support features]http://www.fimarkets.com/pagesen/back-middle-front-office.php
  43. 43. Visualize [primary flow & support features]http://www.fimarkets.com/pagesen/back-middle-front-office.php
  44. 44. Visualize [primary flow & support features]http://www.fimarkets.com/pagesen/back-middle-front-office.php
  45. 45. Asset Inventoryhttp://staff.bath.ac.uk/enssa/LPDev.htm
  46. 46. Asset Capture Transmission Exhaust Enginehttp://martinfowler.com/bliki/AssetCapture.html
  47. 47. Asset Capture Transmission Exhaust Engine Focus on one single asset : the enginehttp://martinfowler.com/bliki/AssetCapture.html
  48. 48. Strangler application A new module will progressively strangle the former one, for one single asset onlyhttp://martinfowler.com/bliki/StranglerApplication.htmlhttp://www.flickr.com/photos/louisfoecy/4114597043
  49. 49. Conservative by default • Keep existing architecture – N-tiers, application server, middleware – Same database – Same UI technology – (Almost) all the legacy codeDiagrams shamelessly stolen from Eric Evans DDDx 2011 talk
  50. 50. Bubble Context• Create a little bubble of innovation• Brand new model• As clean as we like• Highly tested• High hygiene standards
  51. 51. Bubble Context• ACL to protect from the legacy code• Translates legacy objects & services into new, cleaner ones
  52. 52. Strangler (cont.)• Progressively turn off legacy functionalities & turn on the new ones
  53. 53. Agree on maxims[communicate the plan] • “Only one work site at a time: instruments” • “When in Rome, do as Romans do”
  54. 54. PH AS E 3Scaling development in the bubble context Infect the team Code as SPOT High hygiene standards Functional-style
  55. 55. I only care about Java EE 6
  56. 56. Hey!Financeis cool!
  57. 57. Oh, this domain isreally cool!
  58. 58. Oh, thisI’d like to domain is know it really cool! better!
  59. 59. Invest in domain knowledge • Bi-weekly 30mn training sessions
  60. 60. Signal to Noise ratiohttp://www.flickr.com/photos/28471130@N07/2666802097
  61. 61. Signal to Noise Ratio• SNR ≥ 80 %• Signal: CashFlow, CashFlowSequence, CashFlowEngine, FinancialProduct, BankHolidays, ReferenceData• Noise: CashFlowBuilder, CompositeEngine, ProductFactory, BankHolidaysDecorator
  62. 62. “All what you explainedis nice, but what about the actual code and design?” -client
  63. 63. 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
  64. 64. High hygiene standards [in the bubble context]• Dependencies – Legacy – Middleware – Frameworks – Database stuff null + TDD, BDD + Clean Code
  65. 65. “Functional-First” style
  66. 66. “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()
  67. 67. PH AS E 4Legacy: the bigger picture Clarify bubble boundaries Emerging contexts Shock absorber Responsibility layers
  68. 68. First boundaries <<ValueObject>> <<ValueObje <<ValueObject>> <<ValueObje ct <<ValueObje ct ct <<Entity>> <<Aggregate>> <<Service>> <<Service>> <<API>> <<SPI>>
  69. 69. boundaries 2.0 <<ValueObject>> <<ValueObje <<ValueObject>> <<ValueObje ct <<ValueObje ct ct Look Ma: <<Service>> <<Service>> <<SPI>> no entity <<API>> in there! <<Entity>> <<Aggregate>>
  70. 70. boundaries 2.0 <<ValueObject>> <<ValueObje X <<ValueObje <<ValueObject>> ct <<ValueObje ct ctAs Value Object <<Service>> inside <<Service>> <<SPI>> <<API>>As Entity outside X <<Entity>> <<Aggregate>>
  71. 71. Just a lib & side-effect free! <<ValueObject>> <<ValueObje <<ValueObject>> <<ValueObje ct <<ValueObje ct ct <<Service>> <<Service>> <<SPI>> <<API>>Values in Values out
  72. 72. APISPI
  73. 73. ACL-backed Domain service• Unify *many* legacy <<ACL>> services through one <<Facade>> single & simple interface• Hide the most unfriendly legacy code <<old stuff I don’t want to deal with>>
  74. 74. Initial journey toward our dream model Bespoke custom DREAM MODEL
  75. 75. Dream model must pass every scenarioGiven 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 periodWhen the EURIBOR 3M evolves: | 2011/09/15 | 3.5% | | 2012/03/15 | 4.0% |Then the cash-flows are: Bespoke custom | 2011/12/13 | 23000 | DREAM MODEL | 2012/06/14 | 25500 |
  76. 76. Deliberately easier by construction Bespoke custom library
  77. 77. Conflicting aspectssuggest several contexts“I don’t need all these datato do that, I just need these3 fields”
  78. 78. Context Game [Greg Young] “Whats 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
  79. 79. Contexts that emerged Risk <<legacy>> Trading <<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>> Hibernate ORM DB <<legacy>>
  80. 80. Contexts that emerged Risk <<legacy>> Trading <<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>> Hibernate ORM DB <<legacy>>
  81. 81. Contexts that emerged Risk <<strangler>> Trading <<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>> Hibernate ORM DB <<legacy>>
  82. 82. Team /manager invoke DRY Risk <<strangler>> Trading <<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>>“I don’t want to maintainmore models, it’s already Hibernate ORMhard enough!” DB <<legacy>>
  83. 83. Team /manager invoke DRY Risk <<strangler>> Trading <<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>>“I don’t want to maintain No it’s lessmore models, it’s already Hibernate ORM maintenance!hard enough!” DB <<legacy>>
  84. 84. How do we integrate? Risk <<strangler>>Trading ? <<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>> Hibernate ORM DB <<legacy>>
  85. 85. Contexts Mappings Risk <<strangler>>Trading<<legacy>> Cash-flows <<strangler>> CRUD <<legacy POJO>> Hibernate ORM Non DDD (anemic), already there DB <<legacy>>
  86. 86. ACL as Shock Absorbershttp://www.directindustry.com/prod/herwarth-reich/flexible-couplings-elastic-couplings-19991-374565.html
  87. 87. ACL as Shock Absorbershttp://www.monition.com/images/shaft-alignment-training.jpg
  88. 88. “That’s useless code!”
  89. 89. No, ACL’s are good!
  90. 90. “Ok so I will automate”
  91. 91. No, hand-crafted code is good!
  92. 92. CO NC LU SI ONHappy End Project deliveredOn required scope On timeClient satisfaction
  93. 93. Some remarks• “DDD + R&D potential”: my projects selection criteria• DDD: subtle, often not quite *sure*• Don’t preach, tell the benefits
  94. 94. 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
  95. 95. Questions?You can also ask me later!
  96. 96. Merci

×