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.



Comments on “Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency”

  1. Rajesh

    Thank you..
    Looking forward for your next post…

    • Anonymous

      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

        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

        just refer concepts and do examples u can get it.

  2. himanshu

    very nice content to start


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

  4. fixxer

    Very helpful. Thanks.

  5. ashok

    Nice article. Explanation the concepts clearly.Thank you

  6. Gajanan

    Good article. Thanks.

  7. Ravindra Sareddy

    Very nice and easy to understand in a simple definitions.

  8. Anonymous

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

  9. Joe

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

  10. Anonymous

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

  11. Jyotilal

    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

    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

    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

    Superb Example.

    Keep Posting Joe

  15. Lingaraj

    Thanks! Very nice explanation.

  16. Dhananjay..........aec

    Thanks for helping……………

  17. Muthukumar

    Good explain…

  18. swathi

    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

    Great Post! It clear my mind.

  20. Rakesh

    Really Good article. Nice work.

  21. Anonymous

    nice… its in a generalized way….very helpful

  22. Mutayyab Shah

    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

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

  24. Amit Shekhar

    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

    Thank You Very Much… It Was Very Helpfull…

  26. Casper

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

  27. Narayan

    Good explaination mate

  28. Chetan Jadhav

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

    Looking forward for your next posts…

  29. RenuNaidu.....

    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

    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


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

    Cheers !!!

  32. Vijay Agalcha

    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

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

  34. Kareem Afifiy

    Thanks for these information. Great definition for aggregation n composition

  35. Prabhat

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

  36. viji

    Nice.. Thank You..

  37. Radhika


    good article.

    Thank you.

  38. abhishek

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

  39. priya

    very clear and crisp.

  40. lize

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

  41. Supriya V

    Easy to understand.Nice Post.

  42. Balaji

    Very nice….

  43. pavan srivastava

    Thanks ,
    your definition is very clear

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

  45. Shylaja

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

    Shylaja V.

  46. thanks this artical is very easy to understand

  47. ashri

    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


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

    Great Work!!!!

  49. kondalarao

    it is simple and very easy to understand
    thank you,

  50. sambha

    simple and understanble…
    Thanks a lot

  51. sadish

    Great Work !!!
    Keep going on !!!

    All the best !!

  52. Su

    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

    thank you for you very clear work joe.


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

  55. Rajasekhar

    thanks much. very useful information

  56. thankz sir , very nice content

  57. thanks sir,

    this content is very helpful and outstanding

  58. raziya mev

    thanks for give simple & informational content

  59. pranjal soni

    thanks 4 this outstanding content

  60. mast laga maja aagaya…………

  61. Sharron

    Excellent! Thanks so much.

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

  63. Anonymous

    Nice article. Keep going.

  64. Avinash

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

    BTW thank you very much.

  65. shoban

    very nice understanding…thanks

  66. girish

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

    Thanks a lot buddy.


  67. Varma

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


  68. Girish Varma

    multiplicity is no given here :) pls add


  69. Atif Mehar

    Its a great post. Thanks Man!

  70. simanchala

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

  71. Dinesh

    Very nice post…

  72. maya butt

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

  73. Anonymous

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

  74. Pawan


    K eep
    I t
    S imple
    S illy

    Completely Followed

    Nice Simple Sober & Easily Grab-able & Understandable

  75. jagdish

    nice, short, simple and good explanatory.

  76. K Vishnu

    Nice one

  77. NiteshKumar

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

  78. Narendra

    Simply Superb

  79. Gunvant phalak

    very nice

  80. Parmod

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

  81. Shahbaz Ali

    too much informative

  82. niranjan

    simply super….very useful Thanks for posting..

  83. Baravil Barivare

    This article is very helpful and well explained. Thanks

  84. pravinth

    Good Artcile. it helps.. Thanks..!

  85. sailasya

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

  86. mowlika

    it helped me alot sir………thank u sir

  87. prasad

    Very good post, easy way of understanding thank u

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

  89. ashok

    realy good article

  90. Zahid Nasim

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

  91. Thirupathi

    nice explanation.. thiru

  92. Anonymous

    Very Good article… Thank you..

  93. Kintesh

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

  94. it is so easy and interesting

  95. explanation also easy for preparing answerssssssssssss

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

  97. Prakash

    Superb Article !!!!!!!!!

  98. NextGeneration

    Nice Article, Much useful for a beginner

  99. Ramyashree

    very good explanation on composition and aggregation relationships

  100. Mani

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

  101. 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

  102. anbalagan

    Nice one.

  103. Meera

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

  104. vicky

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

  105. shahan

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

  106. Chandraprakash

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

  107. Nagendra

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

  108. Surabhi

    very helpful and easy 2 understand
    Thank you

  109. Arun K Deo

    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

  110. Akansh Bhatnagar

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

  111. Anonymous

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

  112. Prabhu

    its really nice. keep going its really helps lot,


  113. Anonymous

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

    Appreciate your effort….

  114. Love Taneja

    Nice Article on relationships

  115. Sandeep verma

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

  116. Joe

    Thanks guys for all your overwhelming comments and support.

  117. mallesh

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

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

  119. abi

    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…

  120. Srividya

    Best article on association aggregation composition

  121. Ganesh Kar


  122. CT

    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?

  123. cheng kuyleang

    Thanks you very much for share good knowledge for me .

  124. Anonymous

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

  125. mayur bhalekar

    very nice artical!!

  126. Arvind kumar

    Very nice explanation about class diagram terms…

  127. Imrana Aminu Muhd

    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.


  128. Imrana Aminu Muhd

    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.


  129. Subir

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

  130. siva

    Very good explanation

  131. Anonymous

    Superb Explanation…Keep It Up!

  132. Anonymous

    thanks friend

  133. jay

    identify in detail association and aggregation

  134. Anonymous

    Gud NOtes

  135. Anonymous

    crystal clear dude.

  136. Sanchit

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

  137. Joe


    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.

  138. Nitin

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

  139. Baji

    Very nice narration.

  140. Anonymous

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

  141. Thanks for the useful info

  142. dp

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

  143. Chandra

    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.

  144. asdr

    Lun smjhaya h tounae

  145. Mohamed

    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.

  146. Anonymous

    its nice. very simple defnation. easy to understand.

  147. syed

    Awesome post!!!Keep it up.

  148. Ravikumar

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

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

  150. jayant

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

    Thank you.

  151. Anonymous

    very nice…nd thanx..

  152. Raajpoot

    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…

  153. Anonymous

    Awesome notes.

    Really helpful

  154. Pankaj

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

  155. Nambirajan

    Simple & Clear Explanation for the beginners.


  156. sandeep sonali

    this is simple way to understand any definition

  157. amulni

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

    Thank you.

  158. lorisa

    easy way to understaing.

  159. Ravi

    Clean & clear explanation. Thanks Joe.

  160. shiv yadav

    really nice

  161. praneeth

    Simplysuperb, lots of information with very simple words.

  162. Wonderful Job Joe. Keep it up.

  163. Anonymous

    really clears the confusion.

  164. Rohit Ojha

    Nice way of information.

  165. Hi,

    Superb Explanation sir .

  166. Nikhil

    Really good man easy to understand

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

  168. Ayyappa Dasam

    is it nice…

    i have got some idea…

    thanks ..

  169. Anonymous

    you have to increase the paragraph

  170. PINTU

    very nice explanation.

  171. Anonymous

    neat and clear description dude…

  172. Srividya

    Hi.. Useful explanation and easy to understand. thankyou

  173. Anonymous

    This is good post. thanks a lot

  174. vijain

    Its really post .

    Vidhi Jain

  175. Anonymous

    Very nice…Thanks

  176. soshiv

    best for beginner….like me
    thank you sir

  177. vishwajeet awasthi

    explained in very effective n simple way

  178. vishwajeet awasthi

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

  179. Anonymous

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

  180. kundan

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

  181. Anonymous

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

  182. soumava

    Thanks a lot , good explanation with easy example ..

  183. Anonymous

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


  184. Anonymous

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

  185. Anonymous

    thanks. great for beginners

  186. Vikas

    Thanks It helps to clear my fundamental

  187. raman prasher

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

  188. awanish

    its really very usefull and understandable

  189. Joe

    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.

  190. Anonymous

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

  191. Alkesh

    nice explanation

  192. jagan

    Good presentation.

  193. gopal

    Very good explanation. Thank you

  194. lady dabang

    thanku its very easy to understand and very easy explanation

  195. madhu

    thanq so much….its very nice …

  196. himanshu

    please explain more sir,with example..

  197. YoFo

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

  198. priya

    nice explanation. very useful. thanks

  199. Juhara

    very nice explanation

  200. Rahul

    Nice explanation of the terms…

  201. Jayshree

    nice definitions :)

  202. X

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

  203. Anonymous

    very nice explanation! keep it up

  204. Shakeel

    very nice explanation! keep it up

  205. Shakeel

    very good.

  206. Anonymous

    Goog Explanation. Keep going….

  207. Thanks this helps !

  208. manu

    thanks this really gives the clarity of this topic

  209. guru

    thank u very much yar

  210. Anonymous

    Thanks you very much yar

  211. uma maheswari

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

  212. abhishek

    Thanks this helps !

  213. Anonymous

    pls write about specialization also

  214. madhuri

    very nice………
    thank u so much

  215. Prajna

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

  216. jeeva


  217. Santosh

    One of good artical and understandable.

  218. Rupesh

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

  219. SAGAR_D

    GOOD and NICE and SIMPLE Explanation……..

  220. sabarish

    Thanks for your inputs

  221. sourabh singhai

    good site thanks

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

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

  224. Ankita

    Nice one

  225. Rashmi Varshney

    the content is really very good..

  226. prema

    nice information thank u logical examples have been provided

  227. Dilip

    Really useful for beginners.

  228. swamy

    good information and very useful to the beginners .


  229. Anonymous

    Good Information..

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

    Krs Rajasekhar

  230. Good Information..

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

    Krs Rajasekhar

  231. Abhishek

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

  232. VVV

    Good explanations….

  233. VVV

    Good explanations….

  234. Gajendra

    Nice explanation yaar

  235. zeeshan

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

  236. Shameer

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

  237. Anonymous

    Simple and very clear to understud thaks

  238. Raveena Sharma

    Woow..very Nicely explained…

  239. satya

    very nice

  240. Anonymous

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

  241. prasad

    good article..

  242. Ravi

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

  243. Vidhya

    Thankyou… nice article.

  244. kamal

    Clean and clear explanation. Thanks a lot.

  245. SanjayK

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

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

  247. Anonymous

    nice explanation..

  248. Pavan

    Nice Article Joe

  249. Abdul Hadi Ibrahimi

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

  250. Ashutosh

    Nice and very helpful Article….

  251. Jyotsna

    Thank you… nicely explained..!

  252. Anonymous

    nice simple article

  253. Vishal

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

  254. umadatt

    Nicely Explained

  255. Very useful and complete

  256. Asraful forhad chowdhury

    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.

  257. m

    Nice one Man!!

  258. ruby

    Good article.

  259. bismita

    thank you

  260. First i was confused but now i am confidece
    Thanks alot

  261. saroj

    very nice.. Thanks….

  262. thanks for that and its very easy language

  263. Anant Choubey

    Very good explaination

  264. Amit Don

    good loooking web site sir…

  265. riyaz

    thanks ..this is very good artical

  266. baburao

    help me alot….thks

  267. Anonymous

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

    Thanks in advance


  268. Anonymous

    Thanks for your good job…

  269. ajeet

    good explaination joe, thanks

  270. ajeet shroti

    good explaination joe, thanks

  271. Anonymous

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

  272. Ganesh

    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.?

  273. seema gupta

    good answer and example

  274. nisha

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

    keep it up !!

  275. suryaSingh

    very nice content to start

  276. swaminathan

    nice one

  277. Lee

    Hi Joseph,

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

    Thank you so much.

  278. Anonymous

    really nice to see this site…

  279. K.Saad


  280. Yoon

    really nice. thanks!

  281. nitish

    very lucid and helpful. thank you.

  282. Hikmat Jaber

    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”

  283. Priyabrat

    I Think U are right Hikmat.

  284. N.Bala

    Good Article worth Reading. Nice Job!!!

  285. Anonymous

    Super explanation

  286. Pratik Jain

    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


  287. Ballem

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

  288. Anonymous

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

  289. manojbharal

    Could you please share with java code examples.

    A implements B is realization
    A extends B is generalization

    AM I right?

  290. Parshant

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

  291. Vijay Arige

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

  292. Jigar

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

  293. Minesh

    Clear explanation with simplicity!

  294. Vijay

    Really a useful stuff to understand object relation ship.

  295. Hakkim

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

  296. jpnaidu

    very helpful and easy understanding

  297. krish

    it’s really good artical…..

  298. shukla ji

    thanks ji

  299. Anonymous

    hii thanks for information
    kamal gaba

  300. Satyabrata

    excellent clarified wit d example

  301. Mayank Kukadia

    Simply superb
    Thank You

  302. arsalan

    very nice it help me for my next interview :)

  303. loiletan90

    clearly understand, very good writing. Thank you.


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

  305. Pritesh Jain

    Easy to understand. Nicely presented.

  306. tusshar kavthekar

    excellent and simple language use for examples
    Tusshar Kavthekar

  307. Anonymous

    thank u …………

  308. manikesh

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

  309. Anonymous

    bhiya tussi to cha gaye…

  310. Kausik

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

    Thanks Kausik

  311. Sonal

    Thanks a lot for great article and your efforts.

  312. umadatt

    Nice,Its easy to understand

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

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

  315. peetambara

    thank you sir……….

  316. pretam pyare

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

  317. Anonymous

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

  318. Anonymous

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

  319. samir

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

  320. Hamza Hasan

    Very nice work

  321. Murthy

    thank u very much for u r clear explanation..

  322. Raj

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

  323. viswanath

    Nice Information

  324. Lavanya

    Its very straight forward information and clear

  325. atul mairale

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

  326. sunil

    pls give example also…

  327. Anonymous

    please explain with examples….

  328. Anonymous

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

  329. Anonymous

    unclear definitions

  330. komali

    i want full details about the relaitonship between objects

  331. Bharath

    Short and clear thanks for the detailsBharath

  332. 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:

  333. Anil Kesarwani

    It is most simple and very clear,


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

  335. Anonymous

    very good.

  336. Vinyas A M

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

    Thanking you

    Vinyas A M

  337. Anonymous

    romba nantri..:)

  338. Understanding point of view its really very good.

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

  340. Well explained mate, great help

    – Anish Sneh

  341. durga

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

  342. Munyi

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

  343. anurag

    nice explanation joe…

  344. Anonymous

    i need more elobration with respect to the programs

  345. chandan kumar

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

  346. Rahul

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

  347. webKiller

    nice elaboration and nice website design

  348. Prashob Maniyath

    thank you joe..
    very much helpful..

  349. jon

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

  350. jyoti


  351. Yuri

    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.”

  352. dheeraj

    very good explanation thanks…………..

  353. shashikant pandit

    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

  354. Anonymous

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

  355. Anonymous

    good article for basics

  356. Abhijeet

    Very Nice and easy explanation.

    Thanks Joe.

  357. Abhijeet

    Examples of Aggregation and Composition Association

  358. Gaurav

    superbly explained.. :)

  359. mc

    Thanks Joe it really helps…. simple and effective.

  360. venkat

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

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

    Your blog is good and informative.

  362. Vgopalkr

    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.

  363. mahi mishra

    hello sir
    very nice article

  364. Saini

    good article

  365. Anonymous

    Thanks sir..
    Very nice article..

    pooja agrawal 29 August 2012

  366. Anonymous

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

  367. prashant

    very nice!!!! thanks.

  368. Anonymous

    Very Nice Definitions


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

  370. Rakesh

    Specialization is missing

  371. vivek

    very good explaination and better diagram understand.

  372. Vikash Yadav SGSITS

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

    Really useful for beginners.

  373. Ashish

    easy to understand

  374. Ravi ranjan

    this is excellent explanation..

  375. balaram

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

  376. Anonymous

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

  377. Anonymous

    nice post…keep up the good work…

  378. Maheraj

    Nice article..

  379. Anonymous

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

  380. Aslam

    thanks a lot its awsome

  381. Anonymous

    Very ease to understand…. :)

  382. Anonymous

    Precisely written. Useful, easy to read and understand.

  383. Anonymous

    Nice explaination

  384. Anonymous

    simple to understand…with real life egg

  385. Priya

    Its really very easy to understand.. Thanks a lot

  386. js

    Very information. thanks

  387. Anonymous

    Good explanation

  388. vandu

    such a nice information .it will help everyone..

  389. deep

    thank you sooo much

  390. sss

    great work….

  391. anand kushwaha

    thanks for this

  392. max

    thank you very much!!!!

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

  393. Anonymous

    It very understandable.


  394. Al Cristhi

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

  395. anonymous

    good explanation…….

  396. Vamsi

    Clean and Clear explanation….Appreciate it.

  397. Hamed Mirzaei

    Thank you

    it was very useful for me

  398. Anonymous

    Very helpful and easy t understand

  399. Shreya

    Very helpful and easy to understand.

  400. abbas raza

    thank you

  401. Saurish

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

  402. bala

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

  403. Chandra Rao

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

  404. Jatinder

    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.

  405. Anonymous

    nice explanation

  406. Girish

    Thanks.:) Clearcut definitions. :)

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

    Nice work ..

  407. irfan noor

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

  408. muttu

    good one

  409. Anonymous

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

  410. ANNA

    Thank you!

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

  412. Piyush Jain

    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

      Thanks for your comments.

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

  413. Anonymous

    understanding made simpler

  414. Shivananth.K

    Clear explanations and examples :)

  415. Anonymous

    Thank you so muchHHHHHHHHHHH sir :-) :-)

  416. kavita

    thank u sir very clearly explained

  417. satish

    Good Explanation.

    Thank you

  418. Owa

    great work very simple and strong example.Keep it up

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

  420. Anonymous

    easy to understand

  421. Anonymous

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

  422. Vachana

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

  423. Mack

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

  424. pradeep

    Nice article.

  425. pradeep

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

  426. sarang

    cool.. :)

  427. Anonymous

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

  428. Lakshmikanth

    very nice and interesting article, very much appreciated.

  429. sunil

    nice explaination,thanks’

  430. sriram

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

  431. Rajiv

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

  432. Sushma

    Very helpful. Thank you

  433. Bhaskar

    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…

  434. This is really nice and attractive page

  435. vivek devdas

    it was really heipful

  436. RK

    Nice explanation!!

  437. Anonymous

    u r awesome

  438. Anonymous

    bundle of thanks. its very helping

  439. majid amjad hussain

    very helping and good examples. good explaination.

  440. Venkat

    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.

  441. Nagarjuna

    Really good article , thanks a lot.

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

  442. Lasal,Sera

    Nice explainations….really nice…thnks a lot

  443. Anonymous

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

  444. Prakash

    Can u please explain about abstraction and encapsulation oops concepts

  445. Prakash

    And also about the four types of drivers in jdbc briefly

  446. Poornima Parthiban

    Hi Joe,

    Really nice explaination………

  447. Poornima Parthiban

    Hi Joe,

    Really nice explaination………

  448. Anonymous

    Really good one.

  449. furry

    “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++

  450. shashidhar

    Thanks Joe…. Wonderfull articles

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

  452. Anonymous

    its really very helpful ,thanks so much :)

  453. mayank tiwari

    its great thanks

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

  455. thakkar komal

    in ooad(Object Oriented Analysis Design and UML)

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

    plz send ans

  456. Lingareddy

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

  457. Krishna Chaitanya

    Great job joe.. awesome explanation :)

  458. Anonymous

    Kudos for keeping the explanation so simplistic.

  459. Anonymous

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

    regards shital

  460. Prashant Niraj

    Really it’s very helpful. Examples clears the concept

  461. Anonymous

    its a useful information…thanks

  462. Arjuna

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

  463. Bhupesh

    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 ?

  464. Rijith

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

  465. Phani

    Its very clear explanation,please provide some code examples

  466. jagyaseni mallick

    what do u mean by links in java???

  467. Anonymous

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

  468. Rinks

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

  469. aliaa almaqtary

    thank you very much , it was really interested explanation

  470. Anonymous

    good explanation!!

  471. Niraj

    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.

  472. krishna

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


  473. Anonymous

    nice page..

  474. Amlan Sahoo

    Good work.

  475. sasi

    Its crispy and understandable.thnk u!!!

  476. Swapnil

    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

  477. Anonymous


  478. Ali


    What is Difference between Association and Dependency ?

  479. Rajlaxmi

    Nice Tutorials.. easy to understand

  480. Anonymous

    Very easy to get , and to the point .

  481. Trupti

    Great Article…
    Very nicely explained

  482. luis

    very well done!!!

  483. NarenderReddy

    Simple & excellent explanation

  484. Anonymous

    Many Many Thanks

Comments are closed.