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 posted on 26/06/2010.
Ads by Google

507 comments on “Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependency

  1. Thank you..
    Looking forward for your next post…

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

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

      • just refer concepts and do examples u can get it.

        • Very nice and easy to understand.
          Concept clearing! :)
          Thankx alot!

  2. very nice content to start


  3. Very helpful. Thanks.

  4. Nice article. Explanation the concepts clearly.Thank you

  5. Good article. Thanks.

  6. Very nice and easy to understand in a simple definitions.

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

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

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

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

  11. 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!

    • this is a better example :)

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

    Its very handy too..


  13. Superb Example.

    Keep Posting Joe

  14. Thanks! Very nice explanation.

  15. Thanks for helping……………

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

  17. Great Post! It clear my mind.

  18. Really Good article. Nice work.

  19. nice… its in a generalized way….very helpful

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

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

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

  23. Thank You Very Much… It Was Very Helpfull…

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

  25. Good explaination mate

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

    Looking forward for your next posts…

  27. 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……

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

  29. Hi,

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

    Cheers !!!

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

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

  32. Thanks for these information. Great definition for aggregation n composition

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

  34. Hi,

    good article.

    Thank you.

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

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

    • thanks a lot it is simple and understandable explanation

  37. Easy to understand.Nice Post.

  38. Thanks ,
    your definition is very clear

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

    Shylaja V.

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

  41. Hey,

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

    Great Work!!!!

  42. it is simple and very easy to understand
    thank you,

  43. simple and understanble…
    Thanks a lot

    • thank u a lot it is simple and understandable

  44. Great Work !!!
    Keep going on !!!

    All the best !!

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

  46. thank you for you very clear work joe.

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

  48. thanks much. very useful information

  49. thanks for give simple & informational content

  50. thanks 4 this outstanding content

  51. Excellent! Thanks so much.

  52. Nice article. Keep going.

  53. Pingback: Adapter Pattern

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

    BTW thank you very much.

  55. very nice understanding…thanks

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

    Thanks a lot buddy.


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


  58. Pingback: 装饰器设计模式 | Java视点

  59. multiplicity is no given here :) pls add


  60. Its a great post. Thanks Man!

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

  62. hi,
    very nice approach i realy like this complete definition pakage with examples

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

  64. Nice

    K eep
    I t
    S imple
    S illy

    Completely Followed

    Nice Simple Sober & Easily Grab-able & Understandable

  65. nice, short, simple and good explanatory.

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

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

  68. too much informative

  69. simply super….very useful Thanks for posting..

  70. This article is very helpful and well explained. Thanks

  71. Good Artcile. it helps.. Thanks..!

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

  73. it helped me alot sir………thank u sir

  74. Very good post, easy way of understanding thank u

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

  76. nice explanation.. thiru

  77. Very Good article… Thank you..

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

  79. explanation also easy for preparing answerssssssssssss

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

  81. Superb Article !!!!!!!!!

  82. Nice Article, Much useful for a beginner

  83. Pingback: Association, Aggregation, Composition, Abstraction, Generalization, Realization, Dependecy. « knowledgepractices

  84. very good explanation on composition and aggregation relationships

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

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

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

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

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

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

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

  92. very helpful and easy 2 understand
    Thank you

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

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

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

  96. its really nice. keep going its really helps lot,


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

    Appreciate your effort….

  98. Nice Article on relationships

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

  100. Thanks guys for all your overwhelming comments and support.

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

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

  103. 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…

  104. Best article on association aggregation composition

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

  106. Thanks you very much for share good knowledge for me .

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

  108. very nice artical!!

  109. Very nice explanation about class diagram terms…

  110. Questions
    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.


  111. Questions
    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.


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

  113. Superb Explanation…Keep It Up!

  114. identify in detail association and aggregation

  115. crystal clear dude.

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

  117. @Sanchit

    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.

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

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

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

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

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

  123. its nice. very simple defnation. easy to understand.

  124. Awesome post!!!Keep it up.

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

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

    Thank you.

  127. very nice…nd thanx..

  128. 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…

  129. Awesome notes.

    Really helpful

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

  131. Simple & Clear Explanation for the beginners.


  132. this is simple way to understand any definition

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

    Thank you.

  134. easy way to understaing.

  135. Clean & clear explanation. Thanks Joe.

  136. Simplysuperb, lots of information with very simple words.

  137. really clears the confusion.

  138. Nice way of information.

  139. Really good man easy to understand

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

  141. is it nice…

    i have got some idea…

    thanks ..

  142. you have to increase the paragraph

  143. very nice explanation.

  144. neat and clear description dude…

  145. Hi.. Useful explanation and easy to understand. thankyou

  146. This is good post. thanks a lot

  147. Its really post .

    Vidhi Jain

  148. Very nice…Thanks

  149. best for beginner….like me
    thank you sir

  150. explained in very effective n simple way

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

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

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

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

  155. Thanks a lot , good explanation with easy example ..

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


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

  158. thanks. great for beginners

  159. Thanks It helps to clear my fundamental

  160. all clear ………very gud job !!!!

  161. its really very usefull and understandable

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

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

  164. Very good explanation. Thank you

  165. thanku its very easy to understand and very easy explanation

  166. thanq so much….its very nice …

  167. please explain more sir,with example..

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

  169. nice explanation. very useful. thanks

  170. very nice explanation

  171. Nice explanation of the terms…

  172. nice definitions :)

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

  174. very nice explanation! keep it up

  175. very nice explanation! keep it up

  176. Goog Explanation. Keep going….

  177. thanks this really gives the clarity of this topic

  178. Thanks you very much yar

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

  180. Thanks this helps !

  181. pls write about specialization also

  182. very nice………
    thank u so much

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

  184. One of good artical and understandable.

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

  186. GOOD and NICE and SIMPLE Explanation……..

  187. Thanks for your inputs

  188. good site thanks

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

  190. the content is really very good..

  191. nice information thank u logical examples have been provided

  192. Really useful for beginners.

  193. good information and very useful to the beginners .


  194. Good Information..

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

    Krs Rajasekhar

  195. Good Information..

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

    Krs Rajasekhar

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

  197. Nice explanation yaar

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

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

  200. Simple and very clear to understud thaks

  201. Woow..very Nicely explained…

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

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

  204. Thankyou… nice article.

  205. Clean and clear explanation. Thanks a lot.

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

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

  208. nice explanation..

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

  210. Nice and very helpful Article….

  211. Thank you… nicely explained..!

  212. nice simple article

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

  214. Thanks
    Nicely Explained

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

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

  217. very nice.. Thanks….

  218. Very good explaination

  219. good loooking web site sir…

  220. thanks ..this is very good artical

  221. help me alot….thks

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

    Thanks in advance


  223. Thanks for your good job…

  224. good explaination joe, thanks

  225. good explaination joe, thanks

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

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

  228. good answer and example

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

    keep it up !!

  230. very nice content to start

  231. Hi Joseph,

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

    Thank you so much.

  232. really nice to see this site…

  233. very lucid and helpful. thank you.

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

  235. I Think U are right Hikmat.

  236. Good Article worth Reading. Nice Job!!!

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


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

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

  240. Could you please share with java code examples.

    A implements B is realization
    A extends B is generalization

    AM I right?

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

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

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

  244. Clear explanation with simplicity!

  245. Really a useful stuff to understand object relation ship.

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

  247. very helpful and easy understanding

  248. it’s really good artical…..

  249. hii thanks for information
    kamal gaba

  250. excellent clarified wit d example

  251. Simply superb
    Thank You

  252. very nice it help me for my next interview :)

  253. clearly understand, very good writing. Thank you.

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

  255. Easy to understand. Nicely presented.

  256. excellent and simple language use for examples
    Tusshar Kavthekar

  257. thank u …………

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

  259. bhiya tussi to cha gaye…

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

    Thanks Kausik

  261. Thanks a lot for great article and your efforts.

  262. Nice,Its easy to understand

  263. thank you sir……….

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

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

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

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

  268. thank u very much for u r clear explanation..

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

  270. Its very straight forward information and clear

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

  272. pls give example also…

  273. please explain with examples….

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

  275. unclear definitions

  276. i want full details about the relaitonship between objects

  277. Short and clear thanks for the detailsBharath

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

  279. It is most simple and very clear,


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

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

    Thanking you

    Vinyas A M

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

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

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

  285. nice explanation joe…

  286. i need more elobration with respect to the programs

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

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

  289. nice elaboration and nice website design

  290. thank you joe..
    very much helpful..

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

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

  293. very good explanation thanks…………..

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

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

  296. good article for basics

  297. Very Nice and easy explanation.

    Thanks Joe.

  298. superbly explained.. :)

  299. Thanks Joe it really helps…. simple and effective.

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

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

    Your blog is good and informative.

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

  303. hello sir
    very nice article

  304. Thanks sir..
    Very nice article..

    pooja agrawal 29 August 2012

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

  306. very nice!!!! thanks.

  307. Very Nice Definitions

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

  309. Specialization is missing

  310. very good explaination and better diagram understand.

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

    Really useful for beginners.

  312. this is excellent explanation..

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

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

  315. nice post…keep up the good work…

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

  317. thanks a lot its awsome

  318. Very ease to understand…. :)

  319. Precisely written. Useful, easy to read and understand.

  320. simple to understand…with real life egg

  321. Its really very easy to understand.. Thanks a lot

  322. such a nice information .it will help everyone..

  323. thanks for this

  324. thank you very much!!!!

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

  325. It very understandable.


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

  327. good explanation…….

  328. Clean and Clear explanation….Appreciate it.

  329. Thank you

    it was very useful for me

  330. Very helpful and easy t understand

  331. Very helpful and easy to understand.

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

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

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

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

  336. Thanks.:) Clearcut definitions. :)

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

    Nice work ..

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

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

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

    • Thanks for your comments.

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

  340. understanding made simpler

  341. Clear explanations and examples :)

  342. Thank you so muchHHHHHHHHHHH sir :-) :-)

  343. thank u sir very clearly explained

  344. Good Explanation.

    Thank you

  345. great work very simple and strong example.Keep it up

  346. easy to understand

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

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

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

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

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

  352. very nice and interesting article, very much appreciated.

  353. nice explaination,thanks’

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

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

  356. Very helpful. Thank you

  357. 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…

  358. it was really heipful

  359. bundle of thanks. its very helping

  360. very helping and good examples. good explaination.

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

  362. Really good article , thanks a lot.

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

  363. Nice explainations….really nice…thnks a lot

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

  365. Can u please explain about abstraction and encapsulation oops concepts

  366. And also about the four types of drivers in jdbc briefly

  367. Hi Joe,

    Really nice explaination………

  368. Hi Joe,

    Really nice explaination………

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

  370. Thanks Joe…. Wonderfull articles

  371. its really very helpful ,thanks so much :)

  372. its great thanks

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

  374. in ooad(Object Oriented Analysis Design and UML)

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

    plz send ans

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

  376. Great job joe.. awesome explanation :)

  377. Kudos for keeping the explanation so simplistic.

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

    regards shital

  379. Really it’s very helpful. Examples clears the concept

  380. its a useful information…thanks

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

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

    • Association: uses a
      Aggregation: has a : strong association
      Composition: owns a : weak association
      Inheritance: is a

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

  384. Its very clear explanation,please provide some code examples

  385. what do u mean by links in java???

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

  387. Thanx,
    It’s really nice
    i cleared my dought…..

  388. thank you very much , it was really interested explanation

  389. good explanation!!

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

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


  392. Its crispy and understandable.thnk u!!!

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

  394. Hello,

    What is Difference between Association and Dependency ?

  395. Nice Tutorials.. easy to understand

  396. Very easy to get , and to the point .

  397. Great Article…
    Very nicely explained

  398. Simple & excellent explanation

  399. Pingback: Java Encapsulation

  400. Pingback: Decorator Design Pattern