Hey,
I just finished learning about aggregation and composition in class diagrams the other day in class and I still don't fully understand what they mean or what they are used for. I was wondering if anyone here can give me a good explanation or what aggregation and composition is.
Thanks
2 replies to this topic
#1
Posted 04 October 2010 - 07:49 PM
|
|
|
#2
Posted 04 October 2010 - 10:22 PM
A car is composed of a bunch of items, a car lot aggregates cars.
#3
Posted 05 October 2010 - 06:26 AM
The way i've learned it, is:
Both are part-whole relations with a slight difference
Composition
Let's take an 'order' which consists of 'orderLines'. orderLines can't exist on their own, it's always part of an order. So if the order is gone, so are the lines.
You can't have the parts without having the whole.
Aggregation
Let's take a 'book' which consists of 'pages'. A page can exist on its own and doesn't need a book to "live".
The part can exist on its own, without needing the whole.
Both are part-whole relations with a slight difference
Composition
Let's take an 'order' which consists of 'orderLines'. orderLines can't exist on their own, it's always part of an order. So if the order is gone, so are the lines.
You can't have the parts without having the whole.
Aggregation
Let's take a 'book' which consists of 'pages'. A page can exist on its own and doesn't need a book to "live".
The part can exist on its own, without needing the whole.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









