Professional Documents
Culture Documents
Class Diagram
Lecture 12 13 14
Domain Modelling
Using UML diagram to construct a
model of the real-world system:
Understand the problem domain.
CPSC-4360-01, CPSC-5360-01,
Lecture 3
Name
Multiplicity
Attributes
Multiplicity
Association
Class
1/7/16
CPSC-4360-01, CPSC-5360-01,
Lecture 3
1/7/16
CPSC-4360-01, CPSC-5360-01,
Lecture 3
1/7/16
CPSC-4360-01, CPSC-5360-01,
Lecture 3
Defining a Relationship
Give a name to the relationship:
use a verb so that the relationship can be
read as a sentence:
A customer can make many reservations.
1/7/16
CPSC-4360-01, CPSC-5360-01,
Lecture 3
Use of Constraints
Not all domain properties can be
shown graphically:
e.g., it should be impossible to doublebook a table.
1/7/16
CPSC-4360-01, CPSC-5360-01,
Lecture 3
Correctness
How do we know when a domain
model is complete?
we don't: there are lots of plausible
models in most cases.
CPSC-4360-01, CPSC-5360-01,
Lecture 3
Class Diagrams
Gives an overview of a system by
showing its classes and the
relationships among them.
Class diagrams are static
they display what interacts but not
what happens when they do interact
Specification
Focus on the interfaces of the software
Implementation
Focus on the implementation of the software
Attributes
Operations
Class name
Class attributes (i.e. data members, variables)
Class operations (i.e. methods)
Modifiers
Private: Public: +
Protected: #
Aggregation
Composition
Inheritance
Binary Association
Binary Association: Both entities Know About each other
myB.service();
myA.doSomething();
Unary Association
A knows about B, but B knows nothing about A
myB.service();
Aggregation
Aggregation is an association with a collection-member relationship
void doSomething()
aModule.service();
Hollow diamond on
the Collection side
No sole ownership implied
Composition
Composition is Aggregation with:
Lifetime Control (owner controls construction, destruction)
Part object may belong to only one whole object
members[0] =
new Employee();
delete members[0];
Filled diamond on
side of the Collection
Inheritance
Standard concept of inheritance
Base Class
Derived Class
class B() extends A
UML Multiplicities
Multiplicity of attributes
Links on associations to specify more details about the relationship
Multiplicities
Meaning
0..1
0..* or *
1..*
Association Details
Can assign names to the ends of the
association to give further
information
Team
Employee
-group
-members: Employee
-individual
1
*
-Name : string
+ID : long
#Salary : double
-adfaf : bool
+getName() : string
+setName()
-calcInternalStuff(in x : byte, in y : decimal)
Constraints
PreConditions must be true before a
method is executed