Week 11
Week 11
1
Topics covered
Context models
Interaction models
Structural models
Behavioral models
Model-driven engineering
2
System modeling
System modeling is the process of
developing abstract models of a system, with
each model presenting a different view or
perspective of that system.
System modeling has now come to mean
representing a system using some kind of
graphical notation, which is now almost
always based on notations in the Unified
Modeling Language (UML).
System modelling helps the analyst to
understand the functionality of the system
and models are used to communicate with
customers.
3
Existing and planned
system models
Models of the existing system are used during
requirements engineering. They help clarify what
the existing system does and can be used as a
basis for discussing its strengths and weaknesses.
These then lead to requirements for the new
system.
Models of the new system are used during
requirements engineering to help explain the
proposed requirements to other system
stakeholders. Engineers use these models to
discuss design proposals and to document the
system for implementation.
In a model-driven engineering process, it is
possible to generate a complete or partial system
implementation from the system model.
4
System perspectives
An external perspective, where you model
the context or environment of the system.
An interaction perspective, where you model
the interactions between a system and its
environment, or between the components of
a system.
A structural perspective, where you model
the organization of a system or the structure
of the data that is processed by the system.
A behavioral perspective, where you model
the dynamic behavior of the system and how
it responds to events.
5
Context models
6
Context models
Context models are used to illustrate
the operational context of a system -
they show what lies outside the
system boundaries.
Social and organisational concerns
may affect the decision on where to
position system boundaries.
Architectural models show the system
and its relationship with other
systems.
7
System boundaries
System boundaries are established to define
what is inside and what is outside the
system.
They show other systems that are used or depend
on the system being developed.
The position of the system boundary has a
profound effect on the system requirements.
Defining a system boundary is a political
judgment
There may be pressures to develop system
boundaries that increase / decrease the influence
or workload of different parts of an organization.
8
Interaction models
Interaction models
Modeling user interaction is important as
it helps to identify user requirements.
Modeling system-to-system interaction
highlights the communication problems
that may arise.
Modeling component interaction helps us
understand if a proposed system structure
is likely to deliver the required system
performance and dependability.
Use case diagrams and sequence
diagrams may be used for interaction
modeling.
Chapter 5 System
10
Modeling
Structural models
Structural models of software display the
organization of a system in terms of the
components that make up that system
and their relationships.
Structural models may be static models,
which show the structure of the system
design, or dynamic models, which show
the organization of the system when it is
executing.
You create structural models of a system
when you are discussing and designing
the system architecture.
Behavioral models
Behavioral models are models of the
dynamic behavior of a system as it is
executing. They show what happens or
what is supposed to happen when a system
responds to a stimulus from its
environment.
You can think of these stimuli as being of
two types:
Data Some data arrives that has to be processed
by the system.
Events Some event happens that triggers system
processing. Events may have associated data,
although this is not always the case.
12
What is UML and Why we
use UML?
UML → “Unified Modeling Language”
Language: express idea, not a methodology
Borrow Employee
Client
Order Title
Fine Remittance
Supervisor
Use-Case Diagrams
Actors: A role that a user plays with respect to the system, including human
users and other systems. e.g., inanimate physical objects (e.g. robot); an
external system that needs some information from the current system.
Figure 16.12
Use-Case Diagrams
Use-Case Diagrams
Both Make Appointment
and Request Medication
include Check Patient
Record as a subtask
(include)
(TogetherSoft, Inc)
Data Flow Diagrams
WHAT ARE DATA FLOW DIAGRAMS?
DFDs models the system by depicting
Process
Data flow
Data store
26
External Entity
A producer or consumer of data
27
Process
A data transformer (changes input
to output)
28
Data Flow
Data flows through a system, beginning
as input and transformed into output.
base
compute
triangle area
area
height
29
Data Stores
Data is often stored for later use.
sensor #
sensor #, type,
look-up location, age
sensor
report required data
type,
location, age
sensor number
sensor data
30
DFD Rules and Tips
Each process should have at least one input
and an output.
Each data store should have at least one data
flow in and one data flow out.
Data stored in a system must go through a
process.
All processes in a DFD go to another process
or a data store.
Rules for Data Flow
E-P E-E
P-P E-S
P-S S-S
P-E
S-E
DFD levels and layers:
From context diagrams to pseudocode
Name
Account_Name
- Customer_Name
Attributes
- Balance
+addFunds( ) Operations
+withDraw( )
+transfer( )
OO Relationships
There are two kinds of Relationships
Generalization (parent-child relationship)
Association (student enrolls in course)
Example:
Supertype Customer
Regular Loyalty
Customer Customer
Subtype1 Subtype2
0..1 *
employer teacher
Multiplicity Role
Symbol Meaning
1 One and only one
Role
0..1 Zero or one “A given university groups many people;
some act as students, others as teachers.
M..N From M to N (natural
language) A given student belongs to a single
university; a given teacher may or may not
* From zero to any positive
be working for the university at a particular
integer
time.”
0..* From zero to any positive
integer
1..* From one to any positive
Class diagram
* 4
Student Course
has enrolls
Class Student {
Course enrolls[4];
}
Class Course {
Student have[];
}
OO Relationships: Composition
Whole Class
Class W Association
Models the part–whole relationship
Composition
Class P1 Class P2 Also models the part–whole relationship but, in
addition, Every part may belong to only one
whole, and If the whole is deleted, so are the
Part Classes parts
[From Dr.David A. Workman]
Example Example:
A number of different chess boards: Each square
belongs to only one board. If a chess board is
thrown away, all 64 squares on that board go as
well.
Figure 16.7
OO Relationships: Aggregation
Container Class
Aggregation:
Class C expresses a relationship among instances of related
classes. It is a specific kind of Container-Containee
AGGREGATION
relationship.
Class E1 Class E2
express a more informal relationship than
composition expresses.
Containee Classes
Aggregation is appropriate when Container and
Example Containees have no special access privileges to
Bag each other.
Apples Milk
Aggregations
may form "part of" the association, but may not be essential to it. They
may also exist independent of the aggregate. e.g. Apples may exist
independent of the bag.
Activity Diagram
Activity diagrams describe the workflow behavior of a system.
They are most useful for understanding work flow analysis of synchronous
behaviors across a process.
Activity Diagram
An activity is trigged by one or more events and activity may result in one or
more events that may trigger other activity or processes.
Events start from start symbol and end with finish marker having activities in
between connected by events.
55
When to Use Activity Diagrams
The main reason to use activity diagrams is to model the workflow behind
the system being designed.
Activity Diagrams should not take the place of interaction diagrams and
state diagrams.
Activity diagrams do not give detail about how objects behave or how
objects collaborate.
56
Components
An activity is an ongoing, though interruptible, execution of a
step in a workflow (such as an operation or transaction)
Represented with a rounded rectangle.
Text in the activity box should represent an activity (verb phrase in
present tense).
57
Components
An event is triggered by an activity. It specifies a significant occurrence that has a
location in time and space.
An instance of an event (trigger) results in the flow from one activity to another.
These are represented by directed straight lines emerging from triggering activity and ending
at activity to be triggered. Label text for events should represent event but not the data
involved.
58
How to Draw an Activity Diagram
Diagrams are read from top to bottom and have branches and forks to describe
conditions and parallel activities.
A fork is used when multiple activities are occurring at the same time.
A branch describes what activities will take place based on a set of conditions.
All branches at some point are followed by a merge to indicate the end of the
conditional behavior started by that branch.
After the merge all of the parallel activities must be combined by a join before
transitioning into the final activity state.
59
Activity Diagram Example Start State
Activity
Fork
Branch
Merge Join
End
State
60
Interaction Diagrams
show how objects interact with one
another
Picks up
Dial tone
Dial
Picks up
Hello
Sequence Diagram:Object
interaction
A B
Self-Call:
Self-Call A message that an
Synchronous
Object sends to itself.
[condition] remove()
Condition
*[for each] remove()
Iteration
Self-Call
Sequence Diagram
Us er
Message Catalog Res ervations
4 : title returned ()
•The horizontal dimension shows the
objects participating in the interaction. 5: hold title ()
5 : title available ()