Video: Design Heuristics - Mathias Verraes - KanDDDinsky 2018

July 1st, 2022



Model: Clue Bucket (aka toolbox)


Model: Patterns vs Principles vs Heuristics


Model: distill your heuristics


Model: competing heuristics


Heuristic: things that change together should stay together

  • named: Single Responsibility


Model: Method for deliberate design choices




no description for image available

Model: Domain Event


Exercise: Which attributes should be in this domain event?

  • who placed it

  • when was it placed

    • Heuristic: when did something happen, is that relevant?

    • Heuristic: what are all the timestamps that matter

      • when it happened

      • when we learned about it

      • when we recorded it

      • pre-dated

  • who cares about this? what do they need

  • what was ordered


heuristics for deciding what to put in there

  • always verify assumptions about time

    • consumer sees it immediately or later

    • data could change over time

    • what if a constraint / business rule / invariant is not met immediately but some time goes by

  • redundancy

    • minimal events

    • Model: Fat events

    • Heuristic: consumer might not listen to all events

    • Heuristic: immutable attributes we should probably add in there

      • mutable: name

      • immutable: customer_id

  • consumer

    • Heuristic: serve the consumers needs

    • Heuristic: ignore individual consumer's needs

    • Heuristic: 80-20 the consumers needs

    • DDD context mapping patterns

      • Pattern: internal to  our bounded context, easily changeable

      • Pattern: conformist: leak into my domain

      • Pattern: partnership: their success relies on our success

      • Pattern: open host service (eg. Google Maps)

    • how many consumers are there

      • 1

      • 5-10 consumers -> 80-20 rule?

  • Temporal Coupling

    • are the consumers gonna query us to get more data

    • Model: Notification vs Domain Event

    • temporal coupling:

      • "This system needs to be online at the time that the consumer wants to know what the order was like"

      • reduces our autonomy

      • if not online, I can't do anything

  • Heuristic: sensitive information

    • Datasparsamheid

    • GDPR compliance

    • sensitive information

  • Heuristic: how would it look in a paper world?

  • Heuristic: can we do multiple events for the same event, specific per consumer



Heuristic: if you can imagine it as a 3rd party system, then you can have it as a bounded context


Notifications - forces a lookup

Domain Events - completeness guarantee

Fat events - redundant information

  • safe, immutable, stable

  • evolve over time, mutable

  • sensitive information, supposed to throw away after a certain amount of time