Wednesday, May 2, 2012
DDD Examples
see main article http://www.udidahan.com/2008/02/15/from-crud-to-domain-driven-fluency/
More examples:
http://www.udidahan.com/2008/02/29/how-to-create-fully-encapsulated-domain-models/
http://msdn.microsoft.com/en-us/magazine/dd419654.aspx
By Jimmy Bogart: http://vimeo.com/43598193 He demonstrates how to transform an anemic domain model to a "wicked" domain model. One of the objectives of doing DDD he says is to protect the code from developer mistakes. The way to do so is to remove operations on properties of model objects from the calling to code to the object itself and make as much object state as necessary private (encapsulation). He also demonstrates how to refactor a switch statement down to the enum equivalent in .NET which is a pattern whereby an abstract class representing the enum (and having similar functionality) contains private classes that inherit from the outer abstract class. These private classes do/return whatever was in the case blocks. The abstract class exposes instances of these classes via separate public static getter methods with names that match enum names, and so the calling code gets polymorphic behavior based on what's returned.
Labels:
DDD
Subscribe to:
Post Comments (Atom)
Would you class these as domain methods or just service layer methods?
I think you’re right in terms of this takes a whole different mind set !
January 20th, 2010 at 2:23 pm Andrew,
I think that the issue is that the UI you’re supporting is exposing that kind of functionality to the user. DDD applies to UI design as well.
The code in the post is indeed the implementation of service layer methods.