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

Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
Shubham Dwivedi
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
HoneyChintal
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces Tuan Ngo
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
jehan1987
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and Interfaces
Ahmed Nobi
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
Lovely Professional University
 
Abstract Class Presentation
Abstract Class PresentationAbstract Class Presentation
Abstract Class Presentation
tigerwarn
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core Java
MOHIT AGARWAL
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
Haris Bin Zahid
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
Shreyans Pathak
 
Interface in java
Interface in javaInterface in java
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
Richa Gupta
 
Abstract method
Abstract methodAbstract method
Oop
OopOop
Abstract class and interface
Abstract class and interfaceAbstract class and interface
Abstract class and interface
Mazharul Sabbir
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementationthe_wumberlog
 
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
What is Interface in Java | How to implement Multiple Inheritance Using Inter...What is Interface in Java | How to implement Multiple Inheritance Using Inter...
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
Edureka!
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
Abishek Purushothaman
 
Abstraction
AbstractionAbstraction
Abstraction
adil raja
 
06 abstract-classes
06 abstract-classes06 abstract-classes
06 abstract-classes
Anup Burange
 

What's hot (20)

Java abstract class & abstract methods
Java abstract class & abstract methodsJava abstract class & abstract methods
Java abstract class & abstract methods
 
Interface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementationInterface in java ,multiple inheritance in java, interface implementation
Interface in java ,multiple inheritance in java, interface implementation
 
8 abstract classes and interfaces
8   abstract classes and interfaces 8   abstract classes and interfaces
8 abstract classes and interfaces
 
Java interfaces
Java interfacesJava interfaces
Java interfaces
 
Abstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and InterfacesAbstraction in java [abstract classes and Interfaces
Abstraction in java [abstract classes and Interfaces
 
Abstract class in java
Abstract class in javaAbstract class in java
Abstract class in java
 
Abstract Class Presentation
Abstract Class PresentationAbstract Class Presentation
Abstract Class Presentation
 
Abstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core JavaAbstract Class & Abstract Method in Core Java
Abstract Class & Abstract Method in Core Java
 
Abstract class and Interface
Abstract class and InterfaceAbstract class and Interface
Abstract class and Interface
 
Java interfaces & abstract classes
Java interfaces & abstract classesJava interfaces & abstract classes
Java interfaces & abstract classes
 
Interface in java
Interface in javaInterface in java
Interface in java
 
Java OOPS Concept
Java OOPS ConceptJava OOPS Concept
Java OOPS Concept
 
Abstract method
Abstract methodAbstract method
Abstract method
 
Oop
OopOop
Oop
 
Abstract class and interface
Abstract class and interfaceAbstract class and interface
Abstract class and interface
 
Lecture 1 uml with java implementation
Lecture 1 uml with java implementationLecture 1 uml with java implementation
Lecture 1 uml with java implementation
 
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
What is Interface in Java | How to implement Multiple Inheritance Using Inter...What is Interface in Java | How to implement Multiple Inheritance Using Inter...
What is Interface in Java | How to implement Multiple Inheritance Using Inter...
 
Interfaces in java
Interfaces in javaInterfaces in java
Interfaces in java
 
Abstraction
AbstractionAbstraction
Abstraction
 
06 abstract-classes
06 abstract-classes06 abstract-classes
06 abstract-classes
 

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

Css uml
Css umlCss uml
2 class use case
2 class use case2 class use case
2 class use case
Minal Maniar
 
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
TARGARYEN001
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
Raj Thilak S
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagramskebsterz
 
C# program structure
C# program structureC# program structure
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
mekhap
 
Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in software
ssuser9d62d6
 
Lecture12 software design class diagram
Lecture12 software design class diagramLecture12 software design class diagram
Lecture12 software design class diagram
Shahid Riaz
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
Madhar Khan Pathan
 
Software Testing and UML Lab
Software Testing and UML LabSoftware Testing and UML Lab
Software Testing and UML Lab
Harsh Kishore Mishra
 
Class diagram presentation
Class diagram presentationClass diagram presentation
Class diagram presentation
SayedFarhan110
 
Relations Class Diagram
Relations Class DiagramRelations Class Diagram
Relations Class Diagram
halwal
 
UML_Lecture.pptxnd bfdjjrnekdddkeeeenekejneje
UML_Lecture.pptxnd bfdjjrnekdddkeeeenekejnejeUML_Lecture.pptxnd bfdjjrnekdddkeeeenekejneje
UML_Lecture.pptxnd bfdjjrnekdddkeeeenekejneje
ssusera6a60c1
 
UML- Unified Modeling Language
UML- Unified Modeling LanguageUML- Unified Modeling Language
UML- Unified Modeling Language
Shahzad
 
UML
UMLUML
Sda 7
Sda   7Sda   7
uml2-1214558329929112-8.ppt
uml2-1214558329929112-8.pptuml2-1214558329929112-8.ppt
uml2-1214558329929112-8.ppt
AleksandarUrdarevski
 

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

Css uml
Css umlCss uml
Css uml
 
2 class use case
2 class use case2 class use case
2 class use case
 
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
 
Uml - An Overview
Uml - An OverviewUml - An Overview
Uml - An Overview
 
08 class and sequence diagrams
08   class and sequence diagrams08   class and sequence diagrams
08 class and sequence diagrams
 
C# program structure
C# program structureC# program structure
C# program structure
 
Chapter3
Chapter3Chapter3
Chapter3
 
Uml report
Uml reportUml report
Uml report
 
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
 
Descriptions of class diagrams in software
Descriptions of class diagrams in softwareDescriptions of class diagrams in software
Descriptions of class diagrams in software
 
Lecture12 software design class diagram
Lecture12 software design class diagramLecture12 software design class diagram
Lecture12 software design class diagram
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Software Testing and UML Lab
Software Testing and UML LabSoftware Testing and UML Lab
Software Testing and UML Lab
 
Class diagram presentation
Class diagram presentationClass diagram presentation
Class diagram presentation
 
Relations Class Diagram
Relations Class DiagramRelations Class Diagram
Relations Class Diagram
 
UML_Lecture.pptxnd bfdjjrnekdddkeeeenekejneje
UML_Lecture.pptxnd bfdjjrnekdddkeeeenekejnejeUML_Lecture.pptxnd bfdjjrnekdddkeeeenekejneje
UML_Lecture.pptxnd bfdjjrnekdddkeeeenekejneje
 
UML- Unified Modeling Language
UML- Unified Modeling LanguageUML- Unified Modeling Language
UML- Unified Modeling Language
 
UML
UMLUML
UML
 
Sda 7
Sda   7Sda   7
Sda 7
 
uml2-1214558329929112-8.ppt
uml2-1214558329929112-8.pptuml2-1214558329929112-8.ppt
uml2-1214558329929112-8.ppt
 

More from OUM SAOKOSAL

Android app development - Java Programming for Android
Android app development - Java Programming for AndroidAndroid app development - Java Programming for Android
Android app development - Java Programming for Android
OUM SAOKOSAL
 
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCJava OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
OUM SAOKOSAL
 
Java OOP Programming language (Part 7) - Swing
Java OOP Programming language (Part 7) - SwingJava OOP Programming language (Part 7) - Swing
Java OOP Programming language (Part 7) - Swing
OUM SAOKOSAL
 
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - Inheritance
OUM SAOKOSAL
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
OUM SAOKOSAL
 
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and ObjectJava OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and Object
OUM SAOKOSAL
 
Java OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to JavaJava OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to Java
OUM SAOKOSAL
 
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with ExamplesJavascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
OUM SAOKOSAL
 
Aggregate rank bringing order to web sites
Aggregate rank  bringing order to web sitesAggregate rank  bringing order to web sites
Aggregate rank bringing order to web sitesOUM SAOKOSAL
 
How to succeed in graduate school
How to succeed in graduate schoolHow to succeed in graduate school
How to succeed in graduate schoolOUM SAOKOSAL
 
Data preparation for mining world wide web browsing patterns (1999)
Data preparation for mining world wide web browsing patterns (1999)Data preparation for mining world wide web browsing patterns (1999)
Data preparation for mining world wide web browsing patterns (1999)OUM SAOKOSAL
 
Consumer acceptance of online banking an extension of the technology accepta...
Consumer acceptance of online banking  an extension of the technology accepta...Consumer acceptance of online banking  an extension of the technology accepta...
Consumer acceptance of online banking an extension of the technology accepta...OUM SAOKOSAL
 
When Do People Help
When Do People HelpWhen Do People Help
When Do People Help
OUM SAOKOSAL
 
Correlation Example
Correlation ExampleCorrelation Example
Correlation ExampleOUM SAOKOSAL
 
Path Spss Amos (1)
Path Spss Amos (1)Path Spss Amos (1)
Path Spss Amos (1)OUM SAOKOSAL
 

More from OUM SAOKOSAL (20)

Android app development - Java Programming for Android
Android app development - Java Programming for AndroidAndroid app development - Java Programming for Android
Android app development - Java Programming for Android
 
Java OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBCJava OOP Programming language (Part 8) - Java Database JDBC
Java OOP Programming language (Part 8) - Java Database JDBC
 
Java OOP Programming language (Part 7) - Swing
Java OOP Programming language (Part 7) - SwingJava OOP Programming language (Part 7) - Swing
Java OOP Programming language (Part 7) - Swing
 
Java OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - InheritanceJava OOP Programming language (Part 5) - Inheritance
Java OOP Programming language (Part 5) - Inheritance
 
Java OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - CollectionJava OOP Programming language (Part 4) - Collection
Java OOP Programming language (Part 4) - Collection
 
Java OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and ObjectJava OOP Programming language (Part 3) - Class and Object
Java OOP Programming language (Part 3) - Class and Object
 
Java OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to JavaJava OOP Programming language (Part 1) - Introduction to Java
Java OOP Programming language (Part 1) - Introduction to Java
 
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with ExamplesJavascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
Javascript & DOM - Part 1- Javascript Tutorial for Beginners with Examples
 
Aggregate rank bringing order to web sites
Aggregate rank  bringing order to web sitesAggregate rank  bringing order to web sites
Aggregate rank bringing order to web sites
 
How to succeed in graduate school
How to succeed in graduate schoolHow to succeed in graduate school
How to succeed in graduate school
 
Google
GoogleGoogle
Google
 
E miner
E minerE miner
E miner
 
Data preparation for mining world wide web browsing patterns (1999)
Data preparation for mining world wide web browsing patterns (1999)Data preparation for mining world wide web browsing patterns (1999)
Data preparation for mining world wide web browsing patterns (1999)
 
Consumer acceptance of online banking an extension of the technology accepta...
Consumer acceptance of online banking  an extension of the technology accepta...Consumer acceptance of online banking  an extension of the technology accepta...
Consumer acceptance of online banking an extension of the technology accepta...
 
When Do People Help
When Do People HelpWhen Do People Help
When Do People Help
 
Mc Nemar
Mc NemarMc Nemar
Mc Nemar
 
Correlation Example
Correlation ExampleCorrelation Example
Correlation Example
 
Sem Ski Amos
Sem Ski AmosSem Ski Amos
Sem Ski Amos
 
Sem+Essentials
Sem+EssentialsSem+Essentials
Sem+Essentials
 
Path Spss Amos (1)
Path Spss Amos (1)Path Spss Amos (1)
Path Spss Amos (1)
 

Recently uploaded

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
GeoBlogs
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
Celine George
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
kaushalkr1407
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
Anna Sz.
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
Nguyen Thanh Tu Collection
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
Jheel Barad
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
joachimlavalley1
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Po-Chuan Chen
 

Recently uploaded (20)

The geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideasThe geography of Taylor Swift - some ideas
The geography of Taylor Swift - some ideas
 
How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17How to Make a Field invisible in Odoo 17
How to Make a Field invisible in Odoo 17
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
The Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdfThe Roman Empire A Historical Colossus.pdf
The Roman Empire A Historical Colossus.pdf
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Polish students' mobility in the Czech Republic
Polish students' mobility in the Czech RepublicPolish students' mobility in the Czech Republic
Polish students' mobility in the Czech Republic
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
BÀI TẬP BỔ TRỢ TIẾNG ANH GLOBAL SUCCESS LỚP 3 - CẢ NĂM (CÓ FILE NGHE VÀ ĐÁP Á...
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Instructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptxInstructions for Submissions thorugh G- Classroom.pptx
Instructions for Submissions thorugh G- Classroom.pptx
 
Additional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdfAdditional Benefits for Employee Website.pdf
Additional Benefits for Employee Website.pdf
 
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdfAdversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
Adversarial Attention Modeling for Multi-dimensional Emotion Regression.pdf
 

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}