SlideShare a Scribd company logo
7
Most read
8
Most read
15
Most read
Object Oriented Analysis &
Design
Lecture 16
Class Diagrams
Sajiya Tariq
Overview
•The class diagram is a static diagram. It
represents the static view of an application.
•The class diagram describes the attributes and
operations of a class and also the constraints
imposed on the system.
•The only UML diagrams which can be mapped
directly with object oriented languages.
•The class diagram shows a collection of classes,
interfaces, associations, collaborations and
constraints. It is also known as a structural
diagram.
2
Purpose
The purpose of the class diagram can be
summarized as:
•Analysis and design of the static view of
an application.
•Describe responsibilities of a system.
•Base for component and deployment
diagrams.
•Forward and reverse engineering.
3
Points to remember
• The name of the class diagram should be meaningful to
describe the aspect of the system.
• Each element and their relationships should be identified in
advance.
• Responsibility (attributes and methods) of each class should
be clearly identified.
• For each class minimum number of properties should be
specified. Because unnecessary properties will make the
diagram complicated.
• Use notes when ever required to describe some aspect of
the diagram. Because at the end of the drawing it should be
understandable to the developer/coder.
• Finally, before making the final version, the diagram should
be drawn on plain paper and rework as many times as
possible to make it correct.
4
UML Class Diagram
• What is a UML class diagram?
▫ UML class diagram: a picture of
▫ the classes in an OO system
▫ their fields and methods
▫ connections between the classes that interact or inherit from
each other
• What are some things that are not represented in a UML
class diagram?
▫ details of how the classes interact with each other
▫ algorithmic details; how a particular behavior is
▫ implemented
5
Diagram of one Class
• class name in top of box
▫ write <<interface>> on top of
interfaces' names
▫ use italics for an abstract class
name
• Attributes (optional)
▫ should include all fields of the
object
• Operations / methods (optional)
▫ may omit trivial (get/set) methods
 but don't omit any methods from an
interface!
▫ should not include inherited
methods
6
Class Attributes
• attributes (fields, instance variables)
▫ visibility name : type [count] =
default_value
▫ visibility: + public
# protected
- private
~ package (default)
/ derived
▫ underline static attributes
▫ derived attribute: not stored, but can be
computed from other attribute values
▫ attribute example:
 balance : - = double 0.00
7
Class Operations and Methods
8
Comments
• represented as a folded note, attached to the
appropriate class/method/etc by a dashed line
9
Relationships btwn. classes
•generalization: an inheritance
relationship
▫inheritance between classes
▫interface implementation
•association: a usage relationship
▫dependency
▫aggregation
▫composition
10
Generalization Relationship
11
Associational Relationship
12
Multiplicity of associations
13
Association types
• aggregation: "is part of"
▫ symbolized by a clear white
diamond
• composition: "is entirely made of"
▫ stronger version of aggregation
▫ the parts live and die with the
whole
▫ symbolized by a black diamond
• dependency: "uses temporarily"
▫ symbolized by dotted line
▫ often is an implementation detail,
not an intrinsic part of that
object's state
14
Composition/aggregation
example
15
Class diagram example:Video
Store
16

More Related Content

PPTX
Object diagram
PPTX
Advanced Structural Modeling
PDF
OOAD - UML - Class and Object Diagrams - Lab
PDF
Domain Modeling
PPT
Object Oriented Analysis and Design
PPT
Class diagram
PPTX
Sequence diagrams in UML
PPT
Object Oriented Relationships
Object diagram
Advanced Structural Modeling
OOAD - UML - Class and Object Diagrams - Lab
Domain Modeling
Object Oriented Analysis and Design
Class diagram
Sequence diagrams in UML
Object Oriented Relationships

What's hot (20)

PPTX
Overview of UML Diagrams
PPTX
Component diagram
PPT
UML Architecture and Views
PPTX
Unit III Dynamic and Implementation UML Diagrams.pptx
PDF
State chart diagram
PPTX
serializability in dbms
PPTX
Ooad presentatin crc cards
PDF
INTRODUCTION TO UML DIAGRAMS
PPT
Slide 4 Interaction Diagram
PPTX
Join dependency
PPTX
Uml with detail
PPTX
Chapter-4 Enhanced ER Model
PPT
Lecture#08 sequence diagrams
PDF
Collaboration diagram- UML diagram
PPT
09 package diagram
PPT
Data Mining: Concepts and techniques classification _chapter 9 :advanced methods
PPT
UML Diagrams
PPTX
Confusion Matrix.pptx
PPT
Chapter 09 classification advanced
PPTX
Object Oriented Design
Overview of UML Diagrams
Component diagram
UML Architecture and Views
Unit III Dynamic and Implementation UML Diagrams.pptx
State chart diagram
serializability in dbms
Ooad presentatin crc cards
INTRODUCTION TO UML DIAGRAMS
Slide 4 Interaction Diagram
Join dependency
Uml with detail
Chapter-4 Enhanced ER Model
Lecture#08 sequence diagrams
Collaboration diagram- UML diagram
09 package diagram
Data Mining: Concepts and techniques classification _chapter 9 :advanced methods
UML Diagrams
Confusion Matrix.pptx
Chapter 09 classification advanced
Object Oriented Design
Ad

Similar to Ooad( class diagram) (20)

PPTX
classdiagram.pptx
PPTX
detailed info of class diagram in ooad with uml
PPTX
class diagrams in unified modeling language
PPTX
Lecture 06.pptxLecture 06.pptxLecture 06.pptx
PPTX
UNIT-3 Design Using UML (1).pptx
PPTX
Slideshow on the notes of software engineering
PPTX
UNIT-3 Design Using UML_Design_of_UML.pptx
PPTX
Class Diagrams
PDF
Class diagram and its importance in software
PPTX
SMD Unit ii
PPT
Uml class-diagram
PPTX
UML Class Diagram G-3-122139
PPT
Uml package diagram
PPT
UML (Hemant rajak)
PPT
Cs8592 ooad unit 1
PPT
Cs8592 ooad unit 1
PDF
SE@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.ppt.pdf
PDF
OOM Unit I - III.pdf
PPTX
1. introduction to uml
PPT
Class diagram
classdiagram.pptx
detailed info of class diagram in ooad with uml
class diagrams in unified modeling language
Lecture 06.pptxLecture 06.pptxLecture 06.pptx
UNIT-3 Design Using UML (1).pptx
Slideshow on the notes of software engineering
UNIT-3 Design Using UML_Design_of_UML.pptx
Class Diagrams
Class diagram and its importance in software
SMD Unit ii
Uml class-diagram
UML Class Diagram G-3-122139
Uml package diagram
UML (Hemant rajak)
Cs8592 ooad unit 1
Cs8592 ooad unit 1
SE@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@.ppt.pdf
OOM Unit I - III.pdf
1. introduction to uml
Class diagram
Ad

Recently uploaded (20)

PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PDF
737-MAX_SRG.pdf student reference guides
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
Artificial Intelligence
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PPTX
web development for engineering and engineering
PPT
Mechanical Engineering MATERIALS Selection
PDF
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
Geodesy 1.pptx...............................................
PDF
Well-logging-methods_new................
PPTX
Sustainable Sites - Green Building Construction
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Safety Seminar civil to be ensured for safe working.
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PDF
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...
UNIT-1 - COAL BASED THERMAL POWER PLANTS
737-MAX_SRG.pdf student reference guides
Model Code of Practice - Construction Work - 21102022 .pdf
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Artificial Intelligence
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
web development for engineering and engineering
Mechanical Engineering MATERIALS Selection
Human-AI Collaboration: Balancing Agentic AI and Autonomy in Hybrid Systems
Operating System & Kernel Study Guide-1 - converted.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
Geodesy 1.pptx...............................................
Well-logging-methods_new................
Sustainable Sites - Green Building Construction
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Safety Seminar civil to be ensured for safe working.
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
Evaluating the Democratization of the Turkish Armed Forces from a Normative P...

Ooad( class diagram)

  • 1. Object Oriented Analysis & Design Lecture 16 Class Diagrams Sajiya Tariq
  • 2. Overview •The class diagram is a static diagram. It represents the static view of an application. •The class diagram describes the attributes and operations of a class and also the constraints imposed on the system. •The only UML diagrams which can be mapped directly with object oriented languages. •The class diagram shows a collection of classes, interfaces, associations, collaborations and constraints. It is also known as a structural diagram. 2
  • 3. Purpose The purpose of the class diagram can be summarized as: •Analysis and design of the static view of an application. •Describe responsibilities of a system. •Base for component and deployment diagrams. •Forward and reverse engineering. 3
  • 4. Points to remember • The name of the class diagram should be meaningful to describe the aspect of the system. • Each element and their relationships should be identified in advance. • Responsibility (attributes and methods) of each class should be clearly identified. • For each class minimum number of properties should be specified. Because unnecessary properties will make the diagram complicated. • Use notes when ever required to describe some aspect of the diagram. Because at the end of the drawing it should be understandable to the developer/coder. • Finally, before making the final version, the diagram should be drawn on plain paper and rework as many times as possible to make it correct. 4
  • 5. UML Class Diagram • What is a UML class diagram? ▫ UML class diagram: a picture of ▫ the classes in an OO system ▫ their fields and methods ▫ connections between the classes that interact or inherit from each other • What are some things that are not represented in a UML class diagram? ▫ details of how the classes interact with each other ▫ algorithmic details; how a particular behavior is ▫ implemented 5
  • 6. Diagram of one Class • class name in top of box ▫ write <<interface>> on top of interfaces' names ▫ use italics for an abstract class name • Attributes (optional) ▫ should include all fields of the object • Operations / methods (optional) ▫ may omit trivial (get/set) methods  but don't omit any methods from an interface! ▫ should not include inherited methods 6
  • 7. Class Attributes • attributes (fields, instance variables) ▫ visibility name : type [count] = default_value ▫ visibility: + public # protected - private ~ package (default) / derived ▫ underline static attributes ▫ derived attribute: not stored, but can be computed from other attribute values ▫ attribute example:  balance : - = double 0.00 7
  • 9. Comments • represented as a folded note, attached to the appropriate class/method/etc by a dashed line 9
  • 10. Relationships btwn. classes •generalization: an inheritance relationship ▫inheritance between classes ▫interface implementation •association: a usage relationship ▫dependency ▫aggregation ▫composition 10
  • 14. Association types • aggregation: "is part of" ▫ symbolized by a clear white diamond • composition: "is entirely made of" ▫ stronger version of aggregation ▫ the parts live and die with the whole ▫ symbolized by a black diamond • dependency: "uses temporarily" ▫ symbolized by dotted line ▫ often is an implementation detail, not an intrinsic part of that object's state 14