Domain Driven Design (DDD)
We've moved New blog found here at http://blogs.chayachronicle... RSS is here at http://blogs.chayachronicle... Thanks to GWB for parking me here for a spell :) MIKE
I've been working exclusively alone on a project for a while and have as much liberty as any developer could hope for. I'm a blessed man. Nonetheless, I have tried to kind of "pretend" like I am working in a team environment that has regimented deadlines. This is mostly due to integrity and partly due to prevention for laziness...how easy is it to constantly be researching solutions without implementing them? There was a necessary period of growth in skill sets that had to occur and while I certainly...
One of the things that requires a realignment in thinking when moving away from RAD development tools as a means of solving business problems into a Domain Driven approach is where to put validation and how to provide meaningful messages back to the user when something goes wrong. It seems to me that a good indicator of an anemic strategy for validating data is lots of work being done with validation controls and checks at the presentation (view) level. That doesn't mean that careful validation and...
Sergio Bossa has a nifty proposition for handling Specification failures during the course of operations in the Domain layer and propogating those messages up the layers thru the Service layer at http://sbtourist.blogspot.c... The basic idea is to collect Specification errors into a collection within a Notification inside a custom exception. I had considered this, but was frankly trying to avoid throwing exceptions for these kinds of things. But since...
I have an Aggregate called Person that has a method called AddAddress which accepts an IAddress invariant to (hopefully) be added to the Person.Addresses collection. Within the method body of AddAddress, I am invoking a Command object that goes down a list of Specifications and if all are passed, then the address is added to the collection. So far so good. Now, i am calling this method from my Service layer and am expecting an IAddress object in return. If it fails, what is the best way of communicating...
For a while, I really sought to navigate my domain via bidirectional relationships among entities. Technically, there's nothing wrong with this, but my failure to design according to the Aggregate boundaries that Eric Evans talks about in his book Domain Driven Design led to unnecessary complication in maintaining the relationships AND an anemic domain. For example, if I consider an Employee in context of being an invariant of Enterprise and require all logic dealing with Employees to be navigated...
Let's say I have a class Person with your typical field/properties FirstName, LastName, blah, blah... Then let's say I decide to implement the Null Object Pattern. Why I decide this isn't important right now, but I know that I am just going to initialize all my fields to default setttings (string.Empty for FirstName,LastName, etc..) in the constructor. Like so: public class NullPerson : Person, INull { public NullPerson() : base(string.Empty,string.Em... { } } Now, notice I have...
Continuing with tightening my app using Domain Driven Design principles, I am trying to instantiate a NEW Person object. SETUP:This Person object has Email objects (whether Value or Entity is irrelevant). Now, the Person is my Aggregate so a PersonFactory class exists. Person has a method 'AddEmail(string text, string label, bool isPrimary)' . PROBLEM: I have a Service Layer (application layer) that is operating on my use case 'Add Person' and my view has created a PersonDTO that has a collection...