3

I'm trying to understand DDD and one of the key concepts in DDD are the Domain Objects. As i understand they're supposed to 'hide' the internal state and allow modification of it by only by using methods (behaviors?) and only in a way that keeps the (internal) state always valid.

Would it be an over simplification to say that (at least from technical point of view) Domain Objects are nothing more than Finite State Machines with business logic inside, strict validation and names meaningful for the business?

  • 1
    In a calculator app, Parser would be a Domain Object, but it cannot possibly be an FSM, because even very simple arithmetic expressions with +, -, *, /, and grouping already cannot be parsed by an FSM, you'd need at least a pushdown-automaton for that. There is nothing that restricts a DO to sub-Turing computation. – Jörg W Mittag Jan 20 '18 at 13:44
  • A Finite State Machine is just one way to implement a class's inner functionality. Nothing prevents you from using other techniques besides state machines, and there's nothing particularly unique about domain objects that would restrict their logic to FSM's. – Robert Harvey Jan 20 '18 at 19:16
3

Would it be an over simplification to say that (at least from technical point of view) Domain Objects are nothing more than Finite State Machines with business logic inside, strict validation and names meaningful for the business?

Somewhat; we have some document that is in "this" state, and then some new information arrives from the outside world, and as a consequence the document transitions to "that" state.

But that pattern isn't particularly unique to DDD.

What Evans added was a clean separation between the domain logic and the plumbing; the state machine is captured by the domain model, which is separate from the plumbing provided by the application.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.