SlideShare a Scribd company logo
Class
Diagram
OUM SAOKOSAL
Chief of Faculty of Computer Science, NPIC.edu.kh
Master of Engineering in Information Systems,
Jeonju University, South Korea
012252752 / 070252752
https://youtube.com/oumsaokosal
http://kosalgeek.com
Class Diagram
 A class is a description of a set of
objects that share the same attributes,
operations, relationships, and semantics.
 Graphically, a class is rendered as a
rectangle, usually including its name,
attributes, and operations in separate,
designated compartments.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 2
ClassName
attributes
operations
Class Diagram (cont.)
 Attributes/Operation can be:
+ public
# protected
- private
~ default
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 3
Person
+ name : String
# address : Address
# birthdate : Date
~ ssn : Integer
eat(f:Food) : Void
sleep(t:Time) : Duration
work() : Void
play(sport) : Boolean
Depicting Classes
 When drawing a class, you needn’t show attributes and operation
in every diagram.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 4
Person
name : String
birthdate : Date
ssn : Int
eat()
sleep()
work()
play()
Person
Person
name
address
birthdate
Person
eat
play
Person
Dependency Relationships
 A dependency indicates a semantic relationship between two or
more elements. The dependency from CourseSchedule to Course
exists because Course is used in both the add and remove
operations of CourseSchedule.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 5
CourseSchedule
add(c : Course)
remove(c : Course)
Course
Generalization Relationships
 A generalization connects a subclass to its superclass. It denotes
an inheritance of attributes and behavior from the superclass to
the subclass and indicates a specialization in the subclass of the
more general superclass.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 6
Person
Student Teacher
Association Relationships
 If two classes in a model need to communicate with each other,
there must be link between them.
 An association denotes that link.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 7
InstructorStudent
Association Relationships (Cont.)
 We can indicate the multiplicity of an association by adding
multiplicity adornments to the line denoting the association.
 The example indicates that a Student has one or more Instructors:
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 8
InstructorStudent
1..*
Association Relationships (Cont.)
 The example indicates that every Instructor has one or more
Students:
 We can also indicate the behavior of an object in an association
(i.e., the role of an object) using rolenames.
 We can also name the association.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 9
InstructorStudent
1..*
InstructorStudent
1..*1..*
learns fromteaches
TeamStudent
membership
1..* 1..*
Association Relationships (Cont.)
 We can constrain the association relationship by defining the
navigability of the association. Here, a Router object requests
services from a DNS object by sending messages to (invoking the
operations of) the server. The direction of the association
indicates that the server has no knowledge of the Router.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 10
Router DomainNameServer
Association Relationships:
Aggregations and Compositions
 We can model objects that contain other objects by way of
special associations called aggregations and compositions.
 An aggregation specifies a whole-part relationship between an
aggregate (a whole) and a constituent part, where the part can
exist independently from the aggregate. Aggregations are
denoted by a hollow-diamond adornment on the association.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 11
Car
Engine
Transmission
Association Relationships:
Aggregations and Compositions (cont.)
 A composition indicates a strong ownership and coincident
lifetime of parts by the whole (i.e., they live and die as a whole).
Compositions are denoted by a filled-diamond adornment on the
association.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 12
Window
Scrollbar
Titlebar
Menu
1
1
1
1
1
1 .. *
Interfaces
 An interface is a named set of operations that specifies the
behavior of objects without showing their inner structure. It can
be rendered in the model by a one- or two-compartment
rectangle, with the stereotype <<interface>> above the interface
name.
 Interfaces do not get instantiated. They have no attributes or
state. Rather, they specify the services offered by a related class.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 13
<<interface>>
ControlPanel
getChoices : Choice[]
makeChoice (c : Choice)
getSelection : Selection
Interface Realization Relationship
 A realization relationship connects a class with an interface that
supplies its behavioral specification. It is rendered by a dashed
line with a hollow triangle towards the specifier.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 14
<<interface>>
ControlPanel
VendingMachine
specifier
implementation
Depicting Interfaces
 A class’interface can also be rendered by a circle connected to a
class by a solid line.
This presentation is available to download at: https://www.slideshare.net/oumsaokosal 15
File
outputStream
FileWriter
{file must not be locked}
FileReader
{file must exist}

More Related Content

What's hot (20)

PPTX
Java abstract class & abstract methods
Shubham Dwivedi
 
PPTX
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
PDF
8 abstract classes and interfaces
Tuan Ngo
 
PPTX
Java interfaces
jehan1987
 
PPTX
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
PPT
Abstract class in java
Lovely Professional University
 
PPTX
Abstract Class Presentation
tigerwarn
 
PPTX
Abstract Class & Abstract Method in Core Java
MOHIT AGARWAL
 
PPTX
Abstract class and Interface
Haris Bin Zahid
 
PPT
Java interfaces & abstract classes
Shreyans Pathak
 
PPT
Interface in java
Lovely Professional University
 
PPTX
Java OOPS Concept
Richa Gupta
 
PPTX
Abstract method
Yaswanth Babu Gummadivelli
 
PPTX
Abstract class and interface
Mazharul Sabbir
 
PPTX
Lecture 1 uml with java implementation
the_wumberlog
 
PDF
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
Edureka!
 
PPTX
Interfaces in java
Abishek Purushothaman
 
PDF
Abstraction
adil raja
 
PPT
06 abstract-classes
Anup Burange
 
Java abstract class & abstract methods
Shubham Dwivedi
 
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
8 abstract classes and interfaces
Tuan Ngo
 
Java interfaces
jehan1987
 
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
Abstract class in java
Lovely Professional University
 
Abstract Class Presentation
tigerwarn
 
Abstract Class & Abstract Method in Core Java
MOHIT AGARWAL
 
Abstract class and Interface
Haris Bin Zahid
 
Java interfaces & abstract classes
Shreyans Pathak
 
Java OOPS Concept
Richa Gupta
 
Abstract class and interface
Mazharul Sabbir
 
Lecture 1 uml with java implementation
the_wumberlog
 
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
Edureka!
 
Interfaces in java
Abishek Purushothaman
 
Abstraction
adil raja
 
06 abstract-classes
Anup Burange
 

Similar to Class Diagram | OOP and Design Patterns by Oum Saokosal (20)

PPT
Lecture12 software design class diagram
Shahid Riaz
 
PDF
Introduction to UML, a guide to learn.pdf
TARGARYEN001
 
PPT
Slide 5 Class Diagram
Niloy Rocker
 
PDF
Lecture05-Structural Modeling for students.pdf
NguyenHongNhung31
 
PPT
Software Engineering1-1-UML.ppt
naqibullah2022faryab
 
PPT
Descriptions of class diagrams in software
ssuser9d62d6
 
PPT
08 class and sequence diagrams
kebsterz
 
PPT
UML Diagrams
Kartik Raghuvanshi
 
PPT
objectmodeling-121201024636-phpapp01.ppt
DrKBManwade
 
PPTX
Relationships and their representation in a class diagram.pptx
nesarahmad37
 
PPT
UML Introduction The system development life cycle (SDLC) is a complex projec...
ssuserdb9909
 
PPTX
FALLSEM2024-25_SWE2018_ETH_VL2024250103302_2024-10-04_Reference-Material-I.pptx
yadavdkshitij2003
 
DOCX
Chapterunifiedmo 3 UML Class Diagram.docx
MohammedNouh7
 
PPTX
CLASS DIAGRAMS IN OBJECT ORIENTED ANALYSIS AND DESIGN
UmmuAhmed3
 
PPT
Uml class diagram and packages ppt for dot net
mekhap
 
PPT
Class diagram
Praneeth Yadav
 
PPT
Object and class relationships
Pooja mittal
 
PPT
04class
Nguyen Tran
 
PPT
uml2-1214558329929112-8.ppt
AleksandarUrdarevski
 
Lecture12 software design class diagram
Shahid Riaz
 
Introduction to UML, a guide to learn.pdf
TARGARYEN001
 
Slide 5 Class Diagram
Niloy Rocker
 
Lecture05-Structural Modeling for students.pdf
NguyenHongNhung31
 
Software Engineering1-1-UML.ppt
naqibullah2022faryab
 
Descriptions of class diagrams in software
ssuser9d62d6
 
08 class and sequence diagrams
kebsterz
 
UML Diagrams
Kartik Raghuvanshi
 
objectmodeling-121201024636-phpapp01.ppt
DrKBManwade
 
Relationships and their representation in a class diagram.pptx
nesarahmad37
 
UML Introduction The system development life cycle (SDLC) is a complex projec...
ssuserdb9909
 
FALLSEM2024-25_SWE2018_ETH_VL2024250103302_2024-10-04_Reference-Material-I.pptx
yadavdkshitij2003
 
Chapterunifiedmo 3 UML Class Diagram.docx
MohammedNouh7
 
CLASS DIAGRAMS IN OBJECT ORIENTED ANALYSIS AND DESIGN
UmmuAhmed3
 
Uml class diagram and packages ppt for dot net
mekhap
 
Class diagram
Praneeth Yadav
 
Object and class relationships
Pooja mittal
 
04class
Nguyen Tran
 
uml2-1214558329929112-8.ppt
AleksandarUrdarevski
 
Ad

More from OUM SAOKOSAL (20)

PPTX
Android app development - Java Programming for Android
OUM SAOKOSAL
 
PDF
Java OOP Programming language (Part 8) - Java Database JDBC
OUM SAOKOSAL
 
PDF
Java OOP Programming language (Part 7) - Swing
OUM SAOKOSAL
 
PDF
Java OOP Programming language (Part 5) - Inheritance
OUM SAOKOSAL
 
PDF
Java OOP Programming language (Part 4) - Collection
OUM SAOKOSAL
 
PDF
Java OOP Programming language (Part 3) - Class and Object
OUM SAOKOSAL
 
PDF
Java OOP Programming language (Part 1) - Introduction to Java
OUM SAOKOSAL
 
PDF
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
OUM SAOKOSAL
 
PDF
Aggregate rank bringing order to web sites
OUM SAOKOSAL
 
DOC
How to succeed in graduate school
OUM SAOKOSAL
 
PDF
Google
OUM SAOKOSAL
 
PDF
E miner
OUM SAOKOSAL
 
PDF
Data preparation for mining world wide web browsing patterns (1999)
OUM SAOKOSAL
 
PDF
Consumer acceptance of online banking an extension of the technology accepta...
OUM SAOKOSAL
 
DOCX
When Do People Help
OUM SAOKOSAL
 
DOC
Mc Nemar
OUM SAOKOSAL
 
DOCX
Correlation Example
OUM SAOKOSAL
 
DOC
Sem Ski Amos
OUM SAOKOSAL
 
PPT
Sem+Essentials
OUM SAOKOSAL
 
DOC
Path Spss Amos (1)
OUM SAOKOSAL
 
Android app development - Java Programming for Android
OUM SAOKOSAL
 
Java OOP Programming language (Part 8) - Java Database JDBC
OUM SAOKOSAL
 
Java OOP Programming language (Part 7) - Swing
OUM SAOKOSAL
 
Java OOP Programming language (Part 5) - Inheritance
OUM SAOKOSAL
 
Java OOP Programming language (Part 4) - Collection
OUM SAOKOSAL
 
Java OOP Programming language (Part 3) - Class and Object
OUM SAOKOSAL
 
Java OOP Programming language (Part 1) - Introduction to Java
OUM SAOKOSAL
 
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
OUM SAOKOSAL
 
Aggregate rank bringing order to web sites
OUM SAOKOSAL
 
How to succeed in graduate school
OUM SAOKOSAL
 
Google
OUM SAOKOSAL
 
E miner
OUM SAOKOSAL
 
Data preparation for mining world wide web browsing patterns (1999)
OUM SAOKOSAL
 
Consumer acceptance of online banking an extension of the technology accepta...
OUM SAOKOSAL
 
When Do People Help
OUM SAOKOSAL
 
Mc Nemar
OUM SAOKOSAL
 
Correlation Example
OUM SAOKOSAL
 
Sem Ski Amos
OUM SAOKOSAL
 
Sem+Essentials
OUM SAOKOSAL
 
Path Spss Amos (1)
OUM SAOKOSAL
 
Ad

Recently uploaded (20)

PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PPTX
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
PPTX
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
PPTX
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PPTX
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
PDF
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
PPTX
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
PPTX
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
PPTX
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PDF
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
HUMAN RESOURCE MANAGEMENT: RECRUITMENT, SELECTION, PLACEMENT, DEPLOYMENT, TRA...
PRADEEP ABOTHU
 
Dimensions of Societal Planning in Commonism
StefanMz
 
PPT-Q1-WK-3-ENGLISH Revised Matatag Grade 3.pptx
reijhongidayawan02
 
Post Dated Cheque(PDC) Management in Odoo 18
Celine George
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Cultivation practice of Litchi in Nepal.pptx
UmeshTimilsina1
 
Growth and development and milestones, factors
BHUVANESHWARI BADIGER
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Stereochemistry-Optical Isomerism in organic compoundsptx
Tarannum Nadaf-Mansuri
 
Generative AI: it's STILL not a robot (CIJ Summer 2025)
Paul Bradshaw
 
Unit 2 COMMERCIAL BANKING, Corporate banking.pptx
AnubalaSuresh1
 
MENINGITIS: NURSING MANAGEMENT, BACTERIAL MENINGITIS, VIRAL MENINGITIS.pptx
PRADEEP ABOTHU
 
care of patient with elimination needs.pptx
Rekhanjali Gupta
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
How to Create a PDF Report in Odoo 18 - Odoo Slides
Celine George
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
DIGESTION OF CARBOHYDRATES,PROTEINS,LIPIDS
raviralanaresh2
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 

Class Diagram | OOP and Design Patterns by Oum Saokosal

  • 1. Class Diagram OUM SAOKOSAL Chief of Faculty of Computer Science, NPIC.edu.kh Master of Engineering in Information Systems, Jeonju University, South Korea 012252752 / 070252752 https://youtube.com/oumsaokosal http://kosalgeek.com
  • 2. Class Diagram  A class is a description of a set of objects that share the same attributes, operations, relationships, and semantics.  Graphically, a class is rendered as a rectangle, usually including its name, attributes, and operations in separate, designated compartments. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 2 ClassName attributes operations
  • 3. Class Diagram (cont.)  Attributes/Operation can be: + public # protected - private ~ default This presentation is available to download at: https://www.slideshare.net/oumsaokosal 3 Person + name : String # address : Address # birthdate : Date ~ ssn : Integer eat(f:Food) : Void sleep(t:Time) : Duration work() : Void play(sport) : Boolean
  • 4. Depicting Classes  When drawing a class, you needn’t show attributes and operation in every diagram. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 4 Person name : String birthdate : Date ssn : Int eat() sleep() work() play() Person Person name address birthdate Person eat play Person
  • 5. Dependency Relationships  A dependency indicates a semantic relationship between two or more elements. The dependency from CourseSchedule to Course exists because Course is used in both the add and remove operations of CourseSchedule. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 5 CourseSchedule add(c : Course) remove(c : Course) Course
  • 6. Generalization Relationships  A generalization connects a subclass to its superclass. It denotes an inheritance of attributes and behavior from the superclass to the subclass and indicates a specialization in the subclass of the more general superclass. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 6 Person Student Teacher
  • 7. Association Relationships  If two classes in a model need to communicate with each other, there must be link between them.  An association denotes that link. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 7 InstructorStudent
  • 8. Association Relationships (Cont.)  We can indicate the multiplicity of an association by adding multiplicity adornments to the line denoting the association.  The example indicates that a Student has one or more Instructors: This presentation is available to download at: https://www.slideshare.net/oumsaokosal 8 InstructorStudent 1..*
  • 9. Association Relationships (Cont.)  The example indicates that every Instructor has one or more Students:  We can also indicate the behavior of an object in an association (i.e., the role of an object) using rolenames.  We can also name the association. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 9 InstructorStudent 1..* InstructorStudent 1..*1..* learns fromteaches TeamStudent membership 1..* 1..*
  • 10. Association Relationships (Cont.)  We can constrain the association relationship by defining the navigability of the association. Here, a Router object requests services from a DNS object by sending messages to (invoking the operations of) the server. The direction of the association indicates that the server has no knowledge of the Router. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 10 Router DomainNameServer
  • 11. Association Relationships: Aggregations and Compositions  We can model objects that contain other objects by way of special associations called aggregations and compositions.  An aggregation specifies a whole-part relationship between an aggregate (a whole) and a constituent part, where the part can exist independently from the aggregate. Aggregations are denoted by a hollow-diamond adornment on the association. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 11 Car Engine Transmission
  • 12. Association Relationships: Aggregations and Compositions (cont.)  A composition indicates a strong ownership and coincident lifetime of parts by the whole (i.e., they live and die as a whole). Compositions are denoted by a filled-diamond adornment on the association. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 12 Window Scrollbar Titlebar Menu 1 1 1 1 1 1 .. *
  • 13. Interfaces  An interface is a named set of operations that specifies the behavior of objects without showing their inner structure. It can be rendered in the model by a one- or two-compartment rectangle, with the stereotype <<interface>> above the interface name.  Interfaces do not get instantiated. They have no attributes or state. Rather, they specify the services offered by a related class. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 13 <<interface>> ControlPanel getChoices : Choice[] makeChoice (c : Choice) getSelection : Selection
  • 14. Interface Realization Relationship  A realization relationship connects a class with an interface that supplies its behavioral specification. It is rendered by a dashed line with a hollow triangle towards the specifier. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 14 <<interface>> ControlPanel VendingMachine specifier implementation
  • 15. Depicting Interfaces  A class’interface can also be rendered by a circle connected to a class by a solid line. This presentation is available to download at: https://www.slideshare.net/oumsaokosal 15 File outputStream FileWriter {file must not be locked} FileReader {file must exist}