DDD Step By Step
A Practical Guide to Domain Driven Design

Browse by Tags

  • Is Excessive Mapping Of DTOs/ViewObjects to Entities A Code Smell by Michael Nichols

    A recent paradigm shift I have been trying to make is to using messaging patterns in my project. One impact of this shift has been a more granular approach to various commands against the domain which somehow changes its state. While I do my best to stick to DDD (Domain Driven Design) modeling patterns and concepts I confess I slide into a CRUD based approach to various actions in the system - lots of data in, lots of data out. This is partly due to the nature of the requirements and partly due to lack of creative thinking regarding what business rules should be enforced on the domain. As I started to examine where my weak points were in my application I realized I was doing an awful lot of mapping between view objects and domain entities within the Application Service layer which was being called by my Controllers in the web app. This is fine for simple cases but collections of value objects or cross-aggregate references can soon result in too much conditional or procedural code. Then I came across this post by Udi Dahan about getting away from CRUD mentality into a more DDD approach. I had read this before but I didn't "get" it so much. Particularly revealing to me was in the comments where Udi explains a method which...
    Filed under: ,
  • DDD-Lite: Mama don't let your objects grow up to be invalid (take two) by John Nuechterlein

    So, in a previous post , I was making a point about preventing classes from being invalid by getting rid of setters (public setters at least). But, I did it in a way that was misleading, or at least could be. For one thing, I used the term ‘entities’ in the title of the post. Why was this bad? Well, within DDD, there is a distinction that is often made between objects that can be called “entities” and those that can be called '”value objects.” And the purposefully simplistic example that I used (that of an Address class) is normally considered to be a value object and so the title of the post seemed to be inaccurate. Moreover, it made it seem as if the general point really only applied to value objects, when in fact, it has as much, if not more, to do with entities. What is the distinction between an entity and a value object? Read the book . Thanks for coming, good night! No, no, that won’t do. Though there are different ways of laying out the distinction, one way of making it is to say that a value object can be defined in terms of the collection of its attributes, while an entity is something that has an identity over and above its attributes. The basic idea seems simple enough: if two Addresses have the same street address...
  • DDD-Lite: Mama don't let your entities grow up to be invalid by John Nuechterlein

    Update: Troy pointed out that using Address as an example wasn't good, because in DDD, Address is considered what is called a 'value object' which has different features than what are called 'entities.' Since the point I was trying to make was about validation and why eliminating setters is an important concept, that wasn't totally relevant, but it's a valid objection (pun intended) as it could be misleading. So, I'm going to update the example. In a minute or two. Just keep that in mind till then. One of the hardest things about ‘continuous improvement’ (which I think really amounts to ‘not sucking more at the end of the day’, but I digress….seriously, some steps one might take to become a better developer are steps backwards, which I think the ‘craftsmen’-type people don’t discuss enough…but I digress) is trying to keep up with all of the possible information out there, from blogs, whitepapers, and other things. I estimate the number of posts I get in my various readers are dozens a day. Even filtering out the fluff, there is a lot of great stuff out there. On top of that, I subscribe to a number of mailing lists, which just increases the number of things to read on a daily basis if I want to keep...