Domain Modelling Paul Stovell
Architecture: Implicit or Explicit? Architecture exists implicitly But if you don’t define it, it probably sucks
Scope of this presentation UI Data Stores (Database, Web Service, etc.)
Domain Modelling Step 1: Understand the problem domain Step 2: Architect around it
Object-Oriented Design Encapsulation Polymorphism Inheritance Abstraction
Design Patterns Gang of Four Concepts Judgement As simple as possible, but no simpler
Object Oriented not Class Oriented
Domain Model What’s in a domain model? Stateful Objects Services Responsibilities: Maintaining their own state Responsibilities: Maintaining their own state Responsibilities: Doing stuff Responsibilities: Doing stuff
Entities : Stateful Objects Have a real-world identity
Value Objects : Stateful Objects Have no real-world identity Value objects with same values are interchangeable
Value Objects : Stateful Objects Value objects are subjective
Domain Services : Stateless Responsibilities: Doing stuff Generally stateless
Relationship Bias Most real-world relationships are one-way
Aggregates Recognise that some things don’t exist without others
Aggregates Timesheet TimesheetEntry Customer Aggregate Timesheet
Locking Timesheet TimesheetEntry Customer Coarse-Grained Lock
Aggregates Timesheet TimesheetEntry Customer Aggregate
Context and Boundaries “Object models don’t scale”
Contexts and Boundaries Sales Application Context Tech Support Application Context Boundary
Gateways Abstract the coordination of services and stateful objects Like your manager: they boss people around but don’t do any work themselves
Domain Models + SOA UI Service Agents Web Services Business Logic Database Service Messages UI Service Agents Web Services Business Logic Database Service Messages
Domain Models + SOA UI Service Agents Web Services Domain Services Database Domain Objects UI Service Agents Web Services Domain Services Database Domain Objects
Recap What’s in a domain model? – Stateful Objects Entities Value Objects – Services Simplified by: – Relationship Bias – Aggregates Scales thanks to: – Contexts and Boundaries – Gateways
I’m still awake! Where can I get more? Head first design patterns Eric & Elizabeth Freeman Domain Driven Design Eric Evans Patterns of Enterprise Application Architecture Martin Fowler
CHEERS! Paul Stovell July 5 th SDNUG (AMP Building) Binding Oriented Programming