xiaofan2406
xiaofan2406

Reputation: 3310

java class relations,Generalization Realization Association Aggregation Composition Dependency

here are some question after I have looked at wikipedia:

Association: "Association represents the static relationship shared among the objects of two classes.", does this mean aggregation and composition can be also describe as association?

Aggregation: "However, an aggregation may not involve more than two classes", what does it mean? say a class "has a" professor, and a class "has a" teach-assistant. a professor also "has a" teach-assisitant, isn't this also aggregation, and it involve more than two?

Dependency: as long as two classes are related, can be described as dependency? am I right?

Upvotes: 0

Views: 1833

Answers (1)

anirudh bhatnagar
anirudh bhatnagar

Reputation: 511

Association: "Association represents the static relationship shared among the objects of two classes.", does this mean aggregation and composition can be also describe as association?

-Yes, Aggregation is an Association which denotes an "is part of" relationship and Composition adds a lifetime responsibility to Aggregation.

Aggregation: "However, an aggregation may not involve more than two classes", what does it mean? say a class "has a" professor, and a class "has a" teach-assistant. a professor also "has a" teach-assisitant, isn't this also aggregation, and it involve more than two?

--aggregations are not allowed to be circular.In your case, class and professor have a relation, class and TA have a relation, and TA and prof has a relation.

Dependency: as long as two classes are related, can be described as dependency? am I right?

-yes.

Also,you may like to read this: http://www.martinfowler.com/bliki/AggregationAndComposition.html

Upvotes: 1

Related Questions