Transparency Masters for Software Engineering: A Practitioner`s

Download Report

Transcript Transparency Masters for Software Engineering: A Practitioner`s

Chapter 12
Analysis Modeling
1
Analysis Modeling:
Where to Begin?
Use the statement of scope and other SRS
documents already created to guide you to
building an analysis model.
The analysis model will include acquired
from:
the working document
A set of use-cases
Other items
the statement of scope must be “parsed” to
extract data, function and behavioral
domain information
2
Statement of Scope
a relatively brief description of
the system to be built
indicates data that are input and output
and basic functionality
indicates conditional processing (at a
high level)
implies certain constraints and
limitations
3
Identifying Object and Operations
Noun/Verb Approach
define “objects” by underlining all nouns in the
written statement of scope
 producers/consumers of data
 places where data are stored
 “composite” data items
define “operations” by double underlining all
active verbs
 processes relevant to the application
 data transformations
consider other “services” that will be required by
the objects
4
Identifying Object and Operations
Discovery Approach
define all “potential objects” by thinking
about the system. Consider everything.
Add attributes identifying those potential
objects which are duplicates, attributes
themselves, operations, services.
Add operations again identifying those
potential objects which are duplicates,
attributes, operations, and services.
5
Identifying Object and Operations
Data Approach
define all data entities and consider them as the
potential objects of the system.
Add attributes identifying those potential objects
which are duplicates, attributes themselves,
operations, services and adding any new objects
needed to support attributes.
Add operations again identifying those potential
objects which are duplicates, attributes, operations,
and services and adding any new objects needed to
support operations.
6
Video Rental Example
A video store offers rental of videos to
members. To become a member you have to
have a drivers license and a credit card. You
may rent up to 3 videos. Corporate keeps up
with trends and orders the tapes for rental.
Members check out and return videos due in
one day. Overdue fees of 1 dollar a day is
charged for late videos.
Upon rental a rental slip is made for
customers which contains name, addr, city,
and iterations of movies with tape id, movie id,
title, length, etc.
7
Video Rental System
Use the noun approach - Grady Booch
Use discovery approach – Linda Northrup
Use the data approach – Steven Mellor, Sally
Schaler
Use the responsibility driven design
approach – Rebecca Wirth Brock
Use one of above and Analysis Patterns
Approach – Joe Yoeder
8
Video Rental System
Remember these techniques identify the domain
(conceptual) classes, not design classes, not
programming classes, and not implementation
classes.
9
Video Rental System noun/verb
A video store offers rental of videos to
members. To become a member you
have to have a drivers license and a
credit card. You may rent up to 3
videos. Corporate keeps up with
trends and orders the tapes for rental.
Members check out and return videos
due in one day. Overdue fees of 1
dollar a day is charged for late videos.
Upon rental a rental slip is made for
customers which contains name, addr,
city, and iterations of movies with tape
id, movie id, title, length, etc.
10
Video Rental System noun/verb
A video store offers rental of videos to
members. To become a member you
have to have a drivers license and a
credit card. You may rent up to 3
videos. Corporate keeps up with
trends and orders the tapes for rental.
Members check out and return videos
due in one day. Overdue fees of 1
dollar a day is charged for late videos.
Upon rental a rental slip is made for
customers which contains name, addr,
city, and iterations of movies with tape
id, movie id, title, length, etc.
11
Video Rental System noun/verb
NOUNS
Store
Video
Member
License
Card
Corporate
Trends
Tapes
Slip
Customers
Name
Addr
City
Iterations
Tape
Movie id
Title
length
VERBS
Offers
Becomes
Rents
Orders
Checkout
Return
Charged
Made
contains
12
Video Rental System noun/verb
Lay the nouns out on a table, 3X5 cards, chalk board, ppt file
NOUNS
Store
Video
Member
License
Card
Corporate
Trends
Tapes
Slip
Name
Customers
Addr
Iterations
Movie id
Tape
Title
length
13
Video Rental System noun/verb
Begin adding attributes
NOUNS
Store
name, addr..
Video
name,length
Member
name, addr
License
num, name
Card
num,name,
Corporate
Trends
Tapes
Slip
Name
Customers
Addr
Iterations
Movie id
Tape
name, addr..
Title
Id
num\
length
14
Video Rental System noun/verb
Begin clustering the potential objects - Singletons
NOUNS
Store
name, addr..
Corporate
Video
name,length
Trends
Same as store only one
instance
Customers
Addr
name, addr..
Title
Member
name, addr
License
num, name
Card
num,name,
Tapes
Slip
Name
Iterations
Movie id
Tape
Id
num\
length
15
Video Rental System noun/verb
Begin clustering the potential objects - attributes
NOUNS
Store
Video
name, addr..
name,length
Corporate
Trends
Same as store only one
instance
Customers
Addr
name, addr..
attribute
Title
Member
name, addr
License
num, name
Tapes
Slip
Iterations
Movie id
Card
num,name,
Name
attribute
Id
Tape
num\
attribute
length
16
Video Rental System noun/verb
Begin clustering the potential objects – more attributes
NOUNS
Store
name, addr..
Video
name,length
Member
License
attribute
attribute
Card
name, addr
lic num, card num
Trends
Tapes
Slip
Customers
name, addr..
Iterations
Movie id
attribute
Id
Addr
attribute
Tape ID
attribute
num\
17
Video Rental System noun/verb
Begin clustering the potential objects - duplicates / descriptors
NOUNS
Store
name, addr..
Video
name,length
Member
name, addr
lic num, card num
Trends
Tapes
Slip
name, addr..
= to
Customers
member
descriptor
Iterations`
18
Video Rental System noun/verb
Begin clustering the potential objects - I/O
NOUNS
Store
name, addr..
Video
Member
name,length
name, addr
lic num, card num
Trends
Tapes
Slip
tape id,
name, addr..
I/O
19
Video Rental System noun/verb
So how did we do this clustering
1. Identified all potential domain (conceptual
classes) using the noun approach --discovery,
data methods, or responsibility driven also
work.
2. Identified potential attributes and perhaps
operations of the potential classes.
20
Video Rental System noun/verb
4. Eliminated some potential classes by clustering
•
Input/Outputs (never domain classes)
•
Singletons (rarely classes)
•
Potential objects that turned out to be attributes
•
Potential objects that turned out to be behaviors
•
Duplicates
•
Items that only described other things ( no attributes or
methods)
5. Constructed the Class Diagram and the network
helped to cluster even more.
6. Identify M:M and resolved
21
Video Rental System noun/verb
Begin clustering the potential objects by their attributes and methods
Store
Video
Trends
VERBS
Member
Tape
Now lets see if we can model this……. Now add cardinality,
names of relationships…resolve M:M… then add attributes
and methods
Offers
Becomes
Rents
Orders
Checkout
Return
Charged
Made
contains
22
Data Modeling
and
Entity Relationship (E-R)
Diagramming
23
Why Data Modeling?
examines data objects independently
of processing
focuses attention on the data domain
creates a model at the customer’s
level of abstraction
indicates how data objects relate to
one another
24
What is a Data Object?
Object—something that is described by a set
of attributes (data items) and that will be
manipulated within the software (system)
each instance of an object (e.g., a book)
can be identified uniquely (e.g., ISBN #)
each plays a necessary role in the system
i.e., the system could not function without
access to instances of the object
each is described by attributes that are
themselves data items
25
Typical Objects
external entities (printer, user, sensor)
things(e.g, reports, displays, signals)
occurrences or events (e.g., interrupt, alarm)
roles (e.g., manager, engineer, salesperson)
(e.g., division, team)
organizational units
places(e.g., manufacturing floor)
structures (e.g., employee record)
26
Data Objects and Attributes
A data object contains a set of attributes
that act as an aspect, quality, characteristic, or descriptor of the object
object: automobile
attributes:
make
model
body type
price
options code
27
What is a Relationship?
relationship —indicates “connectedness”;
a "fact" that must be "remembered"
by the system and cannot or is not computed
or derived mechanically
several instances of a
relationship can exist
objects can be related in many
different ways
28
ERD Notation
One common form:
object1
(0, m)
relationship
(1, 1)
object 2
attribute
Another common form:
relationship
object1
(0, m)
(1, 1)
object 2
29
Building an ERD
Level 1—model all data objects (entities) and
their “connections” to one another
Level 2—model all entities and relationships
Level 3—model all entities, relationships,
and the attributes that provide further depth
30
The ERD: An Example
Customer
(1,1)
places
(1,m)
request
for service
(1,1)
standard
task table
generates (1,n)
(1,1)
work
selected
from (1,w) tasks
materials
(1,w)
(1,i)
work
order
(1,1)
(1,1)
consists
of
lists
31
Creating a Flow
Model
32
The Flow Model
Every computer-based system is an
information transform ....
input
computer
based
system
output
33
The Flow Model
Every computer-based system is an
information transform ....
input
computer
based
system
output
34
Flow Modeling Notation
external entity
process
data flow
data store
35
External Entity
A producer or consumer of data
Examples: a person, a device, a sensor
Another example: computer-based system
Data must always originate somewhere
and must always be sent to something
36
b
Process
A data transformer (changes input to output)
Examples: compute taxes, determine area,
format report, display graph
Data must always be processed in some
way to achieve system function
37
Data Flow
Data flows through a system, beginning
as input and be transformed into output.
base
height
compute
triangle
area
area
38
Data Stores
Data is often stored for later use.
sensor #
report required
sensor #, type,
location, age
look-up
sensor
data
sensor number
type,
location, age
sensor data
39
Data Flow Diagramming:
Guidelines
icons must be labeled with meaningful names
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
40
Constructing a DFD—I
review ERD to isolate data objects and
grammatical parse to determine
“operations)
determine external entities (producers
and consumers of data
create a level 0 DFD
41
Level 0 DFD Example
user
processing
request
digital
video
processor
requested
video
signal
monitor
video
NTSC
source video
signal
42
Constructing a DFD—II
write a narrative describing the transform
parse to determine next level transforms
“balance” to maintain data flow continuity
develop a level 1 DFD
use a 1:5 (approx.) expansion ratio
43
The Data Flow Hierarchy
x
a
a
b
P
c
p2
level 1
p4
p3
level 0
f
p1
d
y
e
g
5
b
44
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
a single data flow item (arrow) may be
expanded as levels increase (data dictionary
provides information)
45
DFDs: A Look Ahead
analysis model
Maps into
design model
46
Creating a
Use Case Model
47
The Use Case Model
Every computer-based system is a series
of actions, subsystems that interact with
outside actors (external entities).
use case
48
Use Case Notation
actor
relationship (usually trigger)
use case
49
Actor
A
Examples: a person, a device, a sensor
Another example: computer-based system
Something must trigger the action in the use case.
50
Use Case (Process)
A process triggered by a user
Examples: compute taxes, determine area,
Enter student data,
These functions must be performed.
51
Connection
The actors trigger the process.
use case
52
Use Case Guidelines





use cases like processes vary in granularity.
show a good way to begin defining system scenarios.
offer an abstraction which can have a test plan
begin the traceability of the system
has extensions
 <<extends>> for extending the functionality of a use case
 <<uses>> for using when one use case uses another use case
 <<include>> for inner use of a use case inside another
 <<calls> for invocation of other use cases.
53
Constructing a Use Case
Review the needed processes
triggered by users.
determine the actors involved.
create the first level of use cases
Define any extensions.
54
High Level Use Cases
System
Video Rental System
Use Case
Order new videos
Corporate
Rent video
Return video
Customer
Actor
55
Constructing Use Cases
write a narrative describing the use case
Define the classes (if known) that
participate in that use case
Define the pre and post conditions of
the use case.
56
Use Case Diagrams: A Look Ahead
Rent video
use Customer
case model
Maps into
sequence design model
Customer
validateCustom
er()
rentCassette(CI
D)
Rental
Cassette
checkIfRentable(CI
D)
57
Behavioral Modeling
and Process Specification
58
Behavioral Modeling
events
Outside
world
behavior
Application
59
The States of a System
state—a set of observable circumstances 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
60
Behavioral Modeling
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?)
indicate event
indicate action
draw a state transition diagram
61
State Transition Diagram
Notation
state
event causing transition
action that occurs
new state
62
State Transition Diagram
full and start
invoke manage-copying reading
operator
commands
full
invoke read-op-input
copies done
invoke read-op-input
making copies
reloading paper
empty
invoke reload paper
jammed
invoke problem-diagnosis
problem state
not jammed
invoke read-op-input
63
Writing the Software Specification
Everyone knew exactly
what had to be done
until someone wrote it
down!
64