The Shape of the Domain Model

This is a bit of a random thought which I had this morning regarding the relationship between the domain model and data.

An instance of the domain model (or parts of it) is a snapshot of the model at a given point in time.  Specifically, the state of the model is the snapshot.  The configuration of the pieces of data in the model is the shape of the domain model.

If the shape of the domain model corresponds closely to the database schema, changes in the domain model’s shape require data migrations in the database.

It’s not earth shattering, but thinking of the model in terms of shape is an interesting concept to me.  Thinking about the evolution of the model’s shape over the lifetime of the application is also a cool concept (ie..shape in relationship to time).

Related Articles:

Post Footer automatically generated by Add Post Footer Plugin for wordpress.

This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.

4 Responses to The Shape of the Domain Model

  1. Joe Ocampo says:

    Is your contrast that as the shape of the domain model changes so does the the shape of all supporting persistence mechanisms. Whether that be DB or file.

    Just asking for Clarity. :-)

  2. Evan says:

    @Joe,

    Yes, at least with the current version of NHibernate, that is true. The shape of the model and the shape of persistance are coupled.

    It’s more of a tooling limitation though. There’s nothing to say that the shape of the data can’t be transformed between loading from the database and restoring into the model (and transformed in reverse when saving a snapshot of the model).

  3. I feel this is one area of DDD in .net that needs more work. Much more so than other tools.

    I know exactly what you are talking about.

    Sometimes I find that you have a little wiggle room but not much. It is also difficult to not let nhibernate dictate your model because of the way specific models have to persisted according to nhibernate.

    Perhaps other ORM’s are different? I don’t have much experience with anything but Nhibernate with ORM’s in .net

  4. Colin Jack says:

    @Evan – Not sure what you mean by shape here, I tried following the link but I think its going to the wrong article.