UML Diagrams: Class Diagram
UML Diagrams: Class Diagram
UML Diagrams: Class Diagram
CLASS DIAGRAM
Class Diagrams
The main building block in object oriented modeling
They are used both for general conceptual modeling
of the systematics of the application, and for detailed
modeling translating the models into programming
code
The classes diagram represent both the main objects
and/or interactions in the application and the objects
to be programmed
In the diagram these classes are represented with
boxes which contain three parts
Class Diagrams
A class with three sections.
The upper part holds the name of the class
The middle part contains the attributes of the class
The bottom part gives the methods or operations the class can
take or undertake
Class Diagrams
In the system design of a system, a number of classes are
identified and grouped together in a class diagram which helps
to determine the static relations between those objects
With detailed modeling, the classes of the conceptual design are
often split in a number of subclasses
In order to further describe the behavior of systems, these
diagrams can be complemented by state diagram or UML state
machine
Also instead of class diagrams, Object role modeling can be
used if you just want to model the classes and their
relationships
The class icon
Defines
Persistent system state
System behavior
The class icon has
Name
Attributes
Operations
It’s a rectangle divided
into three
compartments.
Steps followed
Draw class symbol in the editor and
name it
List the class attributes
List the class operations/methods
Make the links and associations
Give notations
Structural Modeling: Core Elements
Construct Description Syntax
class a description of a set of objects
that share the same attributes,
operations, methods, relationships
and semantics.
interface a named set of operations that
«interface»
characterize the behavior of an
element.
component a modular, replaceable and
significant part of a system that
packages implementation and
exposes a set of interfaces.
node a run-time physical object that
represents a computational
resource.
POSterminal +create()
<<use>> <<interface>> +login(UserName, Passwd)
POSterminal Store +find(StoreId)
+getPOStotals(POSid)
+getPOStotals(POSid) +updateStoreTotals(Id,Sales)
+updateStoreTotals(Id,Sales) +get(Item)
+get(Item)
common ones
of a Generalization is a hollow
Separate Target Style
Fig. 3-47, UML Notation Guide Reference: OMG tutorial on UML by Cris Kobryn
Generalization
Note that this relationship bears
Shape
no resemblance to the
Separate Target Style
biological parent/child
relationship: the use of these Polygon Ellipse Spline . ..
Fig. 3-47, UML Notation Guide Reference: OMG tutorial on UML by Cris Kobryn
Dependencies
Dependency is a weaker ClassA
«friend»
ClassB ClassD
form of relationship
«friend»
operationZ()
«instantiate»
It exists if a class is a
parameter variable or
local variable of a
method of another class
Reference: www.smartdraw.com
Object Diagram
A diagram that shows a
complete or partial view
of the structure of a
modeled system at a
specific time
Focuses on some
particular set of object
instances and
attributes, and the links
between the instances
Object Diagram
A set of objects (instances of
classes) and their
relationships
A static snapshot of a
dynamic view of the system
Represents real or
prototypical cases
Very useful before
developing class diagrams
Worth saving as elaborations
of class diagrams
Instance Specifications
Each object and link is represented by an Instance
Specification
This can show an object's classifier (e.g. an abstract
or concrete class) and instance name, as well as
attributes and other structural features using slots
Each slot corresponds to a single attribute or feature,
and may include a value for that entity
Instance Specifications
The name on an instance specification optionally
shows …
an instance name,
a ':' separator, and
optionally one or more classifier names separated by
commas
The contents of slots, if any, are included below the
names, in a separate attribute compartment
A link is shown as a solid line, and represents an
instance of an association
Example
Object diagram
Class diagram
More Examples
What does this object
diagram tell us?
More Examples
What would the class
diagram look like that
goes along with this
object diagram?
More Examples
Does this make
sense to you?
More Examples