aspose file tools*
The moose likes OO, Patterns, UML and Refactoring and the fly likes Aggregation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » OO, Patterns, UML and Refactoring
Bookmark "Aggregation" Watch "Aggregation" New topic
Author

Aggregation

alfred jones
Ranch Hand

Joined: Apr 19, 2005
Posts: 279
Excerpt from wiki link http://en.wikipedia.org/wiki/Class_diagram



Aggregation:

Class diagram showing Aggregation between two classes ( figure above)

Aggregation is a variant of the "has a" or association relationship; aggregation is more specific than association. It is an association that represents a part-whole or part-of relationship. As a type of association, an aggregation can be named and have the same adornments that an association can. However, an aggregation may not involve more than two classes.

Aggregation can occur when a class is a collection or container of other classes, but where the contained classes do not have a strong life cycle dependency on the container—essentially, if the container is destroyed, its contents are not.
In UML, it is graphically represented as a hollow diamond shape on the containing class end of the tree of lines that connect contained class(es) to the containing class.


>>> part-whole or part-of relationship ? what does this mean ? I dont understand this part.

>>>if the container is destroyed, its contents are not.
I dont agree. Here if the Professor class is destroyed , then the content list-of-students(List) is also lost....I dont agree the above text.
Ran Pleasant
Ranch Hand

Joined: Jan 16, 2003
Posts: 75
Alfred

The diamond head of the aggregation symbol is clear. That means a Professor object will aggregate zero or more Class objects but that the Class objects can exist without the Professor. To indicate that the Class object cannot exit without the Professor object then the diamond head of the aggregation would need to be filled in, usually with black. The diagram you posted makes sense because a college class is often scheduled before a professor is assigned to teach the class.


Ran
alfred jones
Ranch Hand

Joined: Apr 19, 2005
Posts: 279
Ran Pleasant wrote:Alfred

The diamond head of the aggregation symbol is clear. That means a Professor object will aggregate zero or more Class objects but that the Class objects can exist without the Professor. To indicate that the Class object cannot exit without the Professor object then the diamond head of the aggregation would need to be filled in, usually with black. The diagram you posted makes sense because a college class is often scheduled before a professor is assigned to teach the class.


not clear. still have confusion. The confusions are at these places ..

>>>That means a Professor object will aggregate zero or more Class objects but that the Class objects can exist without the Professor.

"aggregate zero or more Class objects" ? I think you are saying this because as there is a symbol like 1..* right ? I think you are wrong. it should be called as "aggregate one zero or more Class objects" ...because note we have 1..* not 0..*

Please correct me if I miss something.

>>>That means a Professor object will aggregate zero or more Class objects

I see the Professor object has a field called listOfStudents . We don't know what list it contains . Do we ? We just know it holds a list and the name of the field is listOfStudents.

So,what list it contains? Does it hold a list of Class objects ? How do we know that ? or We are just unsure about that part ?


Mohamed Sanaulla
Saloon Keeper

Joined: Sep 08, 2007
Posts: 3071
    
  33

I think the diagram explaining Aggregation should be using listOfClasses instead of listOfStudents.

A neatly explained Aggregation diagram here.

Definition for Whole-part relationship.

Ran Pleasant wrote:To indicate that the Class object cannot exit without the Professor object then the diamond head of the aggregation would need to be filled in, usually with black.


This is called Composition and again similar to aggregation|association.


Mohamed Sanaulla | My Blog
alfred jones
Ranch Hand

Joined: Apr 19, 2005
Posts: 279
Mohamed Sanaulla wrote:I think the diagram explaining Aggregation should be using listOfClasses instead of listOfStudents.


me too.


A neatly explained Aggregation diagram here.



I have visited your link . you know the trouble with that link is it has mixed all the concepts in one example .But I'm just trying to learn individually first. And hence that link is quite hard for me at this moment. I did not like that link . Thanks for your time anyway.

Definition for Whole-part relationship.


not comfortable. what I understand is , Whole= entire thing and part = a small part of the Whole .... but what is Whole-part ?

this is bit confusing as to how we map these in the relationships .

Ran Pleasant wrote:To indicate that the Class object cannot exit without the Professor object then the diamond head of the aggregation would need to be filled in, usually with black.


This is called Composition and again similar to aggregation|association.


Excellent . thanks for the information.
Ran Pleasant
Ranch Hand

Joined: Jan 16, 2003
Posts: 75
Mohamed Sanaulla wrote:I think the diagram explaining Aggregation should be using listOfClasses instead of listOfStudents.

No, the diagram is very clear but it is not fully defined. The Professor class has two lists, a list of his students and a list of his classes. The study list is defined by including the variable name. The class list is defined by the aggregation relationship. To be more fully defined a variable name for the class list should have been put on top of the aggregation line near the end next to the Class class. However, I was to receive that diagram with instructions to implement it I would assume that the student list should also be implemented by an aggregation relationship and I would assume the varaible for the list of classes should have a variable name similar to the other variable name, thus I would have used "listOfClasses" as the name.

alfred jones wrote:I think you are wrong...

You are absolutely correct. The diagram does say the Professor class will aggregate "One or More" Class objects, not "Zero or More".

Ran
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Aggregation