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
Slide 12
Slide 12 text
Testable != idiot-proof2
2 Typical idiots include future self
Slide 13
Slide 13 text
* You may not want to use floats.
"Patterns of Enterprise Application Architecture", Martin Fowler, 2002
Slide 14
Slide 14 text
Constructor enforces decimals.
Operations protect against wrong currencies.
Slide 15
Slide 15 text
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
RoundedMoney {
...
switch(currency)
case EUR: this.amount = round(amount, 2)
case USD: this.amount = round(amount, 2)
case BTC: this.amount = round(amount, 8)
...
Slide 19
Slide 19 text
Mixing currencies & precisions
becomes impossible
Slide 20
Slide 20 text
Also see:
Time zone type safety
Slide 21
Slide 21 text
Example:
Data Matching
Paying out money based on
usage of content
Determine ownership by
matching data from various
sources
Slide 22
Slide 22 text
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
Slide 23
Slide 23 text
Lots of incentives for fraud
Slide 24
Slide 24 text
Is this our Core Domain?
✗ It's just technical data imports
⬜
⬜
⬜
⬜
Slide 25
Slide 25 text
Is this our Core Domain?
✗ It's just technical data imports
✗ Business is not interested
⬜
⬜
⬜
Slide 26
Slide 26 text
Is this our Core Domain?
✗ It's just technical data imports
✗ Business is not interested
✔ Money changing hands
⬜
⬜
Slide 27
Slide 27 text
Is this our Core Domain?
✗ It's just technical data imports
✗ Business is not interested
✔ Money changing hands
✔ The code you keep secret
⬜
Slide 28
Slide 28 text
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
Slide 29
Slide 29 text
Event Storming
Slide 30
Slide 30 text
Temporality
The quality of data
changes over time,
based on who changes it
Slide 31
Slide 31 text
Missing concept:
Matching Data
=>
?
Slide 32
Slide 32 text
Missing concept:
Matching Data
=>
Earning Trust
Slide 33
Slide 33 text
What if Trust was a tangible thing
in our domain model?
Slide 34
Slide 34 text
Trust as a Value Object
Slide 35
Slide 35 text
Trust can be passed around
Slide 36
Slide 36 text
Trust attracts behaviour
Slide 37
Slide 37 text
"Trust" adopted into Ubiquitous
Language
Slide 38
Slide 38 text
The business started getting
interested and involved
Slide 39
Slide 39 text
Polymorphic strategies for changing Trust
Event-based workflows
Slide 40
Slide 40 text
0 <-> 5 <-> 10
Slide 41
Slide 41 text
A Trust Arithmetic
Invented by the business
0 <-> 5 <-> 10
Group
(closure, associativity, identity, invertibility)
Slide 42
Slide 42 text
Metaphors as objects
Slide 43
Slide 43 text
«His people are completely literal.
Metaphors go over his head.»
Slide 44
Slide 44 text
«Nothing goes over my head.
My reflexes are too fast,
I would catch it.»
Slide 45
Slide 45 text
Example:
Phone call bill rating
Slide 46
Slide 46 text
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
Slide 47
Slide 47 text
"It's just an algorithm"
Slide 48
Slide 48 text
Missing Metaphor:
Buckets
Slide 49
Slide 49 text
No content
Slide 50
Slide 50 text
No content
Slide 51
Slide 51 text
Mental Model
~
Visual Model
~
Implementation Model
Slide 52
Slide 52 text
New opportunity:
Long lead time to change pricing
=>
Lively experimentation with pricing
Slide 53
Slide 53 text
«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
Slide 54
Slide 54 text
Example:
Bulb Management
System
Context Mapping
Slide 55
Slide 55 text
Blub
Management
System
Slide 56
Slide 56 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
Slide 57
Slide 57 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
changes
Slide 58
Slide 58 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
changes
breaks
Slide 59
Slide 59 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
Customers Customers Customers
Customers Customers
changes
breaks
requests
Slide 60
Slide 60 text
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
Slide 61
Slide 61 text
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
Slide 62
Slide 62 text
«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
Slide 63
Slide 63 text
Heuristic:
Follow the Money
Slide 64
Slide 64 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
Customers Customers Customers
Customers Customers
CEO
Senior
Manager
Middle
Manager
revenue
costs
Slide 65
Slide 65 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
Customers Customers Customers
Customers Customers
CEO
Senior
Manager
Middle
Manager
revenue
costs
Slide 66
Slide 66 text
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
Slide 67
Slide 67 text
Blub
Management
System
Germanic
countries
Benelux
+10 more
regions
UK &
Ireland
France
Customers Customers Customers
Customers Customers
CEO
Senior
Manager
Middle
Manager
Blub
Algorithms
Slide 68
Slide 68 text
Observations on
better software design
Slide 69
Slide 69 text
Obsess over language
Slide 70
Slide 70 text
Visualise different models
structural
temporal
spatial
organisational
Slide 71
Slide 71 text
Grasp the underlying problem
domain
Slide 72
Slide 72 text
Use metaphor
Slide 73
Slide 73 text
Follow the money
Slide 74
Slide 74 text
Make unspoken concepts explicit
Slide 75
Slide 75 text
Thank you —
@mathiasverraes
verraes.net
dddeurope.com
bit.ly/bddx-november