Download as pdf or txt
Download as pdf or txt
You are on page 1of 53

Chapter 5

System Modeling with UML

30/10/2014 Chapter 5 System Modeling 1


Topics covered

 System modelling

 Context models

 Interaction models

 Structural models

 Behavioral models

 Model-driven engineering

30/10/2014 Chapter 5 System Modeling 2


System modeling

 What
 the process of developing abstract models of a
system,
 Different view/perspective.
 How
 Unified modeling language (UML).
 Why
 Analyst to understand system functionality
 To communicate with customers.
30/10/2014 Chapter 5 System Modeling 3
System perspectives

 External perspective:
 model system environment (context model)
 Interaction perspective
 between a system and its environment
 between system components with each other.
 Structural perspective
 The structure system data
 Behavioral perspective
 model the system dynamics and how it responds to
events.
30/10/2014 Chapter 5 System Modeling 4
UML diagram types

 Activity diagrams

 Use case diagrams

 Sequence diagrams

 Class diagrams

 State diagrams

30/10/2014 Chapter 5 System Modeling 5


Context models

30/10/2014 Chapter 5 System Modeling 6


Context models

 illustrates the operational context of a system


 show what lies outside the system boundaries.
 used with BPM for more illustration with UML activity diag.

 Architectural models

• show the system and its relationship with other


systems.

30/10/2014 Chapter 5 System Modeling 7


The context of the Mentcare system

30/10/2014 Chapter 5 System Modeling 8


Context models illustration in business process

BPM of involuntary detention

30/10/2014 Chapter 5 System Modeling 9


User registration activity diagram example

10
Interaction models

30/10/2014 Chapter 5 System Modeling 11


Interaction models

 Interaction
 user-system interaction

 system-system interaction.

 components interaction.
 Tools

 use case diagrams

 sequence diagrams may.

30/10/2014 Chapter 5 System Modeling 12


Use case modeling

 Why
• developed to support requirements elicitation
• each use case represents a discrete task that interacts with
the system.
 Formats
• Diagram: provides an overview of the use case
• Textual: details description.
 Components
• Actor: people or other systems.
• Ellipse: actual use-case

30/10/2014 Chapter 5 System Modeling 13


Use cases in the Mentcare system involving the
role ‘Medical Receptionist’

30/10/2014 Chapter 5 System Modeling 14


Transfer-data use case

 A use case in the Mentcare system

30/10/2014 Chapter 5 System Modeling 15


Textual description of the ‘Transfer data’ use-case

MHC-PMS: Transfer data


Actors 1. Medical receptionist
2. patient records system (PRS)
Description A receptionist may transfer data from the Mentcase
system to a general patient record database that is maintained
by a health authority. The information transferred may either be
updated personal information (address, phone number, etc.) or a
summary of the patient’s diagnosis and treatment.

Data 1. Patient’s personal information


2. treatment summary
Stimulus User command issued by medical receptionist
Response Confirmation that PRS has been updated
Comments The receptionist must have appropriate security
permissions to access the patient information and the PRS.

30/10/2014 Chapter 5 System Modeling 16


Online shopping use-case diagram

30/10/2014 Chapter 5 System Modeling 17


Bank ATM use-case diagram

30/10/2014 Chapter 5 System Modeling 18


Sequence diagrams

 Why

• models interactions between actors and system objects.

• shows the sequence of interactions that take place during


a particular use case or use case instance.
• Components

• objects and actors: listed horizontally

• time: interaction progression, listed vertically

• arrows: Interactions between objects.


30/10/2014 Chapter 5 System Modeling 19
Sequence diagram

Objects

30/10/2014
Sequence diagram for "View patient
information“ use-case

30/10/2014 Chapter 5 System Modeling 21


Sequence
diagram for
“transfer data“
use-case
Sequence
diagram for
“matching
driver-
passenger“
use-case

Car Sharing System


Structural models

30/10/2014 Chapter 5 System Modeling 24


Class diagrams

 Used in object-oriented system

 shows the classes and association among them.


 An association is a link between classes.
 Concrete instance of a class is an object
 Components
 Attributes: structure feature, what object knows
 Operations: behavioral feature, what object can do

30/10/2014 Chapter 5 System Modeling 25


Classes and associations in the MHC-PMS

30/10/2014 Chapter 5 System Modeling 26


The Consultation class

30/10/2014 Chapter 5 System Modeling 27


Class relationship

 Generalization
 ‘is-a’ relationship
 A solid line with a hollow arrowhead that point from the
child to the parent class

30/10/2014 Chapter 5 System Modeling 28


Class relationship

 Simple association
 A structural link between two peer classes
 A solid line connecting two classes

30/10/2014 Chapter 5 System Modeling 29


Class relationship

 Aggregation
 ‘part-of’ relationship
 Objects of Class1 and Class2 have separate lifetimes
 A solid line with an unfilled diamond at the association
end connected to the class of composite

30/10/2014 Chapter 5 System Modeling 30


Class relationship

 Composition
 Special type of aggregation
 Class2 cannot stand by itself
 A solid line with filled diamond at the association end
connected to the class of composite

30/10/2014 Chapter 5 System Modeling 31


Class member visibility

 Attribute / Operation
 + denotes public attributes or operations
 - denotes private attributes or operations
 # denotes protected attributes or operations
 ~ denotes package attributes or operations

30/10/2014 Chapter 5 System Modeling 32


Class diagram: an overview

30/10/2014 Chapter 5 System Modeling 33


Behavioral models

30/10/2014 Chapter 5 System Modeling 34


Behavioral models

 Behavioral models
• models the dynamic behavior of a system
(execution)
• show what happens when a system responds to a
stimulus from its environment.
 Stimuli
• Data: some data arrives to be processed by the system.

• Events: that triggers system processing.

30/10/2014 Chapter 5 System Modeling 35


Data-driven modeling / data flow diagram

 Data-driven models: show the sequence of actions


involved in processing input data and generating an
associated output.
 Useful during the analysis of requirements. They can be
used to show end-to-end processing in a system.

30/10/2014 An activity model of the insulin pump’s operation 36


Order processing sequence diagram

30/10/2014 Chapter 5 System Modeling 37


Event-driven modeling

 Real-time systems are mainly driven by events.


 send notification
 schedule maintenance
 unsuccessful login trigger

 shows how a system responds to different events.

 A system is FSM: events (stimuli) may cause a


transition from one state to another.

30/10/2014 Chapter 5 System Modeling 38


State machine models

 Show system states as nodes and events as arcs.

 When an event occurs, the system moves from one


state to another.

 Representation

 UML state-chart.

30/10/2014 Chapter 5 System Modeling 39


State diagram of a microwave oven

30/10/2014 Chapter 5 System Modeling 40


Microwave oven operation

30/10/2014 Chapter 5 System Modeling 41


States and stimuli for the microwave oven (a)

State Description
Waiting The oven is waiting for input. The display shows the current time.
Half power The oven power is set to 300 watts. The display shows ‘Half power’.
Full power The oven power is set to 600 watts. The display shows ‘Full power’.
Set time The cooking time is set to the user’s input value. The display shows
the cooking time selected and is updated as the time is set.
Disabled Oven operation is disabled for safety. Interior oven light is on. Display
shows ‘Not ready’.
Enabled Oven operation is enabled. Interior oven light is off. Display shows ‘Ready
to cook’.
Operation Oven in operation. Interior oven light is on. Display shows the timer
countdown. On completion of cooking, the buzzer is sounded for five
seconds. Oven light is on. Display shows ‘Cooking complete’ while buzzer is
sounding.

30/10/2014 Chapter 5 System Modeling 42


States and stimuli for the microwave oven (b)

Stimulus Description

Half power The user has pressed the half-power button.

Full power The user has pressed the full-power button.

Timer The user has pressed one of the timer buttons.

Number The user has pressed a numeric key.

Door open The oven door switch is not closed.

Door closed The oven door switch is closed.

Start The user has pressed the Start button.

Cancel The user has pressed the Cancel button.

30/10/2014 Chapter 5 System Modeling 43


State diagram vs Activity diagram

 Activity Diagrams
 capture high level activities aspects
 Data-driven
 Completion of activity causes state transition
 State Diagrams
 Focus on class/system states (active, archived, closed, …)
 Event-driven

30/10/2014 Chapter 5 System Modeling 44


Model-driven engineering

30/10/2014 Chapter 5 System Modeling 45


Model-driven development

 An approach to quicker software development


 Models are the principal outputs of the development
process (not programs!).

 programs are automatically generated from the


models.
 Raises the level of abstraction in software engineering

 Engineers no longer concerned about programming


language details or execution platforms.
30/10/2014 Chapter 5 System Modeling 46
Soloist: Java based MDD
OpenXava: Java based MDD
JHipster: Java based MDD
Model-driven development

 Pros
 System abstraction

 Generating code automatically  cheaper to adapt systems to


new platforms.

 Cons
 Models for abstraction, and not necessarily right
for implementation.

 High learning curve

 Lots of magic.

30/10/2014 Chapter 5 System Modeling 50


Multiple platform-specific models

30/10/2014 Chapter 5 System Modeling 51


Questions

1. What is UML? what is it used for?


2. What is context model?
3. What is the difference between state-chart and activity
diagram?
4. What is meant by behavioral models? mention some models
that depict system behavior
5. What is the difference between data-driven and event-driven
models?
6. What is the difference between TDD, BDD and MDD?
30/10/2014 Chapter 5 System Modeling 52
References & tools

 Start UML

 draw.io

 Visual paradigm

 Visual paradigm community edition (free)

 Jhipster, Model-driven development

 OpenXava, Model-driven development

30/10/2014 Chapter 5 System Modeling 53

You might also like