SlideShare a Scribd company logo
Lecture – 9
UML Basics: Inheritance, Association,
Aggregation and Composition
Lecturer
Department of CSE
Daffodil International University
Contents
2
•UML Basics
- Generalization (Inheritance) – IS-A Relationship
- Association
- Aggregation
- Composition
– HAS-A Relationship
• A generalization is a taxonomic relationship between a more general
classifier and a more specific classifier.
• Represents an "is-a" relationship.
• SubClass1 and SubClass2 are specializations of SuperClass.
Topic - 1 : Inheritance (Generalization)
3
IS-A relationship
4
Bank
DBBL
extends
Super // Generalization
Sub // Specialization
Human
Boy
extends
• Relationship between two separate classes which establishes through their
Objects. .
• Also known as “has-a" relationship.
• Each class is independent. They can exist without each other.
Topic - 2 : Association
5
Course Teacher
Customer Product
buy
s
has
• Unary Association: Class A has Class B; But Class B does not have Class A
• Binary Association: Both Classes know about each other.
6
A B
has Customer Product
buys
Two types of Association
A B
has Student Teacher
has
Unary Association and Binary Association
1. Unary Association
Customer Product
>
Two types of Association
7
Customer Class will have the object of Product
buys
Unary Association and Binary Association
2. Binary Association
Two types of Association
Student Teacher
8
Unary Association and Binary Association
2. Binary Association (Solved by Association Class)
Two types of Association
Student Teacher
Student Teacher
AssociationClass
9
Topic - 3 : Aggregation and Composition
[Whole/Part Relationship]
10
• Specified form of Association
• Whole/Part Relationship
• Class B is a part of Class A.
• Both Classes are independent. Part class can exist without Whole Class.
11
A B
3.1: Aggregation
Whole Part
Car Engine
Whole Part
• Specified (Stronger) form of Association
• Whole/Part Relationship
• Class B is a part of Class A.
• The existence of Part class depends on Whole Class.
12
A B
3.2: Composition
Whole Part
Car Window
Whole Part
House Kitchen
We see the following relationships:
• owners feed pets, pets please owners
(Association)
• a tail is a part of both dogs
(Aggregation / Composition)
• a dog is a kind of pet
(Inheritance / Generalization)
13
The figure below shows the three types of association connectors:
association, aggregation and composition
Inheritance
14
UML Notation
Example - 1
15
Example – 2: Description to UML
• Volvo is a Car.
• Every car has model and company of type string.
• Volvo has price of type double, productionYear and registrationNumber of type string.
• Volvo also has Engine and DashBoard.
• Engine has capacity of type double.
• DashBoard has size of type double.
• Car provides drive and stop as abstract service or method of type void.
• Volvo also provides changeFuel and checkBattery service or method of type void.
16
Example – 2: Description to UML
• Volvo is a Car.
• Every car has model and company of type string.
• Volvo has price of type double, productionYear and registrationNumber of type
string.
• Volvo also has Engine and DashBoard.
• Engine has capacity of type double.
• DashBoard has size of type double.
• Car provides drive and stop as abstract service or method of type void.
• Volvo also provides changeFuel and checkBattery service or method of type void.
17
Car
Volvo
Solution of Example – 2: Description to UML
Engine
18
DashBoard
• Volvo is a Car.
• Every car has model and company of
type string.
• Volvo has price of type double,
productionYear and
registrationNumber of type string.
• Volvo also has Engine and
DashBoard.
• Engine has capacity of type double.
• DashBoard has size of type double.
• Car provides drive and stop as
abstract service or method of type
void.
• Volvo also provides changeFuel and
checkBattery service or method of
type void.
- price: double
- productionYear: String
- registrationNumber: String
#model : String
#company: String
-capacity : double
-size : double
+ drive () : void
+ stop () : void
+ changeFuel() : void
+checkBattery () : void
Car
Volvo
Solution of Example – 2: Description to UML
Engine
19
DashBoard
• Volvo is a Car.
• Every car has model and company of
type string.
• Volvo has price of type double,
productionYear and
registrationNumber of type string.
• Volvo also has Engine and
DashBoard.
• Engine has capacity of type double.
• DashBoard has size of type double.
• Car provides drive and stop as
abstract service or method of type
void.
• Volvo also provides changeFuel and
checkBattery service or method of
type void.
- price: double
- productionYear: String
- registrationNumber: String
#model : String
#company: String
-capacity : double
-size : double
+ drive () : void
+ stop () : void
+ changeFuel() : void
+checkBattery () : void
Example – 3: Try Yourself
20
• Apple is a fruit
• Apple has color and origin
• Apple has Sticker
• Sticker has logo
Thank you!
21

More Related Content

What's hot

DBTG MODEL
DBTG MODELDBTG MODEL
DBTG MODEL
Ramkrishna bhagat
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
sonalikharade3
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
VMahesh5
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
Vajira Thambawita
 
Servlets
ServletsServlets
Servlets
ZainabNoorGul
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer services
Melvin Cabatuan
 
Shared memory
Shared memoryShared memory
Shared memory
Abhishek Khune
 
Multithreading Presentation
Multithreading PresentationMultithreading Presentation
Multithreading Presentation
Neeraj Kaushik
 
IP Multicasting
IP MulticastingIP Multicasting
IP Multicasting
Tharindu Kumara
 
Osi reference model
Osi reference modelOsi reference model
Osi reference model
vasanthimuniasamy
 
Parallel processing
Parallel processingParallel processing
Parallel processing
Syed Zaid Irshad
 
Context Switching
Context SwitchingContext Switching
Context Switching
franksvalli
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread Synchronization
Benj Del Mundo
 
Physical organization of parallel platforms
Physical organization of parallel platformsPhysical organization of parallel platforms
Physical organization of parallel platforms
Syed Zaid Irshad
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Tushar B Kute
 
IPv4 Addressing
 IPv4 Addressing   IPv4 Addressing
IPv4 Addressing
TheGodfather HA
 
Database architecture
Database architectureDatabase architecture
Database architecture
VENNILAV6
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
Vaishali Modi
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
Manish Kumar
 
Telnet
TelnetTelnet

What's hot (20)

DBTG MODEL
DBTG MODELDBTG MODEL
DBTG MODEL
 
Linker and Loader
Linker and Loader Linker and Loader
Linker and Loader
 
Servlet.ppt
Servlet.pptServlet.ppt
Servlet.ppt
 
Lecture 1 introduction to parallel and distributed computing
Lecture 1   introduction to parallel and distributed computingLecture 1   introduction to parallel and distributed computing
Lecture 1 introduction to parallel and distributed computing
 
Servlets
ServletsServlets
Servlets
 
Transport layer services
Transport layer servicesTransport layer services
Transport layer services
 
Shared memory
Shared memoryShared memory
Shared memory
 
Multithreading Presentation
Multithreading PresentationMultithreading Presentation
Multithreading Presentation
 
IP Multicasting
IP MulticastingIP Multicasting
IP Multicasting
 
Osi reference model
Osi reference modelOsi reference model
Osi reference model
 
Parallel processing
Parallel processingParallel processing
Parallel processing
 
Context Switching
Context SwitchingContext Switching
Context Switching
 
Java Thread Synchronization
Java Thread SynchronizationJava Thread Synchronization
Java Thread Synchronization
 
Physical organization of parallel platforms
Physical organization of parallel platformsPhysical organization of parallel platforms
Physical organization of parallel platforms
 
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B KuteChapter 02: Classes Objects and Methods Java by Tushar B Kute
Chapter 02: Classes Objects and Methods Java by Tushar B Kute
 
IPv4 Addressing
 IPv4 Addressing   IPv4 Addressing
IPv4 Addressing
 
Database architecture
Database architectureDatabase architecture
Database architecture
 
Java database connectivity
Java database connectivityJava database connectivity
Java database connectivity
 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
 
Telnet
TelnetTelnet
Telnet
 

More from ShahinAhmed49

BDBO Presentation.pptx
BDBO Presentation.pptxBDBO Presentation.pptx
BDBO Presentation.pptx
ShahinAhmed49
 
Lecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxLecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptx
ShahinAhmed49
 
presentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptxpresentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptx
ShahinAhmed49
 
Presentation-10.pptx
Presentation-10.pptxPresentation-10.pptx
Presentation-10.pptx
ShahinAhmed49
 
Lecture_4-Class and Object.pptx
Lecture_4-Class and Object.pptxLecture_4-Class and Object.pptx
Lecture_4-Class and Object.pptx
ShahinAhmed49
 
presentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptxpresentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptx
ShahinAhmed49
 
Data (2).pptx
Data (2).pptxData (2).pptx
Data (2).pptx
ShahinAhmed49
 
Lecture_3.5-Array_Type Conversion_Math Class.pptx
Lecture_3.5-Array_Type Conversion_Math Class.pptxLecture_3.5-Array_Type Conversion_Math Class.pptx
Lecture_3.5-Array_Type Conversion_Math Class.pptx
ShahinAhmed49
 
Sentence Fragments(AA).pptx
Sentence Fragments(AA).pptxSentence Fragments(AA).pptx
Sentence Fragments(AA).pptx
ShahinAhmed49
 

More from ShahinAhmed49 (9)

BDBO Presentation.pptx
BDBO Presentation.pptxBDBO Presentation.pptx
BDBO Presentation.pptx
 
Lecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptxLecture_7-Encapsulation in Java.pptx
Lecture_7-Encapsulation in Java.pptx
 
presentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptxpresentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptx
 
Presentation-10.pptx
Presentation-10.pptxPresentation-10.pptx
Presentation-10.pptx
 
Lecture_4-Class and Object.pptx
Lecture_4-Class and Object.pptxLecture_4-Class and Object.pptx
Lecture_4-Class and Object.pptx
 
presentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptxpresentationonanalogtransmission-210806163622.pptx
presentationonanalogtransmission-210806163622.pptx
 
Data (2).pptx
Data (2).pptxData (2).pptx
Data (2).pptx
 
Lecture_3.5-Array_Type Conversion_Math Class.pptx
Lecture_3.5-Array_Type Conversion_Math Class.pptxLecture_3.5-Array_Type Conversion_Math Class.pptx
Lecture_3.5-Array_Type Conversion_Math Class.pptx
 
Sentence Fragments(AA).pptx
Sentence Fragments(AA).pptxSentence Fragments(AA).pptx
Sentence Fragments(AA).pptx
 

Recently uploaded

CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
rpskprasana
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
wisnuprabawa3
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
ClaraZara1
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
MDSABBIROJJAMANPAYEL
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
Rahul
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
Madan Karki
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
IJECEIAES
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
SUTEJAS
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
IJNSA Journal
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
IJECEIAES
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
Mukeshwaran Balu
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
NidhalKahouli2
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
PauloRodrigues104553
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
IJECEIAES
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
mahammadsalmanmech
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
gerogepatton
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Christina Lin
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
PuktoonEngr
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
Aditya Rajan Patra
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
awadeshbabu
 

Recently uploaded (20)

CSM Cloud Service Management Presentarion
CSM Cloud Service Management PresentarionCSM Cloud Service Management Presentarion
CSM Cloud Service Management Presentarion
 
New techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdfNew techniques for characterising damage in rock slopes.pdf
New techniques for characterising damage in rock slopes.pdf
 
6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)6th International Conference on Machine Learning & Applications (CMLA 2024)
6th International Conference on Machine Learning & Applications (CMLA 2024)
 
Properties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptxProperties Railway Sleepers and Test.pptx
Properties Railway Sleepers and Test.pptx
 
ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024ACEP Magazine edition 4th launched on 05.06.2024
ACEP Magazine edition 4th launched on 05.06.2024
 
spirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptxspirit beverages ppt without graphics.pptx
spirit beverages ppt without graphics.pptx
 
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
Electric vehicle and photovoltaic advanced roles in enhancing the financial p...
 
Understanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine LearningUnderstanding Inductive Bias in Machine Learning
Understanding Inductive Bias in Machine Learning
 
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMSA SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
A SYSTEMATIC RISK ASSESSMENT APPROACH FOR SECURING THE SMART IRRIGATION SYSTEMS
 
Embedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoringEmbedded machine learning-based road conditions and driving behavior monitoring
Embedded machine learning-based road conditions and driving behavior monitoring
 
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
ACRP 4-09 Risk Assessment Method to Support Modification of Airfield Separat...
 
basic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdfbasic-wireline-operations-course-mahmoud-f-radwan.pdf
basic-wireline-operations-course-mahmoud-f-radwan.pdf
 
Series of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.pptSeries of visio cisco devices Cisco_Icons.ppt
Series of visio cisco devices Cisco_Icons.ppt
 
Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...Advanced control scheme of doubly fed induction generator for wind turbine us...
Advanced control scheme of doubly fed induction generator for wind turbine us...
 
Question paper of renewable energy sources
Question paper of renewable energy sourcesQuestion paper of renewable energy sources
Question paper of renewable energy sources
 
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODELDEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
DEEP LEARNING FOR SMART GRID INTRUSION DETECTION: A HYBRID CNN-LSTM-BASED MODEL
 
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming PipelinesHarnessing WebAssembly for Real-time Stateless Streaming Pipelines
Harnessing WebAssembly for Real-time Stateless Streaming Pipelines
 
2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt2. Operations Strategy in a Global Environment.ppt
2. Operations Strategy in a Global Environment.ppt
 
Recycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part IIIRecycled Concrete Aggregate in Construction Part III
Recycled Concrete Aggregate in Construction Part III
 
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
[JPP-1] - (JEE 3.0) - Kinematics 1D - 14th May..pdf
 

Lecture_9-UML Basics_Inheritance_Association, Aggregation, Composition.pptx

  • 1. Lecture – 9 UML Basics: Inheritance, Association, Aggregation and Composition Lecturer Department of CSE Daffodil International University
  • 2. Contents 2 •UML Basics - Generalization (Inheritance) – IS-A Relationship - Association - Aggregation - Composition – HAS-A Relationship
  • 3. • A generalization is a taxonomic relationship between a more general classifier and a more specific classifier. • Represents an "is-a" relationship. • SubClass1 and SubClass2 are specializations of SuperClass. Topic - 1 : Inheritance (Generalization) 3
  • 4. IS-A relationship 4 Bank DBBL extends Super // Generalization Sub // Specialization Human Boy extends
  • 5. • Relationship between two separate classes which establishes through their Objects. . • Also known as “has-a" relationship. • Each class is independent. They can exist without each other. Topic - 2 : Association 5 Course Teacher Customer Product buy s has
  • 6. • Unary Association: Class A has Class B; But Class B does not have Class A • Binary Association: Both Classes know about each other. 6 A B has Customer Product buys Two types of Association A B has Student Teacher has
  • 7. Unary Association and Binary Association 1. Unary Association Customer Product > Two types of Association 7 Customer Class will have the object of Product buys
  • 8. Unary Association and Binary Association 2. Binary Association Two types of Association Student Teacher 8
  • 9. Unary Association and Binary Association 2. Binary Association (Solved by Association Class) Two types of Association Student Teacher Student Teacher AssociationClass 9
  • 10. Topic - 3 : Aggregation and Composition [Whole/Part Relationship] 10
  • 11. • Specified form of Association • Whole/Part Relationship • Class B is a part of Class A. • Both Classes are independent. Part class can exist without Whole Class. 11 A B 3.1: Aggregation Whole Part Car Engine Whole Part
  • 12. • Specified (Stronger) form of Association • Whole/Part Relationship • Class B is a part of Class A. • The existence of Part class depends on Whole Class. 12 A B 3.2: Composition Whole Part Car Window Whole Part House Kitchen
  • 13. We see the following relationships: • owners feed pets, pets please owners (Association) • a tail is a part of both dogs (Aggregation / Composition) • a dog is a kind of pet (Inheritance / Generalization) 13 The figure below shows the three types of association connectors: association, aggregation and composition
  • 16. Example – 2: Description to UML • Volvo is a Car. • Every car has model and company of type string. • Volvo has price of type double, productionYear and registrationNumber of type string. • Volvo also has Engine and DashBoard. • Engine has capacity of type double. • DashBoard has size of type double. • Car provides drive and stop as abstract service or method of type void. • Volvo also provides changeFuel and checkBattery service or method of type void. 16
  • 17. Example – 2: Description to UML • Volvo is a Car. • Every car has model and company of type string. • Volvo has price of type double, productionYear and registrationNumber of type string. • Volvo also has Engine and DashBoard. • Engine has capacity of type double. • DashBoard has size of type double. • Car provides drive and stop as abstract service or method of type void. • Volvo also provides changeFuel and checkBattery service or method of type void. 17
  • 18. Car Volvo Solution of Example – 2: Description to UML Engine 18 DashBoard • Volvo is a Car. • Every car has model and company of type string. • Volvo has price of type double, productionYear and registrationNumber of type string. • Volvo also has Engine and DashBoard. • Engine has capacity of type double. • DashBoard has size of type double. • Car provides drive and stop as abstract service or method of type void. • Volvo also provides changeFuel and checkBattery service or method of type void. - price: double - productionYear: String - registrationNumber: String #model : String #company: String -capacity : double -size : double + drive () : void + stop () : void + changeFuel() : void +checkBattery () : void
  • 19. Car Volvo Solution of Example – 2: Description to UML Engine 19 DashBoard • Volvo is a Car. • Every car has model and company of type string. • Volvo has price of type double, productionYear and registrationNumber of type string. • Volvo also has Engine and DashBoard. • Engine has capacity of type double. • DashBoard has size of type double. • Car provides drive and stop as abstract service or method of type void. • Volvo also provides changeFuel and checkBattery service or method of type void. - price: double - productionYear: String - registrationNumber: String #model : String #company: String -capacity : double -size : double + drive () : void + stop () : void + changeFuel() : void +checkBattery () : void
  • 20. Example – 3: Try Yourself 20 • Apple is a fruit • Apple has color and origin • Apple has Sticker • Sticker has logo