Re: Massive stored proc data base operation to DDD

"GrĂ©gory Weinbach [email protected] [domaindrivendesign]" <[email protected]> Mon, 24 Nov 2014 09:00:09 +0100
Newsgroups gmane.comp.programming.domain-driven-design
Message-ID <CAFKVFtkWGCPnGC-_x-xM9k22CXP2Z77WdoGA4PwKOKvVcK2Xag@mail.gmail.com>
Hi Varghese,


If your behaviours cannot be defined as simple methods (or functions), I
think you should simply reconsider your model.
Remember : your domain model should be designed to enable the creation of
value (a.k.a. the implementation of methods or functions) of your
application. It is using domain vocabulary (ubuquitous language) but its
design and structure should be made to support the domain scenarios. In
other words, you are not building a realistic model of the world but rather
a model for a particular purpose (i.e. to support domain scenarios):
modelling is driven by those scenarios.


In your particular case, you want to create two clusters of products
("Vegetable Products" and "Non Vegetable Products") from an "Unclassified
Product Sets" (I think we have here three nice aggregate roots).
"Unclassified Product Sets" might have a method "classify" (probably the
entry point of your scenario) which takes a set of "Companies" (probably
Value Objects) as a "vegetable Vendors" input argument, and a tuple of
"Vegetable Products" and "Non Vegetable Products" as output argument.


It seems to me that this "classify" method can perfectly be implemented
(directly on the class or as an "Unclassified Product Set Repository"
method) in a stored proc and be perfectly OO (or FP if you prefer).
Moreover this is definitely not an anemic model at all !


The problem you face comes from the fact you expressed it with the right
words, but in the wrong Bounded Context.


Regards,


Greg Weinbach