Model: competing heuristics

July 3rd, 2022

Habit: look for your heuristics and competing heuristics


Heuristics competing against Favour Composition over Inheritance

  • Heuristic: Use inheritance when template pattern fits

  • Heuristic: Use inheritance when is-a

  • Heuristic: Use inheritance when behaves-like-a

  • Heuristic: Use inheritance when and only when there is inheritance in the domain


Heuristics competing about reality

  • Heuristic: Don't model reality, evaluate for usefulness...driven by the domain

  • Heuristic: immutable in reality => immutable in code

    • invoice - ready, signed off, sent out, does not change anymore

    • Heuristic: when your solution involves breaking&entering, find another solution


Heuristics to help find competing heuristics

  • Heuristic: Assume there are multiple possible models

    • core DDD heuristics


(src: Video: Design Heuristics - Mathias Verraes - KanDDDinsky 2018)