Functional Modelling
Marya Butt, PhD.
Researcher Data Driven Smart Society (DDSS)
BIG DATA, Computer Vision, Cloud Computing
Faculty of Engineering Design and Computing
Mob: +31(0) 0611878759
E:
[email protected]AGENDA
Class Diagram
• Association(multi
Recap plicity)
• Generalisation Mock Exam2
• Aggregation
• Composition
• Dependency
Recap: Use Case
Diagrams
(Language Overview)
Use Case Description
Objective
Actor(s)
Preconditions
Step-by-step plan
Postconditions
Recap: Activity
Diagrams
(Language
Overview)
Mock Exam I- Version II
(Activity Diagram)
… AppointmentScheduler
function verifies availability and
lets the patient pick a suitable
time
…..confirms the booking by
checking the patient’s insurance
or payment method using the
ConfirmVerification routine
….the NotificationService
procedure sends a confirmation
with details
Mock Exam I- Version II
(Activity Diagram)
Mock Exam I- Version II (usecase Description)
m is sing
t or (s) is
Ac
Recap: Last Session
Patient has
prescriptio
Swimlanes n
(Activity Diagram)
Activities+ Actors(stakeholders)
In Vertical Columns
Fork node vs Join bar
Post Condition &
Precondition Patient
gets his
report
CLASS ( a building unit)
Class= template/artifact
Objects exhibit attributes and behaviour
Classes must be instantiated for objects
creation
Class
The descriptor for a set of objects
that share the same attributes,
operations, methods, relationships,
and behavior. A class represents a
concept within the system being
modeled.
(Rumbaugh, Jacobson, & Booch,
1999, p. 185)
Associations
One-on-one relationship (1 on 1)
Client Creditcard
-adress:char -number:int
-name:char -validity:char
-telephone:int
+call():void +payment():void
+order(item):void +amountwithdrawn:void
+changedetails():void
In UML, a relationship between classes is called an
association.
A line between classes indicates a relationship.
Rule: a customer only has one credit card, and a credit card
belongs to only one customer.
Associations
Give name to relationship
Client Creditcard
-adress:char -number:int
-name:char -validity:char
-telephone:int uses
+call():void +payment():void
+order(item):void +amountwithdrawn:void
+changedetails():void
• You can indicate the name of the relationship if it is not clear.
• You can indicate the relationship with an arrow so that it is
clear how the relationship works.
In this case, a Customer object can use the Credit Card object
and not the other way around, as a customer has a credit
card.
Associations
One-on-many relationships (1 on N)
Client Creditcard
-adress:char -number:int
-name:char -validity:char
-telephone:int owns
+call():void 1 0..* +payment():void
+order(item):void +amountwithdrawn:void
+changedetails():void
Multiplicity
• Multiplicity of a relationship: indicates how many instances of the class
can occur ‘A customer has no or multiple credit cards’.
0..1 No instances or one instance.
1 Precisely one instance.
0..* No or multiple instances.
1..* One or multiple instances.
Associations
Many-on-many relationships (N on M)
A lorry has
Truck Driver multiple drivers.
A driver belongs
to multiple
lorries.
Truck Journey Driver
Driver
Truck Driver You use an association class
if there is precisely one
journey with a (lorry, driver)
combination.
Journey
Use this if you want to
establish information about
the relationship itself.
Generalisation (inheritance)
* Parent-child relationship
* Also known as an ‘is a’ relationship
* The child has all of the attributes of the mother
1. Attributes
2. Behaviour
3. Relationships
* Child can define more attributes
* The child can redefine the inherited behavior of the mother
(override)
* The parent is not aware of the existence and attributes of
the child
Generalisation: example
Source:geeksforgeeks
Multiple inheritance (1)
Transport
+start()
+stop()
Aeroplane Ship
+fly()
+land() +mooring
Seaplane
+fly()
+land()
+mooring()
Multiple inheritance (2)
Transport
+start()
+stop()
Aeroplane Ship
+fly()
+land() +mooring
Seaplane
+mooring()
Multiple inheritance (3)
Transport
+start()
+stop()
Aeroplane Ship
+fly()
+land() +mooring()
Seaplane
+fly()
+land()
Multiple inheritance (4) Transport
+start()
+stop()
Aeroplane Ship
+fly()
+land() +mooring()
Seaplane
Multiple inheritance (5)
Transport
+start()
+stop()
Aeroplane Ship Bicycle
+fly()
+mooring() +ringbell()
+land()
Seaplane
Class diagram (Bank Scenario)
Forms of Association
Aggregation and Composition
Aggregation
Also known as a ‘has a’ relationship:
A customer has an address
A car has an engine
A class has students
Use the hollow(unfilled) diamond
The relationship is weak: if the Class
classroom or it objects no longer exist, the
Student objects continue to exist without a
relationship with the Class object.
Classroom
Class Student
Composition
* Composition is also an aggregation.
* special form ‘consists of’
* One class is owner of the other class.
* The relationship is strong: if the object owner no
longer exists, the linked objects also cease to exist.
if the Document
object no longer Document Pages
exists, the Page
objects also
cease to exist.
Scrollbar
Browser
if the browser
is closed, scrollbar
Tabs and the Tabs will
no longer exist
Aggregation and Association
Example 1
Aggregation and Association
Example 2
Another way to show associationAn association class is added
(what is missing?) whenever there is an m-n
relationship between objects.
Publication
Multiple
Inheritance (an
example)
Source:dreamincode.n
et
Class diagram
(Recommended Structure of a Class)
Webshop
(an example)
Why is this
object/class
added?
Dependency
between order
and enum
‘orderstatus’
Shown by
dashed
arrowhead line
Activity: Mock Exam 2
3. Create a UML class diagram for SafeSpray
management software. (35 points, see point
distribution below)
Points distribution class diagram:
- Classes (minimum of 4) and attributes (minimum of 5) 15
points
- Associations with multiplicities 10 points
- Use of inheritance 5 points
- Use of composition and/or aggregation 5 points
- Add methods to the classes (DETAILED CLASS DIAGRAM)
+5 BONUS POINTS
Useful links
Model web pointers over Class Diagrams/Domain:
https://www.youtube.com/watch?v=BhEoV57nj0Q
https://www.youtube.com/watch?v=3cmzqZzwNDM
Domain Modelling – Open University (with exercises and ans
wers)
33