SlideShare a Scribd company logo
Disclaimer:This presentation is prepared by trainees of
baabtra as a part of mentoring program. This is not official
document of baabtra –Mentoring Partner
Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt .
Ltd
Association aggregation and
        composition


           Jithin Mathew
           jitmat@gmail.com
           www.facebook.com/jithinmatthew
They are the relationships among classes in
java
– Association
– Aggregation
– Composition
Association
• It 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.
Association represents a general binary relationship
that describes an activity between two classes
Another example for Association

• Let’s take an example of Teacher and Student.
  Multiple students can associate with single
  teacher and single student can associate with
  multiple teachers but there is no ownership
  between the objects and both have their own
  lifecycle. Both can create and delete
  independently.
Aggregation
• It 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.
• It is also called ‘Has-a’ relationship.
Note:
 If you delete the parent object, even then the
 child object may exist. One object can contain
 the other, but there is no restriction that the
 composed object has to exist in order to
 have existence of child object.
Examples for aggregation
• Take an example of Departments and developers. A developer
  can be only in one department like dotnet, java etc. but if we
  delete the Department object, still the Developer object
  exists. This is a “Has- a” relation.

• Let’s take another example of Department and teacher. A
  single teacher can not belongs to multiple departments, but if
  we delete the department teacher object will not destroy.
Composition
• It 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 for composition
• 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.
Another Example
• The relation between a car and a tyre is an
  aggregation because the tyre is still a tyre if it
  is not attached to a car. The tyre has a life of
  its own. It exists outside of a car and you can
  use it on another car.
• The relation between a car and a carburetor is
  a composition because the carburetor has no
  use if it is out of a car.
Video link:
You can refer more about this topic
  https://www.youtube.com/watch?v=0po_wm
  SEW1Q
Thank
you

More Related Content

What's hot

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
Organized and disorganized complexity
Organized and disorganized complexityOrganized and disorganized complexity
Organized and disorganized complexity
Vostrikov Arkady
 
Object and class relationships
Object and class relationshipsObject and class relationships
Object and class relationshipsPooja mittal
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMSkoolkampus
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
Taher Barodawala
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in javaTech_MX
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
RahulAnanda1
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
madhav bansal
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
Sudarsun Santhiappan
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
Rahul Narang
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
Temesgenthanks
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
Janki Shah
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
Chirag vasava
 
Java threads
Java threadsJava threads
Java threads
Prabhakaran V M
 
Generalization and specialization
Generalization and specializationGeneralization and specialization
Generalization and specialization
Knowledge Center Computer
 
Files in java
Files in javaFiles in java
Data abstraction in DBMS
Data abstraction in DBMSData abstraction in DBMS
Data abstraction in DBMS
Papan Sarkar
 
Object diagram
Object diagramObject diagram
Object diagram
Rahul Pola
 

What's hot (20)

15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Organized and disorganized complexity
Organized and disorganized complexityOrganized and disorganized complexity
Organized and disorganized complexity
 
Object and class relationships
Object and class relationshipsObject and class relationships
Object and class relationships
 
12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS12. Indexing and Hashing in DBMS
12. Indexing and Hashing in DBMS
 
Threads in JAVA
Threads in JAVAThreads in JAVA
Threads in JAVA
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Inheritance in java
Inheritance in javaInheritance in java
Inheritance in java
 
Integrity Constraints
Integrity ConstraintsIntegrity Constraints
Integrity Constraints
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
View of data DBMS
View of data DBMSView of data DBMS
View of data DBMS
 
Object oriented database concepts
Object oriented database conceptsObject oriented database concepts
Object oriented database concepts
 
Concurrency Control in Database Management System
Concurrency Control in Database Management SystemConcurrency Control in Database Management System
Concurrency Control in Database Management System
 
Dbms relational model
Dbms relational modelDbms relational model
Dbms relational model
 
Java threads
Java threadsJava threads
Java threads
 
Generalization and specialization
Generalization and specializationGeneralization and specialization
Generalization and specialization
 
Entity relationship modelling
Entity relationship modellingEntity relationship modelling
Entity relationship modelling
 
Files in java
Files in javaFiles in java
Files in java
 
Data abstraction in DBMS
Data abstraction in DBMSData abstraction in DBMS
Data abstraction in DBMS
 
Object diagram
Object diagramObject diagram
Object diagram
 

Similar to Association agggregation and composition

Aggregation
AggregationAggregation
Aggregation
zindadili
 
UML constructs
UML constructs UML constructs
UML constructs
Dawood Faheem Abbasi
 
Chapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their RelationshipsChapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their Relationships
It Academy
 
Unit iv dbms
Unit   iv dbmsUnit   iv dbms
Unit iv dbms
Arnav Chowdhury
 
Ict portfolio Michael Jacobs
Ict portfolio Michael JacobsIct portfolio Michael Jacobs
Ict portfolio Michael Jacobs
Michaeljay15
 
How can blogging improve the quality of sentence structure
How can blogging improve the quality of sentence structureHow can blogging improve the quality of sentence structure
How can blogging improve the quality of sentence structure
Jessica Miller
 
Object oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh UpadhyayObject oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh Upadhyay
Saurabh Upadhyay
 
cognitive process
cognitive processcognitive process
cognitive process
marierosemadrigal
 
Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...
Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...
Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...
Karel Van Isacker
 
cse 355 UML class diagram software engineering.ppt
cse 355 UML class diagram software engineering.pptcse 355 UML class diagram software engineering.ppt
cse 355 UML class diagram software engineering.ppt
Safaet Hossain
 
UML-class_diagram.ppt
UML-class_diagram.pptUML-class_diagram.ppt
UML-class_diagram.ppt
PragnyaNandaSabat
 
UML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.pptUML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.ppt
WorkDrive2
 
Design pattern - part 1
Design pattern - part 1Design pattern - part 1
Design pattern - part 1
Muhammad Yassein
 
Articles Powerpoint
Articles PowerpointArticles Powerpoint
Articles Powerpointguestebac70
 
Articles Powerpoint
Articles PowerpointArticles Powerpoint
Articles Powerpointguestebac70
 
Blended Reading Using Collaborative Online Annotation
Blended Reading Using Collaborative Online AnnotationBlended Reading Using Collaborative Online Annotation
Blended Reading Using Collaborative Online Annotation
Declara, INC
 
2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program
Michael Heron
 

Similar to Association agggregation and composition (20)

Difference between association, aggregation and composition
Difference between association, aggregation and compositionDifference between association, aggregation and composition
Difference between association, aggregation and composition
 
Aggregation
AggregationAggregation
Aggregation
 
UML constructs
UML constructs UML constructs
UML constructs
 
Chapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their RelationshipsChapter 6:Working with Classes and Their Relationships
Chapter 6:Working with Classes and Their Relationships
 
Unit iv dbms
Unit   iv dbmsUnit   iv dbms
Unit iv dbms
 
Ict portfolio Michael Jacobs
Ict portfolio Michael JacobsIct portfolio Michael Jacobs
Ict portfolio Michael Jacobs
 
How can blogging improve the quality of sentence structure
How can blogging improve the quality of sentence structureHow can blogging improve the quality of sentence structure
How can blogging improve the quality of sentence structure
 
Object oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh UpadhyayObject oriented programming concept- Saurabh Upadhyay
Object oriented programming concept- Saurabh Upadhyay
 
cognitive process
cognitive processcognitive process
cognitive process
 
Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...
Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...
Implementing a Robot-Based Pedagogy in the Classroom: Initial Results from St...
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
cse 355 UML class diagram software engineering.ppt
cse 355 UML class diagram software engineering.pptcse 355 UML class diagram software engineering.ppt
cse 355 UML class diagram software engineering.ppt
 
UML-class_diagram.ppt
UML-class_diagram.pptUML-class_diagram.ppt
UML-class_diagram.ppt
 
UML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.pptUML-class diagram for beginners to adance.ppt
UML-class diagram for beginners to adance.ppt
 
W200 Powerpoint
W200 PowerpointW200 Powerpoint
W200 Powerpoint
 
Design pattern - part 1
Design pattern - part 1Design pattern - part 1
Design pattern - part 1
 
Articles Powerpoint
Articles PowerpointArticles Powerpoint
Articles Powerpoint
 
Articles Powerpoint
Articles PowerpointArticles Powerpoint
Articles Powerpoint
 
Blended Reading Using Collaborative Online Annotation
Blended Reading Using Collaborative Online AnnotationBlended Reading Using Collaborative Online Annotation
Blended Reading Using Collaborative Online Annotation
 
2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program
 

More from baabtra.com - No. 1 supplier of quality freshers

Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
baabtra.com - No. 1 supplier of quality freshers
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
baabtra.com - No. 1 supplier of quality freshers
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
baabtra.com - No. 1 supplier of quality freshers
 
Php database connectivity
Php database connectivityPhp database connectivity
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
baabtra.com - No. 1 supplier of quality freshers
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
baabtra.com - No. 1 supplier of quality freshers
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Blue brain
Blue brainBlue brain
5g
5g5g
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra

More from baabtra.com - No. 1 supplier of quality freshers (20)

Agile methodology and scrum development
Agile methodology and scrum developmentAgile methodology and scrum development
Agile methodology and scrum development
 
Best coding practices
Best coding practicesBest coding practices
Best coding practices
 
Core java - baabtra
Core java - baabtraCore java - baabtra
Core java - baabtra
 
Acquiring new skills what you should know
Acquiring new skills   what you should knowAcquiring new skills   what you should know
Acquiring new skills what you should know
 
Baabtra.com programming at school
Baabtra.com programming at schoolBaabtra.com programming at school
Baabtra.com programming at school
 
99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love 99LMS for Enterprises - LMS that you will love
99LMS for Enterprises - LMS that you will love
 
Php sessions & cookies
Php sessions & cookiesPhp sessions & cookies
Php sessions & cookies
 
Php database connectivity
Php database connectivityPhp database connectivity
Php database connectivity
 
Chapter 6 database normalisation
Chapter 6  database normalisationChapter 6  database normalisation
Chapter 6 database normalisation
 
Chapter 5 transactions and dcl statements
Chapter 5  transactions and dcl statementsChapter 5  transactions and dcl statements
Chapter 5 transactions and dcl statements
 
Chapter 4 functions, views, indexing
Chapter 4  functions, views, indexingChapter 4  functions, views, indexing
Chapter 4 functions, views, indexing
 
Chapter 3 stored procedures
Chapter 3 stored proceduresChapter 3 stored procedures
Chapter 3 stored procedures
 
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
Chapter 2  grouping,scalar and aggergate functions,joins   inner join,outer joinChapter 2  grouping,scalar and aggergate functions,joins   inner join,outer join
Chapter 2 grouping,scalar and aggergate functions,joins inner join,outer join
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Chapter 1 introduction to sql server
Chapter 1 introduction to sql serverChapter 1 introduction to sql server
Chapter 1 introduction to sql server
 
Microsoft holo lens
Microsoft holo lensMicrosoft holo lens
Microsoft holo lens
 
Blue brain
Blue brainBlue brain
Blue brain
 
5g
5g5g
5g
 
Aptitude skills baabtra
Aptitude skills baabtraAptitude skills baabtra
Aptitude skills baabtra
 
Gd baabtra
Gd baabtraGd baabtra
Gd baabtra
 

Association agggregation and composition

  • 1.
  • 2. Disclaimer:This presentation is prepared by trainees of baabtra as a part of mentoring program. This is not official document of baabtra –Mentoring Partner Baabtra-Mentoring Partner is the mentoring division of baabte System Technologies Pvt . Ltd
  • 3. Association aggregation and composition Jithin Mathew jitmat@gmail.com www.facebook.com/jithinmatthew
  • 4. They are the relationships among classes in java – Association – Aggregation – Composition
  • 5. Association • It 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.
  • 6. Association represents a general binary relationship that describes an activity between two classes
  • 7. Another example for Association • Let’s take an example of Teacher and Student. Multiple students can associate with single teacher and single student can associate with multiple teachers but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently.
  • 8. Aggregation • It 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. • It is also called ‘Has-a’ relationship.
  • 9. Note: If you delete the parent object, even then the child object may exist. One object can contain the other, but there is no restriction that the composed object has to exist in order to have existence of child object.
  • 10. Examples for aggregation • Take an example of Departments and developers. A developer can be only in one department like dotnet, java etc. but if we delete the Department object, still the Developer object exists. This is a “Has- a” relation. • Let’s take another example of Department and teacher. A single teacher can not belongs to multiple departments, but if we delete the department teacher object will not destroy.
  • 11. Composition • It 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.
  • 12. Example for composition • A class contains students. A student cannot exist without a class. There exists composition between class and students.
  • 13. 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.
  • 14. • 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.
  • 15. 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.
  • 16. Another Example • The relation between a car and a tyre is an aggregation because the tyre is still a tyre if it is not attached to a car. The tyre has a life of its own. It exists outside of a car and you can use it on another car. • The relation between a car and a carburetor is a composition because the carburetor has no use if it is out of a car.
  • 17.
  • 18. Video link: You can refer more about this topic https://www.youtube.com/watch?v=0po_wm SEW1Q