According to the answer here and this article there.
table 1
Life-cycle | Composition (Relation A) | Aggregation (Relation B) |
---|---|---|
Whole(Parent) | independent of part (eg. building) | independent of part (eg. room) |
Part(Child) | depends on whole (eg. apartments) | independent of whole (eg. chair) |
---- | ---- | ---- |
Example | A building has apartments, if the building gets destroyed then the apartments will cease to exist, but if you destroy the apartments in the building then the building will remain. | A room has a chair in it, if you break the chair the room will still exist, and if you take the chair out and destroy the room the chair will still exist. |
1- Is it right? and if it is? what if:-
table 2
Life-cycle | Relation X | Relation Y |
---|---|---|
Whole(Parent) | depends on part (eg. apartment building) | depends on part (eg. editDataActivity ) |
Part(Child) | depends on whole (eg. apartments) | independent of whole (eg. Data ) |
---- | ---- | ---- |
Example | An apartment building has apartments, if the apartment building gets destroyed then the apartments will cease to exist, and if you destroy the apartments in the apartment building then the apartment building will be destroyed because it no longer matches its definition. | editDataActivity has Data , editDataActivity can't exist without Data to be edit, so whole depend on part, but Data can exist without editDataActivity , so part independent of whole. |
2- What is the Relation Y and X?
I can guess the Relation X, because in "Object-Oriented-Design Course Notes" on Coursera, it said:
Composition is one of the most dependent of the decomposition relationships. This relationship is an exclusive containment of parts, otherwise known as a strong “has-a” relationship. In other words, a whole cannot exist without its parts, and if the whole is destroyed, then the parts are destroyed too. In this relationship, you can typically only access the parts through its whole. Contained parts are exclusive to the whole. An example of a composition relationship is between a house and a room. A house is made up of multiple rooms, but if you remove the house, the room no longer exists.
Then from the first italic bold sentence, we can say that whole depends on part and from the second italic bold sentence, we can say that part depends on whole, and that's exactly the Relation X.
3- Is it right or there is a wrong with that definition?