Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency

These terms signify the relationships between classes. These are the building blocks of object oriented programming and very basic stuff. But still for some, these terms look like Latin and Greek. Just wanted to refresh these terms and explain in simpler terms.


Association is a relationship between two objects. In other words, association defines the multiplicity between objects. You may be aware of one-to-one, one-to-many, many-to-one, many-to-many all these words define an association between objects. Aggregation is a special form of association. Composition is a special form of aggregation.

Example: A Student and a Faculty are having an association.


Aggregation is a special case of association. A directional association between objects. When an object ‘has-a’ another object, then you have got an aggregation between them. Direction between them specified which object contains the other object. Aggregation is also called a “Has-a” relationship.


Composition is a special case of aggregation. In a more specific manner, a restricted aggregation is called composition. When an object contains the other object, if the contained object cannot exist without the existence of container object, then it is called composition.

Example: A class contains students. A student cannot exist without a class. There exists composition between class and students.

Difference between aggregation and composition

Composition is more restrictive. When there is a composition between two objects, the composed object cannot exist without the other object. This restriction is not there in aggregation. Though one object can contain the other object, there is no condition that the composed object must exist. The existence of the composed object is entirely optional. In both aggregation and composition, direction is must. The direction specifies, which object contains the other object.

Example: A Library contains students and books. Relationship between library and student is aggregation. Relationship between library and book is composition. A student can exist without a library and therefore it is aggregation. A book cannot exist without a library and therefore its a composition. For easy understanding I am picking this example. Don’t go deeper into example and justify relationships!

Ads by Google


Abstraction is specifying the framework and hiding the implementation level information. Concreteness will be built on top of the abstraction. It gives you a blueprint to follow to while implementing the details. Abstraction reduces the complexity by hiding low level details.

Example: A wire frame model of a car.


Generalization uses a “is-a” relationship from a specialization to the generalization class. Common structure and behaviour are used from the specializtion to the generalized class. At a very broader level you can understand this as inheritance. Why I take the term inheritance is, you can relate this term very well. Generalization is also called a “Is-a” relationship.

Example: Consider there exists a class named Person. A student is a person. A faculty is a person. Therefore here the relationship between student and person, similarly faculty and person is generalization.


Realization is a relationship between the blueprint class and the object containing its respective implementation level details. This object is said to realize the blueprint class. In other words, you can understand this as the relationship between the interface and the implementing class.

Example: A particular model of a car ‘GTB Fiorano’ that implements the blueprint of a car realizes the abstraction.


Change in structure or behaviour of a class affects the other related class, then there is a dependency between those two classes. It need not be the same vice-versa. When one class contains the other class it this happens.

Example: Relationship between shape and circle is dependency.

This oops tutorial was added on 26/06/2010.



507 Responses to “Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency”

  1. Rajesh says:

    Thank you..
    Looking forward for your next post…

    • Anonymous says:

      i dont have any programing background thats way i very confused about concept of oop so plz tell me what i have to do

      • Ashutosh says:

        You may either go through the various topics that Joe has so wonderfully explained in different sections.
        A repetitive study will definitely help you with pin-pointed facts.
        Or alternatively, for a more systematic/sequential approach, you could also read a prescribed SCJP book such as Kathy Sierra/Bert Bates. Or any recommended author for that matter. I find Kathy’s way of teaching much more effective though.

      • Anonymous says:

        just refer concepts and do examples u can get it.

  2. himanshu says:

    very nice content to start


  3. Gift vincy says:

    Now these basic can be easily differentiated, after read this post

  4. fixxer says:

    Very helpful. Thanks.

  5. ashok says:

    Nice article. Explanation the concepts clearly.Thank you

  6. Gajanan says:

    Good article. Thanks.

  7. Ravindra Sareddy says:

    Very nice and easy to understand in a simple definitions.

  8. Anonymous says:

    It will be still good iy you give examples with code also.

  9. Joe says:

    Thank you all. I will try to update the post with sufficient java source code examples soon.

  10. Anonymous says:

    thanks for posting.please update Java with ibatis configuration it is helpful to us
    thanks in advance

  11. Jyotilal says:

    An example for aggregation is missing and it could be like:

    A car has a stereo system.A car can exist without a stereo system. There exists aggregation between car and stereo.

  12. Joe says:

    Thanks Jyotilal for the aggregation example. Actually its otherway around.

    A car has a stereo system. A stereo system can exist without a car. There exists aggregation between car and stereo.

    Don’t go too technical into electronics and say a car stereo needs a car. Just for an example!

  13. Prashant S Shivashimpi says:

    Really very good and straight forward description about the Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency. Thank you so much..

    Its very handy too..


  14. Harish Dewangan says:

    Superb Example.

    Keep Posting Joe

  15. Lingaraj says:

    Thanks! Very nice explanation.

  16. Dhananjay..........aec says:

    Thanks for helping……………

  17. Muthukumar says:

    Good explain…

  18. swathi says:

    Hi ,

    thnaks for that information.

    but i think i havnet understand that last.(Dependency)
    does it comes with arrow or just —- lines. pls post me

  19. kohtaik says:

    Great Post! It clear my mind.

  20. Rakesh says:

    Really Good article. Nice work.

  21. Anonymous says:

    nice… its in a generalized way….very helpful

  22. Mutayyab Shah says:

    Sir. i m n trouble..if u post full code .which contain aggregation and compostion.then it will be very clear to all of us.according to programing point of view.
    and realy good work u have done.we appriciate ur work…
    plz post full code waiting 4 ur reply

  23. kaushiki says:

    very nice article… it clearly explains the basic concepts… thanx!

  24. Amit Shekhar says:

    Thanks Joe for the wonderful post. It is really quite useful.Most of the times we tend to get confused with these terms as all sound the same. Few more additions would make it better:
    a) Class diagrams
    b) Code for Aggregation and Composition

  25. Salman Khan says:

    Thank You Very Much… It Was Very Helpfull…

  26. Casper says:

    Thank you for addressing all relevant items.. little bit more code would be marvelous. still great. CDW

  27. Narayan says:

    Good explaination mate

  28. Chetan Jadhav says:

    Terse explanation of Association, Aggregation and Composition..!!! :) Thanks a lot… :)

    Looking forward for your next posts…

  29. RenuNaidu..... says:

    i searched most of the definitions for these association,aggregation and composition…u cleared my doubt …u people are explaining like baby feeding thank you……

  30. Abhijit Boruah says:

    jst superb…think u r bst faculty for starters..i bliv in it…”with strong foundationz u can aim for the sky.”

  31. kamatchi sundaram says:


    The definition given in this site is very clean and neat and simple and very understandable instead of blah..blah…

    Cheers !!!

  32. Vijay Agalcha says:

    thank you very much for sharing your knowledge. very useful content. I learnt the concept very well to be applied in OOAD.

  33. Sanjay Upadhyay says:

    I was always get confused for these relationship but as you defined these relationship it became easy to understand. Thanks buddy :)

  34. Kareem Afifiy says:

    Thanks for these information. Great definition for aggregation n composition

  35. Prabhat says:

    Very nice page.
    It contains all required information about association, aggregation, composition.
    thanks a lot.

  36. viji says:

    Nice.. Thank You..

  37. Radhika says:


    good article.

    Thank you.

  38. abhishek says:

    thanks for info.this is nice with example.this is really helpful for student as well as employee.

  39. priya says:

    very clear and crisp.

  40. lize says:

    it’s so clear so far what I see!
    thank you!

  41. Supriya V says:

    Easy to understand.Nice Post.

  42. Balaji says:

    Very nice….

  43. pavan srivastava says:

    Thanks ,
    your definition is very clear

  44. sachin gupta says:

    please describe me multiple inheritance,candidate key, in oops.

  45. Shylaja says:

    Please let me know how to depict association, aggregation and composition in java code.

    Shylaja V.

  46. manisha says:

    thanks this artical is very easy to understand

  47. ashri says:

    please give some examples of programs as illustration for class relation……
    it will be useful.
    and thanks very much for this nice post.

  48. Manjunath says:


    Its sweet & simple !! You made task very simple and anyone can understand.

    Great Work!!!!

  49. kondalarao says:

    it is simple and very easy to understand
    thank you,

  50. sambha says:

    simple and understanble…
    Thanks a lot

  51. sadish says:

    Great Work !!!
    Keep going on !!!

    All the best !!

  52. Su says:

    Very nice article. I am facing a unique situation where we have modeled a test case with two compositions between the same two entities. Is this realistic? If so, can you give me a real world example for this?

  53. ray says:

    thank you for you very clear work joe.

  54. KARTHIKEYAN A says:

    Wow., Awesome work., Thankz,
    Keep up the Good work.,

  55. Rajasekhar says:

    thanks much. very useful information

  56. ankana says:

    thankz sir , very nice content

  57. ayushi garg says:

    thanks sir,

    this content is very helpful and outstanding

  58. raziya mev says:

    thanks for give simple & informational content

  59. pranjal soni says:

    thanks 4 this outstanding content

  60. mast laga maja aagaya…………

  61. Sharron says:

    Excellent! Thanks so much.

  62. nandhini says:

    its very useful for my net i need more info about ooad

  63. Anonymous says:

    Nice article. Keep going.

  64. BLV says:

    very nice

  65. [...] pattern can be implemented in two ways. One using the inheritance method and second using the composition method. Just the implementation methodology is different but the purpose and solution is [...]

  66. Avinash says:

    very Nice article……
    but need some coded exemples……

    BTW thank you very much.

  67. shoban says:

    very nice understanding…thanks

  68. girish says:

    Excellent, keep it up. Can you explain some of the fewdesign patterns in better understandable way.

    Thanks a lot buddy.


  69. Varma says:

    could you please provide some code samples for association, aggregation and other all oops concepts.


  70. [...] 我们首先创建一个接口,它为将用于装饰器的类创建蓝图。然后仅仅实现该接口的基本功能。到目前为止我们得到了一个将带有装饰器的蓝图类。 创建一个包含(聚合关系)该接口类型的一个属性。该类的构造方法将该类型接口的实例赋值给该属性。 该类为装饰器的基类。现在你可以扩展该类,然后创建你所需的具体的装饰器类。具体的装饰器类将添加它自己的方法。在之前或之后执行它自己的方法,然后具体的装饰器类将调用基实例的方法。 装饰器模式的关键是将方法和基类实例绑定是在运行时将基类的实例传入到构造方法中。因此可以动态的定制特定实例的行为而不影响其他的实例。 [...]

  71. Girish Varma says:

    multiplicity is no given here :) pls add


  72. Atif Mehar says:

    Its a great post. Thanks Man!

  73. simanchala says:

    Please give me a simple explanation with example on difference between abstraction and encapsulation.

  74. Dinesh says:

    Very nice post…

  75. maya butt says:

    very nice approach i realy like this complete definition pakage with examples

  76. Anonymous says:

    Really nice explanation . Simple and easy to understand
    I liked the formate of your blog….the best i seen till now

  77. Pawan says:


    K eep
    I t
    S imple
    S illy

    Completely Followed

    Nice Simple Sober & Easily Grab-able & Understandable

  78. jagdish says:

    nice, short, simple and good explanatory.

  79. K Vishnu says:

    Nice one

  80. NiteshKumar says:

    Sir……this is the best notes of Association I ever seen…….thanks a lot for the simple ans besr definations…

  81. Narendra says:

    Simply Superb

  82. Gunvant phalak says:

    very nice

  83. Parmod says:

    Very easily explained and easy to understand all the definition. Keep it up

  84. Shahbaz Ali says:

    too much informative

  85. niranjan says:

    simply super….very useful Thanks for posting..

  86. Baravil Barivare says:

    This article is very helpful and well explained. Thanks

  87. pravinth says:

    Good Artcile. it helps.. Thanks..!

  88. sailasya says:

    very nice sir. . . . thank u vry much………

  89. mowlika says:

    it helped me alot sir………thank u sir

  90. prasad says:

    Very good post, easy way of understanding thank u

  91. Useful information with good explanation well done Joseph..

  92. ashok says:

    realy good article

  93. Zahid Nasim says:

    Thanks dude.. its really so simple to understand these stuffs…….. really gr8 work.

  94. Thirupathi says:

    nice explanation.. thiru

  95. Anonymous says:

    Very Good article… Thank you..

  96. Kintesh says:

    thanks for simple explanation of association, aggregation, composition. Good Work…Thank you..

  97. shubh says:

    it is so easy and interesting

  98. shubh says:

    explanation also easy for preparing answerssssssssssss

  99. Om Behera says:

    Nice Article Joe..Like very much the way you describe ,Must say Very good Article for the beginners …!!!

  100. Prakash says:

    Superb Article !!!!!!!!!

  101. NextGeneration says:

    Nice Article, Much useful for a beginner

  102. Ramyashree says:

    very good explanation on composition and aggregation relationships

  103. Mani says:

    Dear sir, I need more explanation and example about abstraction… How to apply in c…? i use data structure linked list concept..

  104. Aggregation
    Aggregation is a relationship between two classes that is best described as a “has-a” and “whole/part” relationship. It is a more specialized version of the association relationship. The aggregate class contains a reference to another class and is said to have ownership of that class. Each class referenced is considered to be part-of the aggregate class

    Ownership occurs because there can be no cyclic references in an aggregation relationship. If Class A contains a reference to Class B and Class B contains a reference to Class A then no clear ownership can be determined and the relationship is simply one of association.

    For example, imagine a Student class that stores information about individual students at a school. Now let’s say there is a Subject class that holds the details about a particular subject (e.g., history, geography). If the Student class is defined to contain a Subject object then it can be said that the Student object has-a Subject object. The Subject object also makes up part-of the Student object, after all there is no student without a subject to study. The Student object is therefore the owner of the Subject object.

    There is an aggregation relationship between Student class and the Subject class:

    public class Subject {

    private String name;

    public void setName(String name)
    { = name;

    public String getName()
    return name;

    public class Student {

    private Subject[] studyAreas = new Subject[10];

    //the rest of the Student class

  105. anbalagan says:

    Nice one.

  106. Meera says:

    This website is very useful . but i need short notes and examples for full oops concepts in c++.

  107. vicky says:

    material is good but it explain with diagram then it is more effective for readers

  108. shahan says:

    Nice explanation. It would recommend to add few more real world examples that could help to understand it more easily.

  109. Chandraprakash says:

    Nice explanation on the topics of association, aggregation and composition with quite undrestandable language.

  110. Nagendra says:

    Excellent, A quick glance with best understanding. Keep it up

  111. Surabhi says:

    very helpful and easy 2 understand
    Thank you

  112. Arun K Deo says:

    You mentioned in this article – Abstraction is specifying the framework and hiding the implementation level information. Abstraction never says about hiding anything. Let’s take an Example of Employee with Super class and Manager and Salesman bening subclass of Employee. So if Employee may provide various implentation in common, but can’t have implementation for calculateBonus because this is fully dependet on nature of employee subclass, and hence Employee would have calculateBonus as abstract. So overall, abstraction is isolation of common essentioal behaviour and supress unimportant behaviours. Abstraction never meanse hiding anything. Hiding of implementation from accidental access is Encapsulation.

    Arun Deo

  113. Akansh Bhatnagar says:

    This is very nice explanation with the examples. It helps to crystal clear the things, that have very confusing boundary among them.

  114. Anonymous says:

    Its really nice.I was always get confused for these relationship association, aggregation and composition.Thanks a lot

  115. Prabhu says:

    its really nice. keep going its really helps lot,


  116. Anonymous says:

    Wonderful… Very nice simple & easy to understood details which might be very complex for beginner……

    Appreciate your effort….

  117. Love Taneja says:

    Nice Article on relationships

  118. Sandeep verma says:

    really it’s a nice content that you provide through this web. It removes all of my confusion.

  119. Joe says:

    Thanks guys for all your overwhelming comments and support.

  120. mallesh says:

    Sir, i want to briefly explanation of attributes……..

  121. arslion says:

    thank u soo much, nice explanation , i really want this :)

  122. abi says:

    Very nice post.. i have never experienced such
    simple examples for explaining such complex terms like aggregation and composition
    i thought so far.. Keep posting…

  123. Srividya says:

    Best article on association aggregation composition

  124. Ganesh Kar says:


  125. CT says:

    Hi, may I seek a clarification about generalization concept. Let’s say I have a two kinds of staff, Manager and Supervisor and both have the same attributes (name,contact number). So, is it possible to say that this has a generalization relationship – Staff as the superclass, Manager and Supervisor as its subclasses althought there’s no difference in terms of the attributes between Manager and Supervisor?

  126. cheng kuyleang says:

    Thanks you very much for share good knowledge for me .

  127. Anonymous says:

    A very good explanation..I never seen before like this type explanation about this concept

  128. mayur bhalekar says:

    very nice artical!!

  129. Arvind kumar says:

    Very nice explanation about class diagram terms…

  130. Imrana Aminu Muhd says:

    1. Identify and briefly explain the objectives, classes, method and attributes for a hotel reservation system.
    2. Draw a use case diagram to represent a hotel reservation system.
    3. Draw a class diagram that models hotel reservation system data structure, clearly representing the objects, classes, associations, generalization and aggregations.


  131. Imrana Aminu Muhd says:

    1. Identify and briefly explain the objectives, classes, method and attributes for a hotel reservation system.
    2. Draw a use cases diagram to represent a hotel reservation system.
    3. Draw a class diagram that models hotel reservation system data structure, clearly representing the objects, classes, associations, generalization and aggregations.


  132. Subir says:

    Really simple and excellent explanation. Easy to understand for beginners…!!!

  133. siva says:

    Very good explanation

  134. Anonymous says:

    Superb Explanation…Keep It Up!

  135. zx says:


  136. Anonymous says:

    thanks friend

  137. jay says:

    identify in detail association and aggregation

  138. bluepicaso says:

    Nice one
    thank you

  139. Anonymous says:

    Gud NOtes

  140. Anonymous says:

    crystal clear dude.

  141. Sanchit says:

    Thanks..!! M sure your examples gonna help in tomorrows exam.

  142. Joe says:


    I feel very happy when I get to know that my blog helps a student.

    More than anything, I maintain this to help students succeed in their exams / interviews.

  143. Nitin says:

    A book CAN exist without a library…. Incorrectly quoted…… Rather a library CANNOT exist without a book….

  144. Baji says:

    Very nice narration.

  145. Anonymous says:

    Write an example program each showing dependency,
    generalisation relationships in JAVA

  146. Animesh says:

    Thanks for the useful info

  147. dp says:

    Nice explanation. If you would provide with one example all the above along with diagams that would be excellent.

  148. Chandra says:

    Good article. One of the questions mentioned above, was related to manager,supervisor and staff. Certainly there is a generalization relationship with Staff as superclass and manager and supervisor classes are subclasses inheriting from Staff. Though attributes could be same in manager and supervisor when it comes behaviour(methods) manager and supervisor classes are specialized with inheriting the generic class i.e., Staff.

  149. asdr says:

    Lun smjhaya h tounae

  150. Mohamed says:

    Thank’s man for this article, i found it very helpful for me. Am studying SCJA and i was looking for any comprehensive material for UML basics like this one.

  151. Anonymous says:

    its nice. very simple defnation. easy to understand.

  152. syed says:

    Awesome post!!!Keep it up.

  153. Ravikumar says:

    Nice article on UML concepts. The content of the article is very simple to understand. Thanks.

  154. Brother your website have beautiful GUI. Keep it up, and keep it UP.

  155. jayant says:

    Nice Post, Hope to get same clarity on design patterns.

    Thank you.

  156. Anonymous says:

    very nice…nd thanx..

  157. Raajpoot says:

    NUMBER # 1
    Very Clear Topic About the English WORDS “Aggrega…composi…reali…generai….etc etc…etc”

    But how can i understand when i want to implement your dictionary details (read NUMBER # 1) on practicing programming ???
    specially JAVA…

  158. Anonymous says:

    Awesome notes.

    Really helpful

  159. Pankaj says:

    Awesome…….really good way to understand newcomers!!

  160. Nambirajan says:

    Simple & Clear Explanation for the beginners.


  161. sandeep sonali says:

    this is simple way to understand any definition

  162. amulni says:

    Awesome…….really good way to understand newcomers!!

    Thank you.

  163. lorisa says:

    easy way to understaing.

  164. Ravi says:

    Clean & clear explanation. Thanks Joe.

  165. shiv yadav says:

    really nice

  166. praneeth says:

    Simplysuperb, lots of information with very simple words.

  167. TSKarthic says:

    Wonderful Job Joe. Keep it up.

  168. Anonymous says:

    really clears the confusion.

  169. Rohit Ojha says:

    Nice way of information.

  170. Hi,

    Superb Explanation sir .

  171. Nikhil says:

    Really good man easy to understand

  172. venky says:

    really helping me a lot….
    u r dng a great work.Thank You

  173. Ayyappa Dasam says:

    is it nice…

    i have got some idea…

    thanks ..

  174. Anonymous says:

    you have to increase the paragraph

  175. PINTU says:

    very nice explanation.

  176. Anonymous says:

    neat and clear description dude…

  177. Srividya says:

    Hi.. Useful explanation and easy to understand. thankyou

  178. Anonymous says:

    This is good post. thanks a lot

  179. vijain says:

    Its really post .

    Vidhi Jain

  180. Anonymous says:

    Very nice…Thanks

  181. soshiv says:

    best for beginner….like me
    thank you sir

  182. vishwajeet awasthi says:

    explained in very effective n simple way

  183. vishwajeet awasthi says:

    explained in very effective n simple way, doing a great job

  184. Anonymous says:

    please change the background color, so that it would be more readable

  185. kundan says:

    Thank you very much sir. It is ow-some….

  186. Anonymous says:

    Good to start for beginners and experienced juggling between these concepts.

  187. soumava says:

    Thanks a lot , good explanation with easy example ..

  188. Anonymous says:

    Thanks :Great people explain concept in the simple and easy understandable way.


  189. Anonymous says:

    that was a very good explanation. simple and easily understandable…

  190. Anonymous says:

    thanks. great for beginners

  191. Vikas says:

    Thanks It helps to clear my fundamental

  192. raman prasher says:

    all clear ………very gud job !!!!

  193. awanish says:

    its really very usefull and understandable

  194. Joe says:

    I never thought this small and simple article would become a great hit.

    I learn that, more and more we make the technology simple people like it.

  195. Anonymous says:

    Quike guide to understand the basics…great work…thanks a lot…

  196. Alkesh says:

    nice explanation

  197. jagan says:

    Good presentation.

  198. gopal says:

    Very good explanation. Thank you

  199. lady dabang says:

    thanku its very easy to understand and very easy explanation

  200. madhu says:

    thanq so much….its very nice …

  201. samy says:


  202. himanshu says:

    please explain more sir,with example..

  203. YoFo says:

    Good Summary. Thanks a lot!
    A simple class diagram to explain the direction of the relationship would be great, if can be added

  204. priya says:

    nice explanation. very useful. thanks

  205. Juhara says:

    very nice explanation

  206. Rahul says:

    Nice explanation of the terms…

  207. Jayshree says:

    nice definitions :)

  208. X says:

    pallabi baruah wake up!!!!listen to ur tech lead!!!

  209. Anonymous says:

    very nice explanation! keep it up

  210. Shakeel says:

    very nice explanation! keep it up

  211. Shakeel says:

    very good.

  212. Anonymous says:

    Goog Explanation. Keep going….

  213. raghuraj says:

    Thanks this helps !

  214. manu says:

    thanks this really gives the clarity of this topic

  215. guru says:

    thank u very much yar

  216. Anonymous says:

    Thanks you very much yar

  217. uma maheswari says:

    very nice and better explain with subject examples also,its nice but iam feeling

  218. abhishek says:

    Thanks this helps !

  219. Anonymous says:

    pls write about specialization also

  220. madhuri says:

    very nice………
    thank u so much

  221. Prajna says:

    can you please explain opps concept in aquarium system? Means how can i explain an aquarium using OOPs

  222. jeeva says:


  223. Santosh says:

    One of good artical and understandable.

  224. Rupesh says:

    Great and a very simple way to explain a confusing subject. Thanks a lot for this Post.

  225. SAGAR_D says:

    GOOD and NICE and SIMPLE Explanation……..

  226. sabarish says:

    Thanks for your inputs

  227. sourabh singhai says:

    good site thanks

  228. Thanks very much nice information about Generalization, Aggregation, Association, Composition, Dependency,, only one time i have refereed to it but absolutely i got******

  229. Looking forward to your next post like the same******* understandable

  230. Ankita says:

    Nice one

  231. Rashmi Varshney says:

    the content is really very good..

  232. prema says:

    nice information thank u logical examples have been provided

  233. Dilip says:

    Really useful for beginners.

  234. swamy says:

    good information and very useful to the beginners .


  235. Anonymous says:

    Good Information..

    It will give an basic idea to all who dont have base knowledge on these.

    Krs Rajasekhar

  236. Rajasekhar says:

    Good Information..

    It will give an basic idea to all who dont have base knowledge on these.

    Krs Rajasekhar

  237. Abhishek says:

    thanks a lot, you helped us completing our assignment. :)

  238. VVV says:

    Good explanations….

  239. VVV says:

    Good explanations….

  240. Gajendra says:

    Nice explanation yaar

  241. zeeshan says:

    Very nice content. I like it. The best site and very comprehensiveness information I ever found.

  242. Shameer says:

    Simple and easy understandable writing. thanks alot for your effort.

  243. Anonymous says:

    Simple and very clear to understud thaks

  244. Raveena Sharma says:

    Woow..very Nicely explained…

  245. satya says:

    very nice

  246. Anonymous says:

    Sir what is the difference between generalization and specialization ??????

  247. prasad says:

    good article..

  248. Ravi says:

    give me answer plz..
    Justifying the statement ,”inheritance is a special case of Generalization”.

  249. Vidhya says:

    Thankyou… nice article.

  250. kamal says:

    Clean and clear explanation. Thanks a lot.

  251. SanjayK says:

    Thanks a lot for such an easy explanation. Examples are also easy to understand and correlate.

  252. Ganesh says:

    Thanks a lot Joe, Very Useful information with simple language and good examples.

  253. Anonymous says:

    nice explanation..

  254. Pavan says:

    Nice Article Joe

  255. Abdul Hadi Ibrahimi says:

    I love your blog and find helpful…thanks for your great passion! You people make the world really great!

  256. Ashutosh says:

    Nice and very helpful Article….

  257. Jyotsna says:

    Thank you… nicely explained..!

  258. Anonymous says:

    nice simple article

  259. Vishal says:

    The Post would become more clear if you difine these concepts in terms of object’s life Cycle.

  260. umadatt says:

    Nicely Explained

  261. Very useful and complete

  262. Asraful forhad chowdhury says:

    Best explained concept across the internet .
    I was confused about those terms before reading these article . Thanks a lot. It’s helps me a lot.Will go through to other article.

  263. m says:

    Nice one Man!!

  264. ruby says:

    Good article.

  265. bismita says:

    thank you

  266. Bablu says:

    First i was confused but now i am confidece
    Thanks alot

  267. saroj says:

    very nice.. Thanks….

  268. shrikant says:

    thanks for that and its very easy language

  269. Anant Choubey says:

    Very good explaination

  270. Amit Don says:

    good loooking web site sir…

  271. riyaz says:

    thanks ..this is very good artical

  272. baburao says:

    help me alot….thks

  273. Anonymous says:

    Thanks for the explination. If a sample code is given it will become even more better.

    Thanks in advance


  274. Anonymous says:

    Thanks for your good job…

  275. ajeet says:

    good explaination joe, thanks

  276. ajeet shroti says:

    good explaination joe, thanks

  277. Anonymous says:

    sir,please give your mail id for further refrence..

  278. Ganesh says:

    ijust hv a doubt about composition ,as a example “A circle is composed of points”.
    then i think points are exist without circle ,,but according to u points r not exist without circle ..plz explain.?

  279. seema gupta says:

    good answer and example

  280. nisha says:

    very Clear n nice explaination …
    really confused before reading this article…
    thank you!!

    keep it up !!

  281. suryaSingh says:

    very nice content to start

  282. swaminathan says:

    nice one

  283. Lee says:

    Hi Joseph,

    This site is of great use for a java programmer like me.

    Thank you so much.

  284. Anonymous says:

    really nice to see this site…

  285. K.Saad says:


  286. Yoon says:

    really nice. thanks!

  287. nitish says:

    very lucid and helpful. thank you.

  288. Hikmat Jaber says:

    In defining the Composition in top of page, I think the sentence should be
    “…, if the container object cannot exist without the existence of contained object, then it is called composition”
    instead of “…, if the contained object cannot exist without the existence of container object, then it is called composition”

  289. Priyabrat says:

    I Think U are right Hikmat.

  290. N.Bala says:

    Good Article worth Reading. Nice Job!!!

  291. Anonymous says:

    Super explanation

  292. Pratik Jain says:

    Nice article.
    Adding some example, hope till will support the article.
    There are four kinds of Class relationships

    Association: uses a
    Ex:a Class Man uses a Class Pen
    Aggregation: has a
    Ex:a Class Man has a Class Car ( Car is still there when Man die )
    Composition: owns a
    Ex:a Class Man owns a Class Heart ( When Man die, Heart die )
    Inheritance: is a
    Ex:a Class Man is a Class Human ( Man is a Human )
    A relationship between classes of objects


  293. Ballem says:

    excellent. i best site i found till now for jAVA.

  294. Anonymous says:

    its my OOMAD exam today and these definitions really made me relaxed regarding their easy understandibility.
    Thnxxxxxx buddyyyyy

  295. manojbharal says:

    Could you please share with java code examples.

    A implements B is realization
    A extends B is generalization

    AM I right?

  296. pal says:


  297. Parshant says:

    sir…you should use email validation in comment box…..
    and your site content is awesome….i loved it….

  298. Vijay Arige says:

    Sir…it clearly differentiated the terms for a novice programmer.

  299. Jigar says:

    Thanks!!:) It was really worthy.. Short & to the point.. Clarifying examples played vital role in understanding.. ‘Thanks’ once again..

  300. Minesh says:

    Clear explanation with simplicity!

  301. Vijay says:

    Really a useful stuff to understand object relation ship.

  302. Hakkim says:

    Content is very good and the site is also looking so good keep it up sir,…

  303. jpnaidu says:

    very helpful and easy understanding

  304. krish says:

    it’s really good artical…..

  305. shukla ji says:

    thanks ji

  306. Anonymous says:

    hii thanks for information
    kamal gaba

  307. Satyabrata says:

    excellent clarified wit d example

  308. Mayank Kukadia says:

    Simply superb
    Thank You

  309. arsalan says:

    very nice it help me for my next interview :)

  310. loiletan90 says:

    clearly understand, very good writing. Thank you.

  311. SHUVANKAR GHOSH says:

    very brief and appropriate….
    easy to understand………thanks

  312. Pritesh Jain says:

    Easy to understand. Nicely presented.

  313. tusshar kavthekar says:

    excellent and simple language use for examples
    Tusshar Kavthekar

  314. Anonymous says:

    thank u …………

  315. manikesh says:

    I was screwed in a interview for all these.. thanks for sharing…really good one..

  316. Anonymous says:

    bhiya tussi to cha gaye…

  317. Kausik says:

    It will be great if you have some real life example on this..

    Thanks Kausik

  318. Sonal says:

    Thanks a lot for great article and your efforts.

  319. umadatt says:

    Nice,Its easy to understand

  320. It’s really good to proceed further….
    Great work…

  321. Thank You Sir………
    You makes it easy for us…..

  322. peetambara says:

    thank you sir……….

  323. pretam pyare says:

    i want to know..
    how one to one association,many to many association and ternary association is define?

  324. Anonymous says:

    i need a sample class diagram with a certain relation(sample in hotel management system)

  325. Anonymous says:

    i need a sample class diagram with a certain relation(sample in hotel management system)

  326. samir says:

    beautiful explanation. understanding is very easy when we refer such explanations

  327. Hamza Hasan says:

    Very nice work

  328. Murthy says:

    thank u very much for u r clear explanation..

  329. Raj says:

    Nice to read and understand the differences with examples. Thanks !!!

  330. viswanath says:

    Nice Information

  331. Lavanya says:

    Its very straight forward information and clear

  332. atul mairale says:

    thnks joe. i found very correct and simple concepts here.

  333. sunil says:

    pls give example also…

  334. Anonymous says:

    please explain with examples….

  335. Anonymous says:

    Had confusion with all these terms..your way of explanation is very simple and straight forward..thanks

  336. Anonymous says:

    unclear definitions

  337. komali says:

    i want full details about the relaitonship between objects

  338. Bharath says:

    Short and clear thanks for the detailsBharath

  339. Ganesh says:

    Dependency explanation is need to be amended as follows.

    Dependency is a weaker form of relationship which indicates that one class depends on another because it uses it at some point of time. One class depends on another if the latter is a parameter variable or local variable of a method of the former. This is different from an association, where an attribute of the former is an instance of the latter.

    Pl refer:

  340. Anil Kesarwani says:

    It is most simple and very clear,


  341. k.maheswari says:

    it is very clear understading me .please send me the inlinefunctions invoke at compiletime or runtime.

  342. Anonymous says:

    very good.

  343. Vinyas A M says:

    Really very nice… It very easy to understand and build class diagrams.

    Thanking you

    Vinyas A M

  344. Anonymous says:

    romba nantri..:)

  345. Santosh says:

    Understanding point of view its really very good.

  346. Ajay Shah says:

    This post is very helpfull to understand the basic concept of association and understands the association type aggregation and composition type ….

  347. Anish Sneh says:

    Well explained mate, great help

    – Anish Sneh

  348. durga says:

    Thank you…..
    could you please explain these association,aggregation,composition and dependancies with a sample scenario with java classes implementation…..

  349. Munyi says:

    Impressive. Why not start a training site for Object Orientation. Good work!

  350. anurag says:

    nice explanation joe…

  351. Anonymous says:

    i need more elobration with respect to the programs

  352. chandan kumar says:

    i need more elobration with respect to the programs , and these are very good example……..joe..thankx a lot.

  353. Rahul says:

    Good explanation. I think you must give examples using code to clearly understand, so that programmer can easily corelate.

  354. webKiller says:

    nice elaboration and nice website design

  355. Prashob Maniyath says:

    thank you joe..
    very much helpful..

  356. jon says:

    thanx joe sir….
    u explained it very well…..

  357. jyoti says:


  358. Yuri says:

    Hi, Joe!
    Thank you for your explanations!
    But… you write: “A book cannot exist without a library and therefore its a composition.”
    I think more correctly would be as follows:
    “A library cannot exist without book and therefore it’s a composition.”

  359. dheeraj says:

    very good explanation thanks…………..

  360. shashikant pandit says:

    earlier i confused to understand about these topic .but by the God i found your site, and understood these all topics with in few moments.

    nice site

  361. Anonymous says:

    nice explanation for UML easy understanding…Please continue this short of topics

  362. Anonymous says:

    good article for basics

  363. Abhijeet says:

    Very Nice and easy explanation.

    Thanks Joe.

  364. Abhijeet says:

    Examples of Aggregation and Composition Association

  365. Gaurav says:

    superbly explained.. :)

  366. mc says:

    Thanks Joe it really helps…. simple and effective.

  367. venkat says:

    Theory is good , but how we want to apply this theory in programmatic, while thinking like this that is too difficult.

  368. Arun Raja says:

    hi Joseph ,
    I am Arun Raja Do u remember me ?
    I worked with you…

    Your blog is good and informative.

  369. Vgopalkr says:

    Hello Joe,

    Simple and clear explanation. Should be very useful for interview point of view as well. In my experience, whenever UML interview questions starts, they mostly ask these kind of basic questions to test the understanding. Thanks a lot. This should help many folks.

  370. mahi mishra says:

    hello sir
    very nice article

  371. Saini says:

    good article

  372. Anonymous says:

    Thanks sir..
    Very nice article..

    pooja agrawal 29 August 2012

  373. Anonymous says:

    great !! helped a lot ..
    thank u..

  374. prashant says:

    very nice!!!! thanks.

  375. Anonymous says:

    Very Nice Definitions

  376. SANTHOSH says:

    thanks a lot!!! ur posts are just awesome!!!

  377. Rakesh says:

    Specialization is missing

  378. vivek says:

    very good explaination and better diagram understand.

  379. Vikash Yadav SGSITS says:

    all definations are correct and better daigrams to understand the relationships.

    Really useful for beginners.

  380. Ashish says:

    easy to understand

  381. Ravi ranjan says:

    this is excellent explanation..

  382. balaram says:

    very generalised explanation of the concept
    and thank you for that.

  383. Anonymous says:

    Gud Attempt.. Keep it up.. Try to give java examples

  384. Anonymous says:

    nice post…keep up the good work…

  385. Maheraj says:

    Nice article..

  386. Anonymous says:

    You gave your explanation in very simple worlds. So i understood very well. Thank you very much.

  387. Aslam says:

    thanks a lot its awsome

  388. Anonymous says:

    Very ease to understand…. :)

  389. Anonymous says:

    Precisely written. Useful, easy to read and understand.

  390. Anonymous says:

    Nice explaination

  391. Anonymous says:

    simple to understand…with real life egg

  392. Priya says:

    Its really very easy to understand.. Thanks a lot

  393. js says:

    Very information. thanks

  394. Anonymous says:

    Good explanation

  395. vandu says:

    such a nice information .it will help everyone..

  396. deep says:

    thank you sooo much

  397. sss says:

    great work….

  398. anand kushwaha says:

    thanks for this

  399. max says:

    thank you very much!!!!

    it is very conceptual and you explained it very effectively…..

  400. Anonymous says:

    It very understandable.


  401. Al Cristhi says:

    Deberían agrandar la definición de Agregación.

  402. anonymous says:

    good explanation…….

  403. Vamsi says:

    Clean and Clear explanation….Appreciate it.

  404. Hamed Mirzaei says:

    Thank you

    it was very useful for me

  405. archana says:


  406. Anonymous says:

    Very helpful and easy t understand

  407. Shreya says:

    Very helpful and easy to understand.

  408. abbas raza says:

    thank you

  409. Saurish says:

    Very well explained , Thank You Joe.. & keep posting.

  410. bala says:

    ur way of explaning is vry effective..!!
    keep going ..!!
    thankz a lot..!!

  411. Chandra Rao says:

    Nice to read your blog. very simple and good to read the content. Thanks for your efforts.

  412. Jatinder says:

    Indeed this is a very good post.
    If i have understood correctly,then will it be ok to say that a child in a mother’s womb is an example of composition and after birth,a mother-child relation can be called aggregation.
    Request all learned to please correct me if i have understood incorrectly.

  413. Anonymous says:

    nice explanation

  414. Girish says:

    Thanks.:) Clearcut definitions. :)

    For association, aggregation and composition could you please put real time exmaples with come classes?

    Nice work ..

  415. irfan noor says:

    thankx..i got alots of information from here…hope you help me in future..

  416. muttu says:

    good one

  417. Anonymous says:

    When i read your articles, i get the impression that anything can be easy to understand if its explained in such a way….

  418. ANNA says:

    Thank you!

  419. a unique explanation of relationship among class more than any cse book thanx… alot

  420. Piyush Jain says:

    Your site is awesome if you are not trying to impress me.But it took me two days for scrolling whole website and see and ya your background color is so good that I tried six different varieties of colored spectacles but I couldn’t see even a single thing.But above all the best part of your website is it doesn’t support cross-browsing stability.

    • Joe says:

      Thanks for your comments.

      I am working to fix the theme and you will get a better user experience soon.

  421. Anonymous says:

    understanding made simpler

  422. Shivananth.K says:

    Clear explanations and examples :)

  423. Anonymous says:

    Thank you so muchHHHHHHHHHHH sir :-) :-)

  424. kavita says:

    thank u sir very clearly explained

  425. satish says:

    Good Explanation.

    Thank you

  426. Owa says:

    great work very simple and strong example.Keep it up

  427. Very Nice article ! Its cleared my doubt . Thanks……….

  428. Anonymous says:

    easy to understand

  429. Anonymous says:

    very helpful and easy to understand……
    thanx sir……

  430. Vachana says:

    Very simple and easy to understand definitions.. It is very good to refresh. Thanks

  431. Mack says:

    Hi! Deep thanks man! couldn’t have been simpler!

  432. pradeep says:

    Nice article.

  433. pradeep says:

    Really helpful to brush up the concepts.Thanks for posting such a nice article.

  434. sarang says:

    cool.. :)

  435. Anonymous says:

    Good Explanation. Thanks a lot!
    A simple class diagram to explain the direction of the relationship would be great, if can be added.

  436. Lakshmikanth says:

    very nice and interesting article, very much appreciated.

  437. sunil says:

    nice explaination,thanks’

  438. sriram says:

    Good explanation, Keep up good work Joe.
    Looking forward your next post.

  439. Rajiv says:

    thanks a lot for this post. This will be really very helpful for me.

  440. Sushma says:

    Very helpful. Thank you

  441. Bhaskar says:

    Hi Joe, Thanks a lot for explaining these concepts clearly with real time examples. But if you could explain these concepts with small programs, it would have been fantastic. Looking forward to this…

  442. This is really nice and attractive page

  443. vivek devdas says:

    it was really heipful

  444. RK says:

    Nice explanation!!

  445. Anonymous says:

    u r awesome

  446. Anonymous says:

    bundle of thanks. its very helping

  447. majid amjad hussain says:

    very helping and good examples. good explaination.

  448. Venkat says:

    Hi Joe, very nice explanation.
    I just got doubt about the sentence in “Generalisation” , you wrote as – Common structure and behaviour are used from the specializtion to the generalized class.

    or it should be as below.

    Common structure and behaviour are used from the generalized to the specializtion class.

    Correct me on this please.

  449. Nagarjuna says:

    Really good article , thanks a lot.

    If you can provide the UML examples using symbols(aggregation,composition and generalization) will be more useful.

  450. Lasal,Sera says:

    Nice explainations….really nice…thnks a lot

  451. Anonymous says:

    awesome dude..very easy to understand. saved a lot of time.

  452. Prakash says:

    Can u please explain about abstraction and encapsulation oops concepts

  453. Prakash says:

    And also about the four types of drivers in jdbc briefly

  454. Poornima Parthiban says:

    Hi Joe,

    Really nice explaination………

  455. Poornima Parthiban says:

    Hi Joe,

    Really nice explaination………

  456. Anonymous says:

    Really good one.

  457. furry says:

    “Suppose we have implemented a scenario and we used aggregation in it, after some time we realize that use of aggregation is not a correct choice, now we want to use composition instead of aggregation. Can we replace composition with aggregation? At which phase(s) these changes are required? Justify your answer with solid reasons. ”

    sir this question is related by C++

  458. shashidhar says:

    Thanks Joe…. Wonderfull articles

  459. I surely benefited from this blog and i urge the Blogger to do more to improve our IT’s mind of Technology

  460. Anonymous says:

    its really very helpful ,thanks so much :)

  461. mayank tiwari says:

    its great thanks

  462. suresh gupta says:

    very Clear n nice explaination …
    really confused before reading this article…
    thank you!!

  463. thakkar komal says:

    in ooad(Object Oriented Analysis Design and UML)

    1)Is association class same as ordinary classs? Explain with example.

    plz send ans

  464. Lingareddy says:

    very thanks joe because wt u have given is very much understandable.

  465. Krishna Chaitanya says:

    Great job joe.. awesome explanation :)

  466. Anonymous says:

    Kudos for keeping the explanation so simplistic.

  467. Anonymous says:

    really very nice description about all the concepts……..thanks.

    regards shital

  468. Prashant Niraj says:

    Really it’s very helpful. Examples clears the concept

  469. Anonymous says:

    its a useful information…thanks

  470. Arjuna says:

    Awesome tutorial. Very much usefull if u use simple diagrams for further explanation.

  471. Bhupesh says:

    our sir tought 3 relationships, it is clear and is-a and Has-a but one more is Uses-a
    which of the above concept comes user Uses-a ?

  472. Rijith says:

    Thanks alot..really helpful clear the confusion on aggregation.

  473. Phani says:

    Its very clear explanation,please provide some code examples

  474. jagyaseni mallick says:

    what do u mean by links in java???

  475. Anonymous says:

    Gr8 explanation ….
    Easy to understand…..
    Thanks alot:)

  476. Rinks says:

    It’s really nice
    i cleared my dought…..

  477. aliaa almaqtary says:

    thank you very much , it was really interested explanation

  478. Anonymous says:

    good explanation!!

  479. Niraj says:

    Hi Joe, Thanks a ton! This is an awesome, anyone can understand the difference seeing this post.

    Request you to add Java code to show the implementation difference between Composition and Aggregation.

  480. krishna says:

    Excellent Explanation………I bookmarked your pages..Thanks


  481. Anonymous says:

    nice page..

  482. Amlan Sahoo says:

    Good work.

  483. sasi says:

    Its crispy and understandable.thnk u!!!

  484. Swapnil says:

    U Say ‘ if the contained object cannot exist without the existence of container object, then it is called composition.’–>with example Library–>Books
    With your definition ‘Books can not exists without Library’..How’s this ? ..or is it the other way round ‘Library can not exists without Books’??
    I am damn confused?
    Please please help.Thanks

  485. Anonymous says:


  486. Ali says:


    What is Difference between Association and Dependency ?

  487. Rajlaxmi says:

    Nice Tutorials.. easy to understand

  488. Anonymous says:

    Very easy to get , and to the point .

  489. Trupti says:

    Great Article…
    Very nicely explained

  490. luis says:

    very well done!!!

  491. NarenderReddy says:

    Simple & excellent explanation

  492. Anonymous says:

    Many Many Thanks

  493. [...] and it is as popular as Harry Potter books among kids. I wrote a tutorial on relationships, like association, aggregation, composition, abstraction, etc and it was well received. I have been planning for long to write about all the OOPs concepts [...]

  494. […] have got an interface and an implementation concrete class. Create an abstract class that contains (aggregation relationship) an attribute type of the interface. The constructor of this class assigns the interface type […]