Applying Domain-Driven Design and Patterns With Examples in C# and .NET

I had a chance this weekend to start reading Jimmy Nilsson‘s new book, called Applying Domain-Driven Design and Patterns With Examples in C# and .NET.  Currently I have read through Chapter 8.


Jimmy is touching on a lot of subjects in the book, which is no easy task. The main focus of the book is on the value of a domain model and the implementation of the domain layer using Domain-Driven Design. However, he is also touching on topics which are the subjects of many books, topics like: Test-Driven Development, Refactoring, OOP, and Design Patterns.


You don’t have to know or care about Test Driven Development or Refactoring to appreciate the book, but a good understanding of design patterns and OOP would be rather valuable.  There are a lot of design patterns and object-oriented principles mentioned in the book.



Jimmy refers to Martin Fowler‘s Patterns of Enterprise Application Architecture ( POEAA ) quite a bit, so it would certainly be useful ( but not required ) to have on hand.


In Part I the book jumps around a lot to introduce a number of topics mentioned above and set the stage for the approach used in the book. Even Jimmy mentions this “jumping around” as well. There are a lot of little notes and tangents, but not enough to be distracting. This is almost unavoidable as this is a complicated subject and I can “sense” Jimmy wants to make sure he leaves nobody behind. Hence, a quick note or tangent to better clarify or define a subject is taken to help those who perhaps need it, but doesn’t distract those who are already familiar with the concept.  Many of these notes and tangents are on various OOP and Design Patterns as well as topics that are very subjective and contextual in value.


In part II, Jimmy takes a domain model example and begins to build the domain layer using TDD. Jimmy’s style here is to discover the domain layer as if building one for the first time. You are essentially a fly on the wall of his brain, listening to his thoughts as he tries to cope with the building of the domain objects and when to introduce the infrastructure pieces of the domain layer ( factories and repositories ) using TDD. During this time he is also trying to 1) wrestle with how to avoid persistence, 2) discuss a number of design patterns in play, and 3) approach/handle the number of solutions and their tradeoffs that occur in every application.


My only concern this far ( Chapter 8 ) is that persistence has been reduced to “x.PersistAll()”. This is great in that we shouldn’t be distracted by it, but bad in that we know it is a dark cloud that hovers above our heads. Jimmy has also introduced this concept of a Workspace ( IWorkspace ) that is injected into the Repository and is a database abstraction layer that handles the unit of work ( transactions ), but we haven’t seen much of it. To be fair, however, Chapter 9 is entitled “Putting NHibernate into Action”, so I suspect and hope Jimmy will be letting us in on the necessary persistence portion of Domain-Driven Design :)


Thus far I give the book two thumbs up. In my opinion it is a must have companion to Domain-Driven Design by Eric Evans, because it offers up the missing ingredient – how to implement the domain model using C# and .NET. In my humble opinion it is also an easier read, as I remember being overwhelmed by Domain-Driven Design by Eric Evans when I first read it. Jimmy’s book has a real-world, pragmatic feel to it that doesn’t claim to be the end all answer and a solution without tradeoffs. He is providing us another tool in our toolbox, and I look forward to the rest of the book.


Some interesting community resources that may be of value as you work through the book:



 

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

5 Responses to Applying Domain-Driven Design and Patterns With Examples in C# and .NET

  1. karl says:

    David, thanks for pointing this out. I’ll pick it up asap. I think we need a lot more resources / demos / starter kits that focus on domain modelling and ORM (manual or automated). There’s so little material out there, 1/2 the stuff I write I wonder if I’m doing it right…Having another point of view in print with good explanations is going to be a plus.

  2. Greg Young says:

    Very good book … I think it went a long way towards bridging alot of the implementational gaps between PofEAA and DDD. It has been said by many that you can’t learn things like DDD from a book, Jimmy does a great job making the read more like you have someone sitting with you explaining things.

  3. Geoff Stockham says:

    Two thumbs up from me as well. I’m up to Chapter 8 as well, and am finding it a very good read (as opposed to “Domain Driven Design” which is definitely a book to be studied, not read!). So far I’ve had quite a few “a-ha!” moments where a number of the concepts from other books have been nicely linked together to form a whole, rather than seeing them all as individual patterns in isolation.

  4. Liang says:

    No doubt, it is a very good book. There hasn’t any book in the .NET world touching those topics. As you said, this book has covered a lot of topics. It is positive, but is negative in the meanwhile. They are not deep enough to help readers getting there. For the beginners, this book maybe too much for them, but for the advanced readers, obviously it is not enough. And most of the materials have already been scatterred in the Internet. If googling, we should be able to find more. If we carefully read Jeremy’s blog, we probably will get more useful and practical information. But don’t get me wrong, it is great one. Highly recommend!

  5. JBarbatos says:

    Cool, it has been in my amazon wishlist because of pre order. I think I will finally pull the trigger.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>