DDD and DataSets

I'm just back in my office again after having given my course, "Patterns with .NET". I love giving this course, and it was just as much fun as usual (if not more) this time. One thing I particularly like is that I always get so many interesting ideas from the participants.

For instance, this time two participants, Ellen Lippe and Atle Haugan from Trondheim in Norway, asked me if they could reuse any of the DDD concepts I had been talking about when they use DataSets. I honestly hadn't thought about it in this way before, since I have mostly seen DDD as a way of structuring a Domain Model [Fowler PoEAA]. After a while they helped me to understand that in some cases combining DDD and DataSets might be a good compromise. For instance, a DDD Aggregate could be structured as a Table Module [Fowler PoEAA] wrapping a DataSet. The repositories could deal with the lifecycle of these aggregates too, and so on.

I think we agreed that it is a bit unnatural in some situations, but life is full of compromises, and, depending upon the situation, this might a very good one!