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

On Being Explicit

On Being Explicit

DDD London
November 9 2016

On Being Explicit

“Make the implicit explicit” must be one of the most valuable advices I ever got about software modelling and design. Gather around for some tales from the trenches: stories from software projects where identifying a missing concept, and bringing it front and centre, turned the model inside out. Our tools: metaphors, pedantry, type systems, the age old heuristic of “Follow the money”, visual models, and a healthy obsession with language.

Mathias Verraes
@mathiasverraes
http://verraes.net

Mathias Verraes advises companies on building software for complex environments. This involves primarily analysis and modelling, but also code, architecture, testing, and refactoring “unmaintainable” systems. He has worked with clients in Finance, Automotive, Government, Logistics, E-Commerce, and more. He teaches Domain-Driven Design courses and co-organises the DDD Europe conference. When he’s not working, he’s at home in Kortrijk, Belgium, helping his two sons build crazy Lego train tracks.

Mathias Verraes

November 10, 2016
Tweet

More Decks by Mathias Verraes

Other Decks in Technology

Transcript

  1. Make the implicit explicit What are we really doing? What

    missing concepts can we identify? How can we bring them forward?
  2. Support multiple currencies 8 decimal precision for calculations Use currency's

    official division in UIs and APIs Compliance reporting in select markets Convert to € for internal reporting
  3. * You may not want to use floats. "Patterns of

    Enterprise Application Architecture", Martin Fowler, 2002
  4. a = new Money(1.123456789, eur) // The constructor rounds it

    to 1.12345679 b = a.round() // rounds it to 1.12 and // instantiates a new Money // The constructor rounds it to 1.12000000 c = a.add(b) // icky
  5. PreciseMoney { round() : RoundedMoney { return new RoundedMoney(amount, currency)

    } ... } RoundedMoney { add(RoundedMoney other) : RoundedMoney {...} multiply(Float operand) : PreciseMoney {...} ... }
  6. RoundedMoney { ... switch(currency) case EUR: this.amount = round(amount, 2)

    case USD: this.amount = round(amount, 2) case BTC: this.amount = round(amount, 8) ...
  7. Example: Data Matching Paying out money based on usage of

    content Determine ownership by matching data from various sources
  8. Data sources: Own research by employees Off shore data cleaning

    Public wiki-style Public but curated Private, paid Direct submissions from individuals Agencies representing owners
  9. Is this our Core Domain? ✗ It's just technical data

    imports ✗ Business is not interested ⬜ ⬜ ⬜
  10. Is this our Core Domain? ✗ It's just technical data

    imports ✗ Business is not interested ✔ Money changing hands ⬜ ⬜
  11. Is this our Core Domain? ✗ It's just technical data

    imports ✗ Business is not interested ✔ Money changing hands ✔ The code you keep secret ⬜
  12. Is this our Core Domain? ✗ It's just technical data

    imports ✗ Business is not interested ✔ Money changing hands ✔ The code you keep secret ✔ Oldest code in the system
  13. A Trust Arithmetic Invented by the business 0 <-> 5

    <-> 10 Group (closure, associativity, identity, invertibility)
  14. Price per minute, price after the 60th minute Bundles: Credit

    minutes, lower rates Subscriptions: recurring bundles Promotions and incentives End of month transfers, expiries Flexible rating strategies in different markets
  15. «Habitable software (...) enables people to understand its construction and

    intentions and to change it comfortably and confidently.»3 Programmers are not the only ones inhabiting our systems 3 "Patterns of Software", Richard P. Gabriel, 1996
  16. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers changes breaks requests
  17. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers CEO Senior Manager Middle Manager reports to changes breaks requests
  18. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers CEO Senior Manager Middle Manager reports to changes breaks requests
  19. «Any organization that designs a system will produce a design

    whose structure is a copy of the organization's communication structure.»5 5 "How Do Committees Invent?", Melvin E. Conway, 1968
  20. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers CEO Senior Manager Middle Manager revenue costs
  21. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers CEO Senior Manager Middle Manager revenue costs
  22. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers CEO Senior Manager Middle Manager Blub Algorithms revenue costs
  23. Blub Management System Germanic countries Benelux +10 more regions UK

    & Ireland France Customers Customers Customers Customers Customers CEO Senior Manager Middle Manager Blub Algorithms