Feb 10 2008

DDD and NHibernate

Tag: DDD,NHibernate,ORMSymon Rottem @ 12:35 am

I was trawling around the net today and stumbled over a series of posts (some of which are now quite old) by Ben Scheirman about developing applications using DDD with NHibernate. I don’t recall having seen this series when I was starting to get my head around both of these concepts and they would have been invaluable at the time so I thought it would be worth re-posting the links to the posts for posterity’s sake and for those developers out there who are just getting started.

The series was (after having the name refactored a couple of times) called A Journey with Domain Driven Design (and NHibernate). In the series Ben manages manages to cover a few design patterns, some TDD concepts and examples, separation of concerns, configuring NHibernate, writing mapping files and pulling it all together.

Following are the links to the articles and a quick overview of what each part covers:

  • Part 1 – Describes the reasoning behind his approach and the project structure used in the series.
  • Part 2 – Covers the application and its requirements and begins designing the domain model.
  • Part 3 – Demonstrates writing basic unit tests for the domain model.
  • Part 4 – Demonstrates more sophisticated tests that include interactions between domain entities.
  • Part 5 – Database design strategies, configuring NHibernate and starts unit testing the persistence assembly .
  • Part 6 – NHibernate class and component mappings and some tests to check they’re working as expected.
  • Part 7 – NHibernate collection and association mapping.
  • Part 8 – Some refactoring, the introduction to use of the Repository pattern and use of the Template Method design pattern.
  • Part 9 – Wrapping up the feature list and a link to download the latest version of the code.

The series is excellent and recommended reading if you are trying to get off the ground with DDD and NHibernate.