views:

153

answers:

3

Is anyone using the techniques from Domain Driven Design? I've recently read the Eric Evans book of the same name (well, most of it!) and would be interested to hear from anyone who's implemented all/some of it in a project (particularly in C#/C++)

I've kept this question open ended as I'd like to see as many comments as possible, but I have a few questions in particular:

1 - Should value types be real 'value types' if the language supports it? e.g. a struct in C#

2- Is there any feature in C# that makes clearer the association between the language and the model (for instance, this is an entity, this is an aggregate etc.)

+2  A: 

1: depends. Value types in C# are for atomic pimitives (int, byte etc.). If you have something like that - it makes sense. If your value type is larger, no.

2: No. In general this is not a language feature.

I suggest as next read: Scott Ambler's "Building Object Applications That Work".

TomTom
+1  A: 
Cylon Cat
+1  A: 

Yes! I use DDD in my projects (but I'm biased!)

Remember that Domain Driven Design provides guidelines, not strict answers. It's only after experimenting that you'll understand which aspects work for your specific project.

Onto your questions:

1 - You could use structs - but there may be technical constraints that prevent you using them. For example, you may have entities that references thousands of value objects that happen to have the same values. In this case, it might be better to use a flyweight object to keep memory usage down.

2 - I would suggest using interfaces (e.g. IEntity, IValueObject, IAggregateRoot, ISpecification). Generics and LINQ can help assist in the technical concerns, but are less helpful from a design perspective.

I've created a free .NET library specifically focused on DDD, which might find ideas/inspiration from. Read more about it here.

I'm genuinely interested though: Which aspects of DDD do you think will benefit you? The "Domain Driven" aspects, or the implementation aspects?

Vijay Patel