SlideShare una empresa de Scribd logo
1 de 18
2
A CLASS is a template (specification, blueprint)
for a collection of objects that share a common
set of attributes and operations.
Health Club Member
Class
Objects
attributes
operations
Defining Class
UML Class Diagrams 3
What is a Class Diagram?
•A Class Diagram is a diagram describing the
structure of a system shows the system's
•classes
•Attributes
•operations (or methods),
•Relationships among the classes.
4
1 of 2
UML Class Diagram Notation
Class
Member
memberNumber
firstName
lastName
telephone
address
city
etc...
checkOutVideo
checkInVideo
buyItem
etc...
attributes
operations
{
{
Expanded view of a
Class into its three
sections:
Top: Class Name
Middle: attributes
Bottom: operations
5
2 of 2
Object Association
n n
Class
Generalization
Relationship
Object
Aggregation
Association
0..*
1..*
Object Composition
Association
0..*
1
Will always be “1”
UML Class Diagram Notation
UML Class Diagrams 6
Essential Elements of a
UML Class Diagram
Class
Attributes
Operations
Relationships
7
Association
Aggregation/Compostion
Dependencies
Generalization
Realization
8
Associations
An association between two classes describes connection
among them.
If the association is between two classes then it is called
binary association.
There can be association among more than two classes.
It is represented by a solid line.
Example: “An Employee works for a Company”
Employee Company
9
Class A Class B
role A
role B
Company Person
Employer
Employee
Example:
Associations
10
Aggregation & Composition
•Aggregation (shared aggregation):
• is a specialized form of ASSOCIATION in which a whole is
related to its part(s).
• is known as a “part of” or containment relationship and follows
the “has a” heuristic
• three ways to think about aggregations:
• whole-parts
• container-contents
• group-members
• Composition (composite aggregation):
• is a stronger version of AGGREGATION
• the “part(s)” may belong to only ONE whole
• the part(s) are usually expected to “live” and “die” with the whole
(“cascading delete”)
• Aggregation vs. Composition vs. Association???
11
Aggregation Composition
0..*
1..*
Faculty
CourseTeaching
1..*
1
SalesOrder
SalesOrderLineItem
(another: hand --> finger)(another: assembly --> part)
(team-teaching is
possible)
12
Generalization
• Deriving a class out of a parent class having
some inherited property(from the parent
class) and some new property of the derived
class.
• The term generalization is for the
inheritance in the bottom to the up direction
i.e. from derived class to the parent class.
• It is represented by a solid line with a large
arrow head pointing towards the parent
class.
• Example:
13
Vehicle
Car Truck
14
Dependency
• A dependency relationship is a weaker form
of relationship. A dependency states that a
change in specification of one class may
effect another class that uses first one but
not vice versa.
• It is represented by dashed lines.
Dependent class Reference class
15
Realization
• Realization is very similar to inheritance
,the only difference between them is a class
is derived from an interface instead of a
base class.
• An interface is an abstract class.
Interface class Derived class
16
UML Class Diagrams 17
UML Class Diagrams 18

Más contenido relacionado

La actualidad más candente

Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
Haitham El-Ghareeb
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
thinkphp
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
mewaseem
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
Jafar Nesargi
 

La actualidad más candente (20)

Object Oriented Programming
Object Oriented ProgrammingObject Oriented Programming
Object Oriented Programming
 
Software design
Software designSoftware design
Software design
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
Basic concepts of object oriented programming
Basic concepts of object oriented programmingBasic concepts of object oriented programming
Basic concepts of object oriented programming
 
Use case Diagram
Use case Diagram Use case Diagram
Use case Diagram
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4
 
state modeling In UML
state modeling In UMLstate modeling In UML
state modeling In UML
 
Advanced Structural Modeling
Advanced Structural ModelingAdvanced Structural Modeling
Advanced Structural Modeling
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Unit 4
Unit 4Unit 4
Unit 4
 
Introduction to oops concepts
Introduction to oops conceptsIntroduction to oops concepts
Introduction to oops concepts
 
Object Oriented Design
Object Oriented DesignObject Oriented Design
Object Oriented Design
 
The Object Model
The Object Model  The Object Model
The Object Model
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 
Data modeling using the entity relationship model
Data modeling using the entity relationship modelData modeling using the entity relationship model
Data modeling using the entity relationship model
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Association agggregation and composition
Association agggregation and compositionAssociation agggregation and composition
Association agggregation and composition
 

Destacado

Unt 3 attributes, methods, relationships-1
Unt 3 attributes, methods, relationships-1Unt 3 attributes, methods, relationships-1
Unt 3 attributes, methods, relationships-1
gopal10scs185
 
Class and object_diagram
Class  and object_diagramClass  and object_diagram
Class and object_diagram
Sadhana28
 
Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objects
rahulsahay19
 
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
Melina Krisnawati
 
Unit 3 object analysis-classification
Unit 3 object analysis-classificationUnit 3 object analysis-classification
Unit 3 object analysis-classification
gopal10scs185
 
class and objects
class and objectsclass and objects
class and objects
Payel Guria
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
Are-u
 

Destacado (20)

Class & Object - Intro
Class & Object - IntroClass & Object - Intro
Class & Object - Intro
 
Object and class
Object and classObject and class
Object and class
 
Parallel Programming in Python: Speeding up your analysis
Parallel Programming in Python: Speeding up your analysisParallel Programming in Python: Speeding up your analysis
Parallel Programming in Python: Speeding up your analysis
 
Unt 3 attributes, methods, relationships-1
Unt 3 attributes, methods, relationships-1Unt 3 attributes, methods, relationships-1
Unt 3 attributes, methods, relationships-1
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Class and object in C++
Class and object in C++Class and object in C++
Class and object in C++
 
Class and object_diagram
Class  and object_diagramClass  and object_diagram
Class and object_diagram
 
Object modeling
Object modelingObject modeling
Object modeling
 
Case Study Uml
Case Study UmlCase Study Uml
Case Study Uml
 
Use Case diagram-UML diagram-1
Use Case diagram-UML diagram-1Use Case diagram-UML diagram-1
Use Case diagram-UML diagram-1
 
Classes And Objects
Classes And ObjectsClasses And Objects
Classes And Objects
 
Ooad
OoadOoad
Ooad
 
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
 
Unit 3 object analysis-classification
Unit 3 object analysis-classificationUnit 3 object analysis-classification
Unit 3 object analysis-classification
 
Intro to Python Programming Language
Intro to Python Programming LanguageIntro to Python Programming Language
Intro to Python Programming Language
 
class and objects
class and objectsclass and objects
class and objects
 
C++ classes
C++ classesC++ classes
C++ classes
 
Use case diagram
Use case diagramUse case diagram
Use case diagram
 
Lecture04- Use Case Diagrams
Lecture04- Use Case DiagramsLecture04- Use Case Diagrams
Lecture04- Use Case Diagrams
 
E commerce use case documentation.
E commerce use case documentation.E commerce use case documentation.
E commerce use case documentation.
 

Similar a Object and class relationships

08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagrams
kebsterz
 
Relationships and their representation in a class diagram.pptx
Relationships and their representation in a class diagram.pptxRelationships and their representation in a class diagram.pptx
Relationships and their representation in a class diagram.pptx
nesarahmad37
 
Selab1 slides
Selab1 slidesSelab1 slides
Selab1 slides
Sumedha
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class Diagram
Niloy Rocker
 

Similar a Object and class relationships (20)

Claas diagram
Claas diagramClaas diagram
Claas diagram
 
Claas diagram
Claas diagramClaas diagram
Claas diagram
 
Css uml
Css umlCss uml
Css uml
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagrams
 
Relationships and their representation in a class diagram.pptx
Relationships and their representation in a class diagram.pptxRelationships and their representation in a class diagram.pptx
Relationships and their representation in a class diagram.pptx
 
Selab1 slides
Selab1 slidesSelab1 slides
Selab1 slides
 
Software Testing and UML Lab
Software Testing and UML LabSoftware Testing and UML Lab
Software Testing and UML Lab
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
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
 
Introduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdfIntroduction to UML, a guide to learn.pdf
Introduction to UML, a guide to learn.pdf
 
A&D - UML
A&D - UMLA&D - UML
A&D - UML
 
classdiagram.pptx
classdiagram.pptxclassdiagram.pptx
classdiagram.pptx
 
Intro Uml
Intro UmlIntro Uml
Intro Uml
 
Slide 5 Class Diagram
Slide 5 Class DiagramSlide 5 Class Diagram
Slide 5 Class Diagram
 
UML Diagrams
UML DiagramsUML Diagrams
UML Diagrams
 
Uml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot netUml class diagram and packages ppt for dot net
Uml class diagram and packages ppt for dot net
 
210280107093_CLASS_DIAGRAM.pptx
210280107093_CLASS_DIAGRAM.pptx210280107093_CLASS_DIAGRAM.pptx
210280107093_CLASS_DIAGRAM.pptx
 
Ooad lab manual
Ooad  lab manualOoad  lab manual
Ooad lab manual
 
UML
UMLUML
UML
 

Último

Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
Epec Engineered Technologies
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
mphochane1998
 

Último (20)

kiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal loadkiln thermal load.pptx kiln tgermal load
kiln thermal load.pptx kiln tgermal load
 
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptxA CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
A CASE STUDY ON CERAMIC INDUSTRY OF BANGLADESH.pptx
 
Hostel management system project report..pdf
Hostel management system project report..pdfHostel management system project report..pdf
Hostel management system project report..pdf
 
Standard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power PlayStandard vs Custom Battery Packs - Decoding the Power Play
Standard vs Custom Battery Packs - Decoding the Power Play
 
Online electricity billing project report..pdf
Online electricity billing project report..pdfOnline electricity billing project report..pdf
Online electricity billing project report..pdf
 
A Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna MunicipalityA Study of Urban Area Plan for Pabna Municipality
A Study of Urban Area Plan for Pabna Municipality
 
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptxHOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
HOA1&2 - Module 3 - PREHISTORCI ARCHITECTURE OF KERALA.pptx
 
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
Navigating Complexity: The Role of Trusted Partners and VIAS3D in Dassault Sy...
 
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptxS1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
S1S2 B.Arch MGU - HOA1&2 Module 3 -Temple Architecture of Kerala.pptx
 
data_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdfdata_management_and _data_science_cheat_sheet.pdf
data_management_and _data_science_cheat_sheet.pdf
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
PE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and propertiesPE 459 LECTURE 2- natural gas basic concepts and properties
PE 459 LECTURE 2- natural gas basic concepts and properties
 
Block diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.pptBlock diagram reduction techniques in control systems.ppt
Block diagram reduction techniques in control systems.ppt
 
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
COST-EFFETIVE  and Energy Efficient BUILDINGS ptxCOST-EFFETIVE  and Energy Efficient BUILDINGS ptx
COST-EFFETIVE and Energy Efficient BUILDINGS ptx
 
DC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equationDC MACHINE-Motoring and generation, Armature circuit equation
DC MACHINE-Motoring and generation, Armature circuit equation
 
School management system project Report.pdf
School management system project Report.pdfSchool management system project Report.pdf
School management system project Report.pdf
 
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments""Lesotho Leaps Forward: A Chronicle of Transformative Developments"
"Lesotho Leaps Forward: A Chronicle of Transformative Developments"
 
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best ServiceTamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
Tamil Call Girls Bhayandar WhatsApp +91-9930687706, Best Service
 
Computer Networks Basics of Network Devices
Computer Networks  Basics of Network DevicesComputer Networks  Basics of Network Devices
Computer Networks Basics of Network Devices
 

Object and class relationships

  • 1.
  • 2. 2 A CLASS is a template (specification, blueprint) for a collection of objects that share a common set of attributes and operations. Health Club Member Class Objects attributes operations Defining Class
  • 3. UML Class Diagrams 3 What is a Class Diagram? •A Class Diagram is a diagram describing the structure of a system shows the system's •classes •Attributes •operations (or methods), •Relationships among the classes.
  • 4. 4 1 of 2 UML Class Diagram Notation Class Member memberNumber firstName lastName telephone address city etc... checkOutVideo checkInVideo buyItem etc... attributes operations { { Expanded view of a Class into its three sections: Top: Class Name Middle: attributes Bottom: operations
  • 5. 5 2 of 2 Object Association n n Class Generalization Relationship Object Aggregation Association 0..* 1..* Object Composition Association 0..* 1 Will always be “1” UML Class Diagram Notation
  • 6. UML Class Diagrams 6 Essential Elements of a UML Class Diagram Class Attributes Operations Relationships
  • 8. 8 Associations An association between two classes describes connection among them. If the association is between two classes then it is called binary association. There can be association among more than two classes. It is represented by a solid line. Example: “An Employee works for a Company” Employee Company
  • 9. 9 Class A Class B role A role B Company Person Employer Employee Example: Associations
  • 10. 10 Aggregation & Composition •Aggregation (shared aggregation): • is a specialized form of ASSOCIATION in which a whole is related to its part(s). • is known as a “part of” or containment relationship and follows the “has a” heuristic • three ways to think about aggregations: • whole-parts • container-contents • group-members • Composition (composite aggregation): • is a stronger version of AGGREGATION • the “part(s)” may belong to only ONE whole • the part(s) are usually expected to “live” and “die” with the whole (“cascading delete”) • Aggregation vs. Composition vs. Association???
  • 12. 12 Generalization • Deriving a class out of a parent class having some inherited property(from the parent class) and some new property of the derived class. • The term generalization is for the inheritance in the bottom to the up direction i.e. from derived class to the parent class.
  • 13. • It is represented by a solid line with a large arrow head pointing towards the parent class. • Example: 13 Vehicle Car Truck
  • 14. 14 Dependency • A dependency relationship is a weaker form of relationship. A dependency states that a change in specification of one class may effect another class that uses first one but not vice versa. • It is represented by dashed lines. Dependent class Reference class
  • 15. 15 Realization • Realization is very similar to inheritance ,the only difference between them is a class is derived from an interface instead of a base class. • An interface is an abstract class. Interface class Derived class
  • 16. 16