Rickard Öberg wrote:
> Niklas Uhrberg wrote:
>   
>>  I think "QualifiedAssociation" is adequate, I have to taste it a bit 
>> more to see if I like it ...
>>
>> Generally, XXXAssociation sounds better to me than AssociationXXX . To 
>> me it says that it's a sort of association, not a part of, or something 
>> related to the association.
>> In both of the designs we're talking about, it's the association itself 
>> that we obtain from e.g. Person.
>> Terms on the from AssociationXXX indiactes (to me) that it's a property 
>> of the association, not the association itself.
>>     
>
> Well, I am just doing some research on terminology, and it seems as 
> though Association Role is actually what this is called. See here:
> http://www.jot.fm/issues/issue_2002_09/column2/
> and:
> http://en.wikipedia.org/wiki/Role_Class_Model
>
> However, the implementation would then logically be called Role and not 
> AssociationRole. Using it would then look like this:
> interface Movie
> {
>     ManyAssociation<Role<Person,Part>> actors();
> }
>
>
> Meaning, "actors" is a list of people who played various parts. 
> Role.role() would still be a convenience method to create the Role, so 
> using it would look like:
> tellingLiesInAmerica.actors().add(role(kevinBacon,billyMagic));
>
> Which is ok I think.
>   
Let examine the concepts here to see why this hits back:

We turn back to the example with Association<Person> spouse()

"spouse" is the name of the role and this in itself does not motivate an 
association class.
If however we would like to track start and end dates on this relation 
this calls for an association class holding this data.

We have two distinct modelling needs here, naming the role ("spouse") 
and associating data with it.

Now of course it's possible to move the name "spouse" to be contained by 
the association class, and this is what you do in

"ManyAssociation<Role<Person,Part>> actors()"

and one benefit is that you can now introduce roles without introducing 
new member variables.

So, back to the concern I had with the name AssociationRole. It's simply 
that this is inadequate in the case where there is no need to put the 
name of the role in the association class
wich only hold e.g. start and end dates.

Example:

Association<Person> mother;
Association<Person> father;

Here there is really no need to have the AssociationRole hold the name 
"mother" or "father".
This is indeed a very common way of modelling, but I also acknowledge 
that there is a benefit in the case of many multiple associations which 
should be named.

/Niklas

> /Rickard
>
> _______________________________________________
> qi4j-dev mailing list
> [email protected]
> http://lists.ops4j.org/mailman/listinfo/qi4j-dev
>
>   


_______________________________________________
qi4j-dev mailing list
[email protected]
http://lists.ops4j.org/mailman/listinfo/qi4j-dev

Reply via email to