KristianP wrote:
Otis wrote:
How could the designer for example be of help creating repositories etc. ? It is of course possible to generate repositories / aggregates with pre-fab methods produced by a template and the meta-data available in the llblgen pro project, but wouldn't that be unworkable? I mean: IMHO it's best if the developer writes the repositories him/herself so only the code that's necessary is in the repositories.
Sorry, I didn't mean for the designer to generate the actual repositories, but leave that up to the developer. How would you recommend for example, with an OrderRepository, whos aggregate root makes up Order-OrderDetails-Product, save for example only these three entities. With recursive saves now, they entire graph is saved, but when dealing with aggregate roots, we only want to save what is defined within that root. Would we need to pull out the entities manually and save each one seperately?
That's indeed a problem at the moment if you want to go that route. So if you want to have these kind of repositories, you need support from the designer, templates, runtime libs etc.
You of course don't want to do things manually if things can be automated, though I personally think it's a bit of a problem with the whole idea of repositories and aggregates. though it's not that hard to solve IF you realize that an entity can only be used once in all your repositories. So if you have an aggregate with order-orderdetails-product, it shouldn't be the case that product is referenced somewhere else as well, in another repository.
So in that case, it could be possible, in theory, to define aggregate roots in the designer (i.e.: you group order, order details and product), so the designer simply eliminates relations to entities outside that group. These relations then also don't end up in the code, and your repositories are working automatically OK.
Though it's a bold step for us to take, as we then make DDD a designer feature, and we then assume that people understand what DDD is and HOW to implement it
(perhaps we should ship Evans' book with the app
)