Association,Generalization
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   vasanthi_Kanna
Posted On:   Thursday, December 13, 2001 06:40 AM

Hi,

What is Assication,Aggregation,Generalization,composition and dependency.
I want one example on each of these.
Please can any one help me.

Re: Association,Generalization

Posted By:   Bozidar_Dangubic  
Posted On:   Thursday, December 13, 2001 10:22 AM


  1. e.g. association: class A has a path to class B either as an attribute or in a method call that return class B - class A has associtation with class B
  2. e.g. aggregation: stronger form of association. aggregation is usually associated with has-a relationship where one class has another class as its member variable
  3. e.g. generalization: generalization is superclass-subclass relationship, i.e. InputStream is a generalization of FilterInputStream which is a generalization of DataInputStream.
  4. e.g. composition: composition is the strongest form of association. one class not only has a has-a relationship with some other class as member variable but also containing class' lifecycle is completely dependent on the lifecycle of the container class. if class A has a composition relationship with class B, class B lives and dies with class A, i.e. destroying class A destroys class B. for instance, if you have a Company which has several Department, Department of a company is only valid within the company. If company goes bust, departments in the company no longer exist and therefore departments have composition relationship with the company.
  5. e.g. dependency: if there is a dependency between two class, change in one can affect the other. usually, one class uses another in the method signature of within some of its methods. if class A calls method meth() on class B, if class B changes and renames meth() to newMeth(), class A will fail to compile. therefore, there is a dependency which is model in the diagram.
About | Sitemap | Contact