SlideShare a Scribd company logo
1 of 30
UML Class Diagrams
1
What They Are
• They illustrate classes, interfaces, and their
associations. They are used for static object
modeling.
2
3
Design Class Diagram
• A class diagram can be used to visualize a
domain model. We also need a unique term to
clarify when the class diagram is used in a
software or design perspective. A common
modeling term for this purpose is design class
diagram (DCD)
4
Design Class Diagram
5
Classifier
• A UML classifier is “a model element that
describes behavioral and structure features”.
Classifiers can also be specialized. They are a
generalization of many of the elements of the
UML, including classes, interfaces, use cases,
and actors. In class diagrams, the two most
common classifiers are regular classes and
interfaces.
6
Showing UML Attributes
• Attribute text notation such as: currentSale :
Sale, Association line notation, or both
• <visibility> name : type multiplicity = default
{property string}
• Attributes are assumed private if no visibility
is given
• Arrow shows that the object where the arrow
starts has one object of the object to which it
points.
7
UML Attributes
8
UML Attributes
• Multiplicity shows how many on the left can
associate with how many on the right
• Role name
• Attributes are assumed private unless
otherwise noted
9
Attribute Text vs. Association Lines
• Use text notation for primitive data types,
even things like Zip codes that may have
components but are not complex
• Use association for everything else.
10
Collection Attributes
11
Note Symbols
• A UML note symbol is displayed as a dog-eared
rectangle with a dashed line to the annotated
element; they’ve already been used throughout
the book. A note symbol may represent several
things, such as:
– a UML note or comment, which by definition have no
semantic impact
– a UML constraint, in which case it must be encased in
braces ‘{…}’
– a method body—the implementation of a UML
operation
12
Operations and Methods
• A method is the implementation of an
operation
13
The Create operation
• This is a constructor call
• You can use <<constructor>> to make this
explicit
14
Keywords
• A UML keyword is a textual adornment to
categorize a model element
• Keywords include <<actor>>, <<Interface>>,
[abstract], [ordered]
15
Stereotypes, Profiles, Tags
• Stereotypes are also shown in guillemets
symbols . They are not keywords. A
stereotype represents a refinement to an
existing modeling concept
16
Properties and Property Strings
• A property is “a named value denoting a
characteristic of an element
• Textual approach is to use the UML property
string {name1=value1, name2=value2} format,
such as {abstract, visibility=public}
17
Generalization
• A taxonomic relationship between a more
general classifier and a more specific classifier
• This can imply inheritance, but not at the
conceptual level.
18
Dependency
• Similar to association. Indicates that a client
element has knowledge of another supplier element,
and a change in the supplier could affect the client
• (Supplier and client are descriptive terms, not
classes)
• Dependency lines are common on class and package
diagrams
• Use to depict global, parameter variable, local
variable, and static-method dependency
19
Types of Dependency
• Having an attribute of supplier type
• Send a message to a supplier
• Receiving a parameter of supplier type
• Supplier is a superclass or interface
• Indicated by a dashed line arrow
20
Interfaces
21
Composition Vs. Aggregation
• Aggregation is a vague association suggesting
whole-part relationships. No meaningful
semantics in UML versus association.
• Composition, or composite aggregation, is a
strong kind of whole-part relationship.
• Implies that an instance of the part belongs to
only one composite instance of the whole
22
Composition
• For example the Monopoly board consists of
40 squares
• A square can be part of only one board at any
time.
23
Constraints
• Constraints is a restriction on a UML element.
• Shown as text between braces
• {size > 0}
24
Qualified Association
• Uses a qualifier to select an object or set of
objects from a larger set
• For example, looking up something in a
HashMap
25
Association Class
• Allows you to treat an association as a class,
such that it can have attributes
26
Singleton Class
• Only one instance of a Singleton class (pattern
explained later) is ever instantiated.
• For example, your main class in most
programs is a Singleton, although this may not
be its dominant pattern.
27
Template Classes and Interfaces
• These are equivalent to C++ or Java
“generics.”
• That is, you can type a collection class.
28
User-Defined Compartments
• In a class diagram you can define your own
compartments:
29
DataAccessObject
Id: int
doX();
Exceptions thrown
DatabaseException
IOExeception
Responsibilities
Serialize and write objects
Read and deserialize objects
Active Class
• An active object runs on and controls its own
thread of execution
• In UML, it is shown with double vertical lines
on the left and right of the class box.
30

More Related Content

What's hot

Uml Presentation
Uml PresentationUml Presentation
Uml Presentationanasz3z3
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentationmewaseem
 
Uml deployment diagram
Uml deployment diagramUml deployment diagram
Uml deployment diagramAsraa Batool
 
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 netmekhap
 
Class diagram
Class diagramClass diagram
Class diagramSESP123
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSAshita Agrawal
 
Uml structural diagrams
Uml structural diagramsUml structural diagrams
Uml structural diagramsSwathy T
 
Introduction to Rational Rose
Introduction to Rational RoseIntroduction to Rational Rose
Introduction to Rational RoseMunaam Munawar
 
Introduction to object-oriented analysis and design (OOA/D)
Introduction to object-oriented analysis and design (OOA/D)Introduction to object-oriented analysis and design (OOA/D)
Introduction to object-oriented analysis and design (OOA/D)Ahmed Farag
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLAjit Nayak
 
UML Class Diagram G-3-122139
UML Class Diagram G-3-122139UML Class Diagram G-3-122139
UML Class Diagram G-3-122139Hansi Thenuwara
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbolsKumar
 

What's hot (20)

Uml class Diagram
Uml class DiagramUml class Diagram
Uml class Diagram
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Sequence diagram
Sequence diagramSequence diagram
Sequence diagram
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
Uml Presentation
Uml PresentationUml Presentation
Uml Presentation
 
Uml deployment diagram
Uml deployment diagramUml deployment diagram
Uml deployment diagram
 
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
 
Class diagram
Class diagramClass diagram
Class diagram
 
Class diagram
Class diagramClass diagram
Class diagram
 
INTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMSINTRODUCTION TO UML DIAGRAMS
INTRODUCTION TO UML DIAGRAMS
 
Uml structural diagrams
Uml structural diagramsUml structural diagrams
Uml structural diagrams
 
Introduction to Rational Rose
Introduction to Rational RoseIntroduction to Rational Rose
Introduction to Rational Rose
 
Introduction to object-oriented analysis and design (OOA/D)
Introduction to object-oriented analysis and design (OOA/D)Introduction to object-oriented analysis and design (OOA/D)
Introduction to object-oriented analysis and design (OOA/D)
 
Class Diagram
Class DiagramClass Diagram
Class Diagram
 
Object Oriented Analysis Design using UML
Object Oriented Analysis Design using UMLObject Oriented Analysis Design using UML
Object Oriented Analysis Design using UML
 
UML Class Diagram G-3-122139
UML Class Diagram G-3-122139UML Class Diagram G-3-122139
UML Class Diagram G-3-122139
 
Domain Modeling
Domain ModelingDomain Modeling
Domain Modeling
 
UML
UMLUML
UML
 
UML diagrams and symbols
UML diagrams and symbolsUML diagrams and symbols
UML diagrams and symbols
 
Domain object model
Domain object modelDomain object model
Domain object model
 

Similar to Class diagram (20)

Ooad static diagram
Ooad static diagramOoad static diagram
Ooad static diagram
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
UML and Case study
UML and Case study UML and Case study
UML and Case study
 
Ooad lab manual
Ooad  lab manualOoad  lab manual
Ooad lab manual
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
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
 
ITSE_10(UML,OO).pptx
ITSE_10(UML,OO).pptxITSE_10(UML,OO).pptx
ITSE_10(UML,OO).pptx
 
1. introduction to uml
1. introduction to uml1. introduction to uml
1. introduction to uml
 
Unified Modelling Language
Unified Modelling Language Unified Modelling Language
Unified Modelling Language
 
Uml struct2
Uml struct2Uml struct2
Uml struct2
 
Uml package diagram
Uml package  diagramUml package  diagram
Uml package diagram
 
SE UML.ppt
SE UML.pptSE UML.ppt
SE UML.ppt
 
lecture8UML Diagrams.pptx
lecture8UML Diagrams.pptxlecture8UML Diagrams.pptx
lecture8UML Diagrams.pptx
 
UML Modeling in Java
UML Modeling in JavaUML Modeling in Java
UML Modeling in Java
 
UML (Hemant rajak)
UML (Hemant rajak)UML (Hemant rajak)
UML (Hemant rajak)
 
Claas diagram
Claas diagramClaas diagram
Claas diagram
 
Claas diagram
Claas diagramClaas diagram
Claas diagram
 
UML
UMLUML
UML
 
Chapter 2.pptx
Chapter 2.pptxChapter 2.pptx
Chapter 2.pptx
 
UML Trainings
UML TrainingsUML Trainings
UML Trainings
 

Recently uploaded

TOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptxTOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptxdharshini369nike
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentationtahreemzahra82
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxmalonesandreagweneth
 
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |aasikanpl
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxkessiyaTpeter
 
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tantaDashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tantaPraksha3
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.PraveenaKalaiselvan1
 
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptxTHE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptxNandakishor Bhaurao Deshmukh
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |aasikanpl
 
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxAnalytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxSwapnil Therkar
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Patrick Diehl
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real timeSatoshi NAKAHIRA
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzohaibmir069
 
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.aasikanpl
 
Transposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptTransposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptArshadWarsi13
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxpriyankatabhane
 

Recently uploaded (20)

TOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptxTOTAL CHOLESTEROL (lipid profile test).pptx
TOTAL CHOLESTEROL (lipid profile test).pptx
 
Volatile Oils Pharmacognosy And Phytochemistry -I
Volatile Oils Pharmacognosy And Phytochemistry -IVolatile Oils Pharmacognosy And Phytochemistry -I
Volatile Oils Pharmacognosy And Phytochemistry -I
 
Harmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms PresentationHarmful and Useful Microorganisms Presentation
Harmful and Useful Microorganisms Presentation
 
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Munirka Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptxLIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
LIGHT-PHENOMENA-BY-CABUALDIONALDOPANOGANCADIENTE-CONDEZA (1).pptx
 
Hot Sexy call girls in Moti Nagar,🔝 9953056974 🔝 escort Service
Hot Sexy call girls in  Moti Nagar,🔝 9953056974 🔝 escort ServiceHot Sexy call girls in  Moti Nagar,🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Moti Nagar,🔝 9953056974 🔝 escort Service
 
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Lajpat Nagar (Delhi) |
 
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptxSOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
SOLUBLE PATTERN RECOGNITION RECEPTORS.pptx
 
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tantaDashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
Dashanga agada a formulation of Agada tantra dealt in 3 Rd year bams agada tanta
 
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
BIOETHICS IN RECOMBINANT DNA TECHNOLOGY.
 
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptxTHE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
THE ROLE OF PHARMACOGNOSY IN TRADITIONAL AND MODERN SYSTEM OF MEDICINE.pptx
 
Engler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomyEngler and Prantl system of classification in plant taxonomy
Engler and Prantl system of classification in plant taxonomy
 
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
Call Us ≽ 9953322196 ≼ Call Girls In Mukherjee Nagar(Delhi) |
 
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptxAnalytical Profile of Coleus Forskohlii | Forskolin .pptx
Analytical Profile of Coleus Forskohlii | Forskolin .pptx
 
Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?Is RISC-V ready for HPC workload? Maybe?
Is RISC-V ready for HPC workload? Maybe?
 
Grafana in space: Monitoring Japan's SLIM moon lander in real time
Grafana in space: Monitoring Japan's SLIM moon lander  in real timeGrafana in space: Monitoring Japan's SLIM moon lander  in real time
Grafana in space: Monitoring Japan's SLIM moon lander in real time
 
zoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistanzoogeography of pakistan.pptx fauna of Pakistan
zoogeography of pakistan.pptx fauna of Pakistan
 
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
Call Girls in Aiims Metro Delhi 💯Call Us 🔝9953322196🔝 💯Escort.
 
Transposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.pptTransposable elements in prokaryotes.ppt
Transposable elements in prokaryotes.ppt
 
Speech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptxSpeech, hearing, noise, intelligibility.pptx
Speech, hearing, noise, intelligibility.pptx
 

Class diagram

  • 2. What They Are • They illustrate classes, interfaces, and their associations. They are used for static object modeling. 2
  • 3. 3
  • 4. Design Class Diagram • A class diagram can be used to visualize a domain model. We also need a unique term to clarify when the class diagram is used in a software or design perspective. A common modeling term for this purpose is design class diagram (DCD) 4
  • 6. Classifier • A UML classifier is “a model element that describes behavioral and structure features”. Classifiers can also be specialized. They are a generalization of many of the elements of the UML, including classes, interfaces, use cases, and actors. In class diagrams, the two most common classifiers are regular classes and interfaces. 6
  • 7. Showing UML Attributes • Attribute text notation such as: currentSale : Sale, Association line notation, or both • <visibility> name : type multiplicity = default {property string} • Attributes are assumed private if no visibility is given • Arrow shows that the object where the arrow starts has one object of the object to which it points. 7
  • 9. UML Attributes • Multiplicity shows how many on the left can associate with how many on the right • Role name • Attributes are assumed private unless otherwise noted 9
  • 10. Attribute Text vs. Association Lines • Use text notation for primitive data types, even things like Zip codes that may have components but are not complex • Use association for everything else. 10
  • 12. Note Symbols • A UML note symbol is displayed as a dog-eared rectangle with a dashed line to the annotated element; they’ve already been used throughout the book. A note symbol may represent several things, such as: – a UML note or comment, which by definition have no semantic impact – a UML constraint, in which case it must be encased in braces ‘{…}’ – a method body—the implementation of a UML operation 12
  • 13. Operations and Methods • A method is the implementation of an operation 13
  • 14. The Create operation • This is a constructor call • You can use <<constructor>> to make this explicit 14
  • 15. Keywords • A UML keyword is a textual adornment to categorize a model element • Keywords include <<actor>>, <<Interface>>, [abstract], [ordered] 15
  • 16. Stereotypes, Profiles, Tags • Stereotypes are also shown in guillemets symbols . They are not keywords. A stereotype represents a refinement to an existing modeling concept 16
  • 17. Properties and Property Strings • A property is “a named value denoting a characteristic of an element • Textual approach is to use the UML property string {name1=value1, name2=value2} format, such as {abstract, visibility=public} 17
  • 18. Generalization • A taxonomic relationship between a more general classifier and a more specific classifier • This can imply inheritance, but not at the conceptual level. 18
  • 19. Dependency • Similar to association. Indicates that a client element has knowledge of another supplier element, and a change in the supplier could affect the client • (Supplier and client are descriptive terms, not classes) • Dependency lines are common on class and package diagrams • Use to depict global, parameter variable, local variable, and static-method dependency 19
  • 20. Types of Dependency • Having an attribute of supplier type • Send a message to a supplier • Receiving a parameter of supplier type • Supplier is a superclass or interface • Indicated by a dashed line arrow 20
  • 22. Composition Vs. Aggregation • Aggregation is a vague association suggesting whole-part relationships. No meaningful semantics in UML versus association. • Composition, or composite aggregation, is a strong kind of whole-part relationship. • Implies that an instance of the part belongs to only one composite instance of the whole 22
  • 23. Composition • For example the Monopoly board consists of 40 squares • A square can be part of only one board at any time. 23
  • 24. Constraints • Constraints is a restriction on a UML element. • Shown as text between braces • {size > 0} 24
  • 25. Qualified Association • Uses a qualifier to select an object or set of objects from a larger set • For example, looking up something in a HashMap 25
  • 26. Association Class • Allows you to treat an association as a class, such that it can have attributes 26
  • 27. Singleton Class • Only one instance of a Singleton class (pattern explained later) is ever instantiated. • For example, your main class in most programs is a Singleton, although this may not be its dominant pattern. 27
  • 28. Template Classes and Interfaces • These are equivalent to C++ or Java “generics.” • That is, you can type a collection class. 28
  • 29. User-Defined Compartments • In a class diagram you can define your own compartments: 29 DataAccessObject Id: int doX(); Exceptions thrown DatabaseException IOExeception Responsibilities Serialize and write objects Read and deserialize objects
  • 30. Active Class • An active object runs on and controls its own thread of execution • In UML, it is shown with double vertical lines on the left and right of the class box. 30