Analysis Model
Nien-Lin Hsueh
Software Engineering Lab., FCU
Outline
Basic concept of analysis model Data model ER model Object model Functional model Data flow model Behavioral model State transition model System behavior modeling with sequence diagram
Software Engineering Lab., FCU
Objectives of Analysis Model
Objectives of analysis model To describe what the customer require To establish a basis for the creation of a software design To define a set of requirements that can be validated once the software is built
Software Engineering Lab., FCU
Model
What is a model? a model is a simplification of reality Why do we model? we build models so that we can better understand the system we are developing we build models of complex systems because we cannot comprehend such a system in its entirety four aims to achieve
help us to visualize a system permit us to specify the structure/behavior of a system give us a template that guides us in constructing systems document the decisions we have made
Software Engineering Lab., FCU
Analysis Model
Function
Data Object description
ERD
Data dictionary
DFD
Process specification (PSPEC)
Data
STD
Behavior
Control Specification (CSPEC)
Software Engineering Lab., FCU
Analysis Model - UML
Class diagram Object diagram
Function
Use case diagram Activity diagram
Data
Object
Behavior
State-chart diagram Interaction diagram
UML will be discussed in later chapters
6
Software Engineering Lab., FCU
Data Modeling: ER Diagram
Examines data objects independently of processing Focuses attention on the data domain Creates a model at the customers level of abstraction Indicates how data objects relate to one another
Automobile Make Model Body type Price Color Software Engineering Lab., FCU
Person
Birthday Height Weight Expertise
7
Relationship
Connectedness A fact that must be remembered by the system and cannot or is not computed or derived Several instance of a relationship can exist Entity can be related in many ways
own
Software Engineering Lab., FCU
Cardinality and Multiplicity
own
Automobile own Make Model Body type Price Color
Person Birthday Height Weight Expertise
Software Engineering Lab., FCU
An Example
Customer
(1,1)
places
(1,m)
request for service (1,1) generates (1,n) work order (1,1)
standard task table
(1,1) work selected from (1,w) tasks materials (1,w) (1,i)
(1,1)
consists of lists
Software Engineering Lab., FCU
10
, ,
Software Engineering Lab., FCU
11
Object models
Object = entity (in ERD) + operations Object models describe the system in terms of object classes An object class is an abstraction over a set of objects with common attributes and the services (operations) provided by each object Various object models may be produced Inheritance models Aggregation models Interaction models
Software Engineering Lab., FCU
12
Object models
Natural ways of reflecting the real-world entities manipulated by the system Object class identification is recognised as a difficult process requiring a deep understanding of the application domain Object classes reflecting domain entities are reusable across systems
Software Engineering Lab., FCU
13
Inheritance models
Organise the domain object classes into a hierarchy Classes at the top of the hierarchy reflect the common features of all classes Object classes inherit their attributes and services from one or more super-classes. these may then be specialised as necessary
Software Engineering Lab., FCU
14
Library item Catalogue number Acquisition date Cost Type Status Number of copies Acquire () Catalogue () Dispose () Issue () Return ()
Library class hierarchy
Published item Title Publisher
Recorded item Title Medium
Book Author Edition Publication date ISBN
Magazine Year Issue
Film Director Date of release Distributor
Computer program Version Platform
Libr ary user Name Address Phone Registration # Register () De-r egister ()
User class hierarchy
Reader Affiliation
Borrower Items on loan Max. loans
Staff Department Department phone
Student Major subject Home address
Object Aggregation
Aggregation model shows how classes which are collections are composed of other classes Similar to the part-of relationship in semantic data models
Software Engineering Lab., FCU
17
Object Aggregation
Software Engineering Lab., FCU
18
Functional Modeling: Data Flow Diagram Every computer-based system is an information transform ....
input
computer based system
output
Software Engineering Lab., FCU
19
Notation
external entity
process
data flow data store
Software Engineering Lab., FCU
20
External Entity
A producer or consumer of data Example: person, device, system, sensor Data must always originate from somewhere, and must always be sent to something
Software Engineering Lab., FCU
21
Process
A data transformer (changes input to output) Example: compute taxes, determine area, format report, display graph Data must always be process in some way to achieve system function
Software Engineering Lab., FCU
22
Data Flow
Data flows through a system, beginning as input and be transformed into output
base compute triangle area area
height
Software Engineering Lab., FCU
23
Data Store
Data is often stored for later use
sensor # look-up sensor data
sensor #, type, location, age
report required
sensor number
type, location, age
sensor data
Software Engineering Lab., FCU
24
Data Flow Diagramming
all icons must be labeled with meaningful names the DFD evolves through a number of levels of detail always begin with a context level diagram (also called level 0) always show external entities at level 0 always label data flow arrows do not represent procedural logic
Software Engineering Lab., FCU
25
Level 0
user
processing request digital video processor
requested video signal
monitor
video source
NTSC video signal
Software Engineering Lab., FCU
26
Refine Process
write a narrative describing the transform parse to determine next level transforms balance the flow to maintain data flow continuity develop a level 1 DFD use a 1:5 (approx.) expansion ratio
Software Engineering Lab., FCU
27
Level 1
level 0
c
p1
p2
f
p4
d
level 1
p3
Software Engineering Lab., FCU
28
Flow Modeling Notes
Each bubble is refined until it does just one thing The expansion ratio decreases as the number of levels increase Most systems require between 3 and 7 levels for an adequate flow model
Software Engineering Lab., FCU
29
Using PSPEC
Process Specification (PSPEC) can be used to specify the processing details implied by a process within a DFD
Check & convert pressure
PSPEC
If absolute tank pressure > max pressure then set above pressure to true; else set above pressure to false; begin conversion algorithm x-01a; compute converted pressure; end end if
Software Engineering Lab., FCU
30
Mapping to design model
analysis model
Maps into
design model
Software Engineering Lab., FCU
31
Behavioral Modeling
events Outside world Application
behavior
How do I model the software's reaction to some external event?
Software Engineering Lab., FCU
32
Basic concept
State: a set of observable circum-stances that characterizes the behavior of a system at a given time State transition: the movement from one state to another Event: an occurrence that causes the system to exhibit some predictable form of behavior Action: process that occurs as a consequence of making a transition
Software Engineering Lab., FCU
33
State Modeling
1. 2.
3.
Make a list of the different states of a system (How does the system behave?) Indicate how the system makes a transition from one state to another (How does the system change state?) 1. indicate event 2. indicate action Draw a state transition diagram
Software Engineering Lab., FCU
34
Notation
Event button1&2Pressed Blink Hours Initial state button2Pressed State Increment Hours
Transition
button1Pressed
button2Pressed
button1&2Pressed
Blink Minutes
Increment Minutes
button1Pressed button2Pressed
Stop Blinking
Blink Seconds
Increment Seconds
button1&2Pressed Final state Software Engineering Lab., FCU
35
Example
full and start invoke manage-copying reading operator commands copies done invoke read-op-input making copies full invoke read-op-input
reloading paper empty invoke reload paper
jammed invoke problem-diagnosis problem state Software Engineering Lab., FCU
not jammed invoke read-op-input
36
State Generalization
Software Engineering Lab., FCU
37
State Aggregation
Software Engineering Lab., FCU
38
System behaviour modelling with Sequence Diagram
A behavioural model shows the interactions between objects to produce some particular system behaviour that is specified as a usecase Sequence diagrams (or collaboration diagrams) in the UML are used to model interaction between objects
Software Engineering Lab., FCU
39
An Example: Issue of electronic items
Lib1: NetServer
Ecat: Catalog :Library User Lookup Display Issue Issue licence Accept licence
:Library Item
Compress
Software Engineering Lab., FCU
Deliver
40
The problem is not that there are problems. The problem is expecting otherwise and thinking that having problems is a problem Theodore Rubin
Software Engineering Lab., FCU
41
Homework
Meeting Scheduler System Request for Proposal (RFP) ERD , 5 DFD , level 2 STD , ? ? ?
Software Engineering Lab., FCU
42