views:

101

answers:

2

Hi, i'm building a form managment system, thats is, the system will contain many forms, will save them, and perform logic on them, I want to do it using the DDD approach.

I want to support easy form layout later on using ASP.NET MVC, so far i see the domain like this:

I'll have a base form entity, which should(for now) have a name, fields(and theire values) and validation logic.

My questions are:

  1. How should i write the field valueobject using generics? i cant seem to figure it out..
  2. Should i encapsulate the validation logic inside the form or do it using the specification pattern?
+2  A: 

How should i write the field valueobject using generics? i cant seem to figure it out.

Too vague question. Specify your context a bit - what kind of value objects you are trying to define, why exactly you need generics etc.

Should i encapsulate the validation logic inside the form or do it using the specification pattern?

Validation logic goes where it has to go. Domain validation logic should be encapsulated in specs, but that's not mandatory. Main thing - you should be able to figure out and understand applied validation when looking at source code of domain object class definition.

Arnis L.
A: 

Apart from your vague descriptions, dealing with forms is a problem that is inherently not well suited to DDD. What kind of an object model can you build from a flat list of options?

Of course you will need validation logic that is specific to the form in use, but simple OO Design will get you far enough here, I don't see where DDD will buy you something.

As a side note, check out Document Databases, they might be better suited for your task than a sophisticated domain model stored in an ObjectDb or a relational database.

Johannes Rudolph