SlideShare a Scribd company logo
1 of 16
Download to read offline
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

What's hot

Uml Presentation
Uml PresentationUml Presentation
Uml Presentationanasz3z3
 
Class diagram
Class diagramClass diagram
Class diagramSESP123
 
Unified modeling language diagrams
Unified modeling language diagramsUnified modeling language diagrams
Unified modeling language diagramsAlaa Ahmed
 
UML Architecture and Views
UML Architecture and ViewsUML Architecture and Views
UML Architecture and ViewsKumar
 
unified modelling language(UML) diagrams
unified modelling language(UML) diagramsunified modelling language(UML) diagrams
unified modelling language(UML) diagramspratyashi satapathy
 
UML DIAGRAMS
UML DIAGRAMSUML DIAGRAMS
UML DIAGRAMSSelshaCs
 
Class Diagram for Online Examination system
Class Diagram for Online Examination systemClass Diagram for Online Examination system
Class Diagram for Online Examination systemHASIM ALI
 
UML for OOAD
UML for OOADUML for OOAD
UML for OOADDang Tuan
 
Uml in software engineering
Uml in software engineeringUml in software engineering
Uml in software engineeringMubashir Jutt
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSAshita Agrawal
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentationmewaseem
 
Object and class relationships
Object and class relationshipsObject and class relationships
Object and class relationshipsPooja mittal
 

What's hot (20)

Class diagram, use case and sequence diagram
Class diagram, use case and sequence diagramClass diagram, use case and sequence diagram
Class diagram, use case and sequence diagram
 
Presentation on uml
Presentation on umlPresentation on uml
Presentation on uml
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Class diagram
Class diagramClass diagram
Class diagram
 
Cs8592 ooad unit 1
Cs8592 ooad unit 1Cs8592 ooad unit 1
Cs8592 ooad unit 1
 
Unified modeling language diagrams
Unified modeling language diagramsUnified modeling language diagrams
Unified modeling language diagrams
 
Class diagram
Class diagramClass diagram
Class diagram
 
UML Architecture and Views
UML Architecture and ViewsUML Architecture and Views
UML Architecture and Views
 
unified modelling language(UML) diagrams
unified modelling language(UML) diagramsunified modelling language(UML) diagrams
unified modelling language(UML) diagrams
 
UML tutorial
UML tutorialUML tutorial
UML tutorial
 
UML DIAGRAMS
UML DIAGRAMSUML DIAGRAMS
UML DIAGRAMS
 
Uml
UmlUml
Uml
 
Class Diagram for Online Examination system
Class Diagram for Online Examination systemClass Diagram for Online Examination system
Class Diagram for Online Examination system
 
UML for OOAD
UML for OOADUML for OOAD
UML for OOAD
 
Uml in software engineering
Uml in software engineeringUml in software engineering
Uml in software engineering
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMS
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Experiment no
Experiment noExperiment no
Experiment no
 
Object and class relationships
Object and class relationshipsObject and class relationships
Object and class relationships
 
Uml
UmlUml
Uml
 

Similar to Object Oriented Class Diagram Lecture

Similar to Object Oriented Class Diagram Lecture (20)

classdiagram.pptx
classdiagram.pptxclassdiagram.pptx
classdiagram.pptx
 
UNIT-3 Design Using UML (1).pptx
UNIT-3 Design Using UML (1).pptxUNIT-3 Design Using UML (1).pptx
UNIT-3 Design Using UML (1).pptx
 
Class Diagrams
Class DiagramsClass Diagrams
Class Diagrams
 
SMD Unit ii
SMD Unit iiSMD Unit ii
SMD Unit ii
 
Uml package diagram
Uml package  diagramUml package  diagram
Uml package diagram
 
UML (Hemant rajak)
UML (Hemant rajak)UML (Hemant rajak)
UML (Hemant rajak)
 
Cs8592 ooad unit 1
Cs8592 ooad unit 1Cs8592 ooad unit 1
Cs8592 ooad unit 1
 
OOM Unit I - III.pdf
OOM Unit I - III.pdfOOM Unit I - III.pdf
OOM Unit I - III.pdf
 
1. introduction to uml
1. introduction to uml1. introduction to uml
1. introduction to uml
 
Class diagram
Class diagramClass diagram
Class diagram
 
CS8592-OOAD Lecture Notes Unit-2
CS8592-OOAD Lecture Notes Unit-2CS8592-OOAD Lecture Notes Unit-2
CS8592-OOAD Lecture Notes Unit-2
 
UML and Case study
UML and Case study UML and Case study
UML and Case study
 
Uml diagrams
Uml diagramsUml diagrams
Uml diagrams
 
UML-Advanced Software Engineering
UML-Advanced Software EngineeringUML-Advanced Software Engineering
UML-Advanced Software Engineering
 
classes & objects introduction
classes & objects introductionclasses & objects introduction
classes & objects introduction
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
introofUML.pptx
introofUML.pptxintroofUML.pptx
introofUML.pptx
 
Software Testing and UML Lab
Software Testing and UML LabSoftware Testing and UML Lab
Software Testing and UML Lab
 
Cs 1023 lec 10 uml (week 3)
Cs 1023 lec 10 uml (week 3)Cs 1023 lec 10 uml (week 3)
Cs 1023 lec 10 uml (week 3)
 
OOP_Module 2.pptx
OOP_Module 2.pptxOOP_Module 2.pptx
OOP_Module 2.pptx
 

Recently uploaded

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 

Recently uploaded (20)

AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(ANVI) Koregaon Park Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 

Object Oriented Class Diagram Lecture

  • 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