Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Domain-Driven Transformation

Domain-Driven Transformation

Henning Schwentner

June 09, 2023
Tweet

More Decks by Henning Schwentner

Other Decks in Programming

Transcript

  1. salesperson [person] Monolease [software system] Central car leasing tool customer

    [external person] risk manager [person] closes leasing contracts with creates and calculates contracts in assesses risk of contracts in Alphorn Auto Leasing Inc. [enterprise] Context
  2. @hschwentner big ball of mud anemic domain model bad team

    organization Typical Diseases of Legacy Systems
  3. @hschwentner big ball of mud anemic domain model bad team

    organization Cures strategic transformation tactical transformation socio-technical transformation
  4. @hschwentner Domain-Driven Refactorings • Strategic • Socio-Technical • Tactical (Against

    Model Anemia) • Tactical (Against Big Ball of Mud) Catalog: https://hschwentner.io/domain-driven-refactorings
  5. @hschwentner Strategic Transformation 1. Step: Domain re-discovery 2. Step: Modeling

    the to-be 3. Step: Aligning as-is with to-be 4. Step: Do the move RISK MANAGE- MENT SALES
  6. “There is only one basic way of dealing with complexity:

    divide and conquer.” Bjarne Stroustrup
  7. old old old old new new new new “just flip

    the lever” 1 2 3 4 5 a.k.a. big bang replacement
  8. customer tells wish for 1 salesperson signs to gives for

    contract 3 risk manager contract passes on to 4 contract votes checks calculates 5 6 7 calculates to 8 2 car credit rating installment car resale value contract
  9. customer tells wish for 1 salesperson signs to gives for

    contract 3 risk manager contract passes on to 4 contract votes checks calculates 5 6 7 calculates to 8 2 car credit rating installment car resale value contract sales risk assessment
  10. salesperson [person] Monolease [software system] Central car leasing tool customer

    [external person] risk manager [person] closes leasing contracts with creates and calculates contracts in assesses risk of contracts in Alphorn Auto Leasing Inc. [enterprise] Context again
  11. salesperson [person] backend [container: EJB 2] risk manager [person] creates

    and calculates contracts in assesses risk of contracts in Monolease [software system] frontend [container: servlets, JSPs] database [container: IBM DB2] Containers
  12. Calculator [component] frontend [container] LeasingServlet [component: servlet] CONTRACTS [database table]

    PartnerServlet [component: servlet] ContractService [component] PartnerService [component] backend [container] database [container] Contract [component] Partner [component] PARTNERS [database table] Components
  13. Calculator [component] frontend [container] LeasingServlet [component: servlet] CONTRACTS [database table]

    PartnerServlet [component: servlet] ContractService [component] PartnerService [component] backend [container] database [container] Contract [component] Partner [component] PARTNERS [database table] Components
  14. ContractService signContract() voteContract() Code Contract getContractNumber() setSignatureDate() setCreditRating() setVotingResult() Sales

    Risk Assessment ContractService signContract() voteContract() Contract getContractNumber() setSignatureDate() setCreditRating() setVotingResult()
  15. ContractService signContract() Code Contract getContractNumber() setSignatureDate() Sales Risk Assessment ContractService

    voteContract() Contract getContractNumber() setCreditRating() setVotingResult()
  16. @hschwentner 1.2 Extract Specialized “Contract Service” 1.1 Extract Specialized “Contract”

    1 Extract Context “Sales” Transformation Backlog 2 Extract Context “Risk assessment” 2.1 Extract Specialized “Contract Service” 2.1 Extract Specialized “Contract”
  17. @hschwentner Tactical DDRs (to Support Strategic) • Extract Specialized Entity

    • Extract Specialized Anemic Entity • Extract Specialized Service • Extract Specialized Data Model
  18. @hschwentner Extract Bounded Context Mechanics • Analyze the domain to

    find out which bounded contexts should be there. • Identify a carve-out candidate context • Create an empty package/namespace/module for the to-be carved out context besides the big ball of mud. • Apply the Tactical (to Support Strategic) refactorings that are right for your situation.
  19. @hschwentner Extract Specialized Anemic Entity Mechanics • Create empty new

    class in carved-out context • Add instance field of type new class to the old class • Copy to-be-moved fields from old to new class => Move Field • Copy first to-be-moved method to new class => Move Method • Replace method body in old class with a forward to method in new class • Step by step replace calls to the method in the old class with calls to the method in the new class • Delete the implementation in the old class • Delete now unused fields in old class • Repeat with other to-be-moved methods • Remove instance field of type new class in the old class
  20. @hschwentner Transformation Backlog Planning Transformation Tactical Refactoring 1.2 Strategic Refactoring

    1 User Story A Product Backlog User Story E User Story B User Story C User Story D Tactical Refactoring 1.3 Tactical Refactoring 1.4 Tactical Refactoring 2.1 Strategic Refactoring 2 Sprint Backlog
  21. @hschwentner Transformation Backlog Planning Transformation Tactical Refactoring 1.2 Strategic Refactoring

    1 User Story A Product Backlog User Story E User Story B User Story C User Story D Tactical Refactoring 1.3 Tactical Refactoring 1.4 Tactical Refactoring 2.1 Strategic Refactoring 2 Sprint Backlog
  22. @hschwentner Transformation Backlog Planning Transformation Strategic Refactoring 1 Product Backlog

    User Story E User Story C User Story D Tactical Refactoring 1.4 Tactical Refactoring 2.1 Strategic Refactoring 2 Sprint Backlog
  23. @hschwentner Transformation Backlog Planning Transformation Strategic Refactoring 1 Product Backlog

    User Story E User Story C User Story D Tactical Refactoring 1.4 Tactical Refactoring 2.1 Strategic Refactoring 2 Sprint Backlog User Story F User Story G
  24. @hschwentner Transformation Backlog Planning Transformation Product Backlog User Story E

    Tactical Refactoring 2.1 Strategic Refactoring 2 Sprint Backlog User Story F User Story G
  25. @hschwentner Transformation Backlog Planning Transformation Product Backlog User Story E

    Tactical Refactoring 2.1 Strategic Refactoring 2 Sprint Backlog User Story G User Story H User Story F User Story I
  26. ContractService signContract() voteContract() Code Contract getContractNumber() setSignatureDate() setCreditRating() setVotingResult() Risk

    Assessment ContractService Contract Monolease voteContract() getContractNumber() setCreditRating() setVotingResult()
  27. ContractService signContract() Code Contract getContractNumber() setSignatureDate() Risk Assessment ContractService Contract

    Monolease voteContract() getContractNumber() setCreditRating() setVotingResult()
  28. @hschwentner Domain Categories Pipeline Domain Blackboard Domain Dialog Domain •

    Logistics • Insurances and banks • administration • healthcare • event management • control center • Software development • Communication software • Negotiations in various domains or Domain Patterns?
  29. Bibliography Foote, Brian and Joseph Yoder. “Big Ball of Mud.”

    PLoP ’97, Monticello, IL, September 1997. Fowler, Martin. “Strangler Fig Application.” Bliki, June 29, 2004. Hofer, Stefan and Henning Schwentner. Domain Storytelling: a Collaborative, Visual, and Agile Way to Develop Domain-Driven Software. Boston: Addison- Wesley, 2022. Lilienthal, Carola and Henning Schwentner. Domain-Driven Transformation. Heidelberg: dpunkt, 2023. Kernighan, Brian W. Software Tools in Pascal. Addison-Wesley, 1981.
  30. (Software) Seam: A place where you can alter behavior in

    your program without editing in that place Every Seam has an enabling point, a place where you can make the decision to use one behavior or the other