I finished reading Applying Domain-Driven Design and Patterns With Examples in C# and .NET by Jimmy Nilsson.
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.
- Design Patterns like Data Mapper, Identity Field, Identity Map, Lazy Load, Query Object, Repository, Unit of Work, etc.
- Object-Oriented Principles like Dependency-Inversion Principle and Single-Responsibility Principle.
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.
Chapter 9 offers you a glimpse of how to use NHibernate as a persistence framework for you domain model. This subject could fill an entire book, so if you are expecting a treatise on how to achieve the details of persistence using NHibernate you will be disappointed. The chapter is good, however, giving one some manner of detail as to how an O/R Mapper ( NHibernate in this case ) offers persistence to the domain layer and the various design patterns ( Identity Map, Unit of Work, Lazy Load, etc.) that come into play. Never do we get any detail about the Nilsson Workspace, which has been alluded to several times in the book, but I don't think it really matters.
Starting with Chapter 10 you get the pleasure of guest writers talking about 1) various design techniques to embrace when using Domain-Driven Design as well as 2) other domain models other than what Jimmy discusses. Let me just say that this is great stuff and I commend the guest writers. You've got some really good introductions on:
- SOA
- IoC and Dependency Injection
- AOP
- MVC Pattern
- TDD of a Web Form
- A Presentation Model
In the appendices, Mats Helander, Frans Bouma, and Ingemar Lundberg offer additional examples of Domain Models that really get you thinking about other approaches to domain model discovery and implementations at the end of the book. More great examples and discussions that give a whole new meaning to the word "Appendices." :)
Conclusion
The book is quite excellent as it offers much more needed detail than we got from Domain-Driven Design by Eric Evans as well as puts a number of design patterns in a bit more perspective in the given context. I considered this book an excellent buy as it is difficult to find books that talk about such a breadth of topics and bring them together in a very pragmatic manner.
Just a quick note that if you're looking for an end-to-end executable sample showing off Domain-Driven Design in action you will be a bit disappointed as the book doesn't go that far. You've got enough to build upon by reading the book, but it doesn't come on a silver platter.
That being said, I think the market is ripe for a person(s) to author a book that expands upon Jimmy's ideas. A book that implements and discusses the following design techniques mentioned above into an actual executable application using open source tools like NHibernate, Spring.NET, NMock, NUnit, etc., would be the icing on the cake and a sure winner.