Domain Model Pattern

What is it?

  • Using an OO way instead of procedural in transaction pattern

    • objects have state and behaviour

  • Build model of domain as objects

  • interconnected objects

  • Any validation or calculation related to an object is placed in the object

  • Delegates work to different objects

  • Use of polymorphism to handle different buisness rules

  • Use a template or strategy pattern to bring everything together

Advantages

  • Handles more complexity

  • Avoid more conditionals, and adding more objects (polymorphism)

Disadvantages

  • lots of indirection, hard to see flow of logic

  • complex data mapping

  • object bloat

  • Need to model domain in different layers

Last updated