[TYPO3-50-general] FLOW3 Sample Blog Application Aggregate Roots Clarification

Duo Zheng duozheng at gmail.com
Tue Aug 18 20:43:12 CEST 2009


> But generally you should avoid calling one Repo from another, that's
> often a sign for unclear boundaries contexts and could lead to
> consistency leaks.


In the Blog application the Post Repository gets injected to Blog  
Repository. I didn't know if this was valid.


> An object being part of an AR in one case and the AR itself in another
> is pure valid and clean

Can you provide an example of this? I would like to clearly see a case  
when it is valid.

> An object being part of an AR in one case and the AR itself in another
> is pure valid and clean. It depends on your use cases which ARs you
> have. And that determines the context for each AR.

The sample application btw is from the FLOW3 dev repository. It exists  
for demo purposes, but when I reviewed the code I was confused as Blog  
and Post are both Aggregate Roots (Both having Repositories).  
Aggregate roots define a boundary so it was confusing to see a  
boundary inside a boundary?

If Blog is a Root then it should be responsible for Post. If Post is  
also a Root then it seems Blog has just delegated the responsibility  
to another Root disguised as only an Entity in that specific case? It  
does seem like unclear and undefined boundaries.

BTW just in case you wanted to see it, the Blog Application can be  
accessed by

"svn export https://svn.typo3.org/FLOW3/Distributions/Base/branches/BlogExample/ 
"

> The Blog aplication in fact is a very poor example for Domain  
> modelling,
> because it's almost only a CRUD app.

This may be a good point. Any chance you know of a well written DDD  
application? Link?

Thanks for the help everyone.

On Aug 18, 2009, at 4:44 AM, Nino Martincevic wrote:

> Hi Duo!
>
> Duo Zheng wrote:
>> In the Blog Application, Blog, and Post are Aggregate Roots as they
>> both have Repositories. I believe I am modeling this wrong, but is it
>> correct to have Post as an Aggregate Root when Blog already is?
>>
>> When a Blog is deleted all its entities are deleted with it. You  
>> can't
>> have a Post without a Blog so it "seems" correct for Blog to be the
>> only Aggregate Root and post to be part of that Aggregate.
>
> Don't think structural but conceptional, in use cases and business
> (domain logic) requirements.
>
> Btw: Why can't a post being moved to another blog or stay as it is?
> :-)
>
> But read further...
>
>> I guess to clearly ask the question and getting straight to the  
>> point,
>> can you have Post be an Aggregate Root by itself in one case and just
>> an Entity in another?
>
> Yes.
> As above, limiting objects to structural classes is not OOP but COP...
>
> An object being part of an AR in one case and the AR itself in another
> is pure valid and clean. It depends on your use cases which ARs you
> have. And that determines the context for each AR.
>
> But there is no general guidance, it depends on your domain.
> As said, most important is not to limit e.g. Post being just an entity
> (by say implementing IEntity).
>
> In your example it's not quite clear what the Blog AR does?
> The Blog is the whole application, isn't it?
>
> Without the application, Posts wouldn't have much sense, that's true.
>
> The Blog aplication in fact is a very poor example for Domain  
> modelling,
> because it's almost only a CRUD app.
>
> And DDD isn't suited very well for CRUD, in fact you should better  
> avoid
> it there. It complicates things, and all the necessary stuff you need
> for CRUD, your ORM already offers it.
>
> Hope that helps.
>
>
> _______________________________________________
> TYPO3-project-5_0-general mailing list
> TYPO3-project-5_0-general at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-project-5_0-general



More information about the TYPO3-project-5_0-general mailing list