What do we need to improve related to aggregates? 

To clarify the terms, I'm actually talking about composition (filled diamond
in uml), but I call it aggregate because that is the term used in DDD. See
our description here:
http://fornax.itemis.de/confluence/display/fornax/3.+Advanced+Tutorial+(CSC)#3.AdvancedTutorial%28CSC%29-Aggregate

Two important rules for aggregates:
- Only the root entity can be linked to from other entities and the
contained entities and values are only accessible through the root.
- Only the root entity can have a repository, i.e. it is not possible to
fetch and save contained objects separately

Right now we can do define aggregates with 'not aggregateRoot'

        Entity Planet {
            gap
            String name key;
            String message;
            - Set<@Moon> moons opposite planet;

            Repository PlanetRepository {
                findByKey;
                save;
                findAll;
            }
        }

        Entity Moon {
            not aggregateRoot // belongs to Planet Aggregate
            String name key;
            - @Planet planet opposite moons;
        }

The first thing we should remove is the limitation that this can only be
used for Entity. There is no reason why it shouldn't be possible to do the
same for ValueObject.

Maybe it would make it easier to understand/read by using something like
'belongsTo' like this:

        Entity Cargo {
            - TrackingId trackingId key
            - Location origin required
            - Location destination required
            - Itinerary itinerary nullable opposite cargo
            - Set<HandlingEvent> events opposite cargo

        }

        ValueObject Itinerary {
            belongsTo Cargo
            - Cargo cargo nullable opposite itinerary
            - List<Leg> legs
        }

        ValueObject Leg {
            belongsTo Cargo
            - CarrierMovement carrierMovement
            - Location from 
            - Location to
        }

belongsTo doesn't really add any more information to the model than 'not
aggregteRoot', but I think it would be good to introduce it anyway, as an
alternative syntax.

Do you think we need something else? 

For Google App Engine we added hint="owned" for references, but I think that
was wrong. Specifying ownership on the associations doesn't really make
sense, does it? 

/Patrik
-- 
View this message in context: 
http://old.nabble.com/-sculptor--Aggregates--tp28332528s17564p28332528.html
Sent from the Fornax-Platform mailing list archive at Nabble.com.


------------------------------------------------------------------------------
_______________________________________________
Fornax-developer mailing list
Fornax-developer@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fornax-developer

Reply via email to