SlideShare a Scribd company logo
Class Diagram
Designed by: Nadia Nazeer
Objectives
 Concept of class diagram
 Creating class diagram
Classes
ClassName
attributes
operations
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.
Class Names
ClassName
attributes
operations
The name of the class is the only required
tag in the graphical representation of a
class. It always appears in the top-most
compartment.
Class Attributes
Person
name : String
address : Address
birthdate : Date
ssn : Id
An attribute is a named property of a
class that describes the object being modeled.
In the class diagram, attributes appear in
the second compartment just below the
name-compartment.
Class Attributes (Cont’d)
Person
name : String
address : Address
birthdate : Date
/ age : Date
ssn : Id
Attributes are usually listed in the form:
attributeName : Type
A derived attribute is one that can be
computed from other attributes, but
doesn’t actually exist. For example,
a Person’s age can be computed from
his birth date. A derived attribute is
designated by a preceding ‘/’ as in:
/ age : Date
Class Attributes (Cont’d)
Person
+ name : String
# address : Address
# birthdate : Date
/ age : Date
- ssn : Id
Attributes can be:
+ public
# protected
- private
/ derived
Class Operations
Person
name : String
address : Address
birthdate : Date
ssn : Id
eat
sleep
work
play
Operations describe the class behavior
and appear in the third compartment.
Depicting Classes
Person
name : String
birthdate : Date
ssn : Id
eat()
sleep()
work()
play()
When drawing a class, you needn’t show attributes and operation
in every diagram.
Person
Person
name
address
birthdate
Person
eat
play
Person
Class Responsibilities
A class may also include its responsibilities in a class diagram.
A responsibility is a contract or obligation of a class to perform
a particular service.
SmokeAlarm
Responsibilities
-- sound alert and notify guard station
when smoke is detected.
-- indicate battery state
Relationships
In UML, object interconnections (logical or physical), are
modeled as relationships.
There are three kinds of relationships in UML:
• dependencies
• generalizations
• associations
Dependency Relationships
CourseSchedule
add(c : Course)
remove(c : Course)
Course
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.
Generalization Relationships
Person
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.
Student
Generalization Relationships
(Cont’d)
Student
UML permits a class to inherit from multiple super classes,
although some programming languages (e.g., Java) do not permit
multiple inheritance.
TeachingAssistant
Employee
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.
Instructor
Student
Association Relationships
(Cont’d)
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:
Instructor
Student
1..*
Association Relationships
(Cont’d)
The example indicates that every Instructor has one or more
Students:
Instructor
Student
1..*
Association Relationships
(Cont’d)
We can also indicate the behavior of an object in an association
(i.e., the role of an object) using role names.
Instructor
Student
1..*
1..*
learns from
teaches
Association Relationships
(Cont’d)
We can also name the association.
Team
Student
membership
1..* 1..*
Association Relationships
(Cont’d)
We can specify dual associations.
Team
Student
member of
1..*
president of
1 1..*
1..*
Association Relationships
(Cont’d)
Associations can also be objects themselves, called link classes
or an association classes.
Warranty
Product
Registration
modelNumber
serialNumber
warrentyCode
Example
Example
References
 http://agilemodeling.com/artifacts/
classDiagram.htm
 http://creately.com/diagram-type/article/
simple-guidelines-drawing-uml-class-diagrams
 http://www.tutorialspoint.com/uml/
uml_class_diagram.htm
 https://www.smartdraw.com/class-diagram/
For Requesting more Slid Share Visit
nadianazeer5@gmail.com

More Related Content

PPT
Descriptions of class diagrams in software
PDF
Introduction to UML, a guide to learn.pdf
PPT
Lecture12 software design class diagram
PDF
Class diagram- UML diagram
PPT
class Diagram.ppt
DOCX
Chapterunifiedmo 3 UML Class Diagram.docx
PDF
UML_Class_Diagram_Software_Engineering.pdf
PPT
Class diagram
Descriptions of class diagrams in software
Introduction to UML, a guide to learn.pdf
Lecture12 software design class diagram
Class diagram- UML diagram
class Diagram.ppt
Chapterunifiedmo 3 UML Class Diagram.docx
UML_Class_Diagram_Software_Engineering.pdf
Class diagram

Similar to UML Diagrams: Class Diagrams in Software Engineering (20)

PPTX
210280107093_CLASS_DIAGRAM.pptx
PPT
Basic Class Diagrams in fundamental computing.ppt
PPT
Department of Computer science and engineering
PPT
Basic Class Diagrams in software engineering
PPTX
Relationships and their representation in a class diagram.pptx
PPTX
CLASS DIAGRAMS IN OBJECT ORIENTED ANALYSIS AND DESIGN
PPT
Uml class Diagram
PPT
Chapter 2-Unified Modeling Languagee.ppt
PPT
Chapter 2-Unified Modeling Languagee.ppt
PPTX
UML Design.pptx
PPTX
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
PPT
Slide 5 Class Diagram
PDF
Class diagram and its importance in software
PDF
Software Engineering :UML class diagrams
PPT
Umldiagram
PDF
Lecture05-Structural Modeling for students.pdf
PPT
Object and class relationships
PPT
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
210280107093_CLASS_DIAGRAM.pptx
Basic Class Diagrams in fundamental computing.ppt
Department of Computer science and engineering
Basic Class Diagrams in software engineering
Relationships and their representation in a class diagram.pptx
CLASS DIAGRAMS IN OBJECT ORIENTED ANALYSIS AND DESIGN
Uml class Diagram
Chapter 2-Unified Modeling Languagee.ppt
Chapter 2-Unified Modeling Languagee.ppt
UML Design.pptx
Class diagrams are a type of UML (Unified Modeling Language) diagram used in ...
Slide 5 Class Diagram
Class diagram and its importance in software
Software Engineering :UML class diagrams
Umldiagram
Lecture05-Structural Modeling for students.pdf
Object and class relationships
Week 10-classdiagrams.pptdddddddddddddddddddddddddddd
Ad

More from NabeelRehman21 (12)

PPTX
Embedded Systems Theoretical PowerPoint Presentation
PPTX
Embedded Systems Lab Practical PowerPoint presentation with source code
PPTX
Dynamic_Programming_Presentation in Design and Analysis of Algorithm
PPTX
Pushdown_Automata_Presentation in Automata theory and compiler design
PPTX
Library Management System using PHP and MySQL
PPTX
supervised and unsupervised machine learning, types of machine learning
PPTX
white box and black box testing in software engineering
PPTX
DISCRETE MATHEMATICS POWRPOINT PRESENTATION ON COMBINATIONS
PPTX
Sequence Diagrams (UML) in Software engineering PPTX file
PPTX
Unified Modeling Language: Use case Diagrams in Software engineering
PPTX
All's well that ends well, play by william shaksepeare
PDF
Break-Even-Analysis in business economics
Embedded Systems Theoretical PowerPoint Presentation
Embedded Systems Lab Practical PowerPoint presentation with source code
Dynamic_Programming_Presentation in Design and Analysis of Algorithm
Pushdown_Automata_Presentation in Automata theory and compiler design
Library Management System using PHP and MySQL
supervised and unsupervised machine learning, types of machine learning
white box and black box testing in software engineering
DISCRETE MATHEMATICS POWRPOINT PRESENTATION ON COMBINATIONS
Sequence Diagrams (UML) in Software engineering PPTX file
Unified Modeling Language: Use case Diagrams in Software engineering
All's well that ends well, play by william shaksepeare
Break-Even-Analysis in business economics
Ad

Recently uploaded (20)

PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PPTX
Lecture Notes Electrical Wiring System Components
PPTX
Construction Project Organization Group 2.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
DOCX
573137875-Attendance-Management-System-original
PPTX
OOP with Java - Java Introduction (Basics)
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
composite construction of structures.pdf
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
web development for engineering and engineering
PPT
Mechanical Engineering MATERIALS Selection
PPTX
additive manufacturing of ss316l using mig welding
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Internet of Things (IOT) - A guide to understanding
bas. eng. economics group 4 presentation 1.pptx
Lecture Notes Electrical Wiring System Components
Construction Project Organization Group 2.pptx
R24 SURVEYING LAB MANUAL for civil enggi
573137875-Attendance-Management-System-original
OOP with Java - Java Introduction (Basics)
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
composite construction of structures.pdf
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
web development for engineering and engineering
Mechanical Engineering MATERIALS Selection
additive manufacturing of ss316l using mig welding
Automation-in-Manufacturing-Chapter-Introduction.pdf

UML Diagrams: Class Diagrams in Software Engineering