Beruflich Dokumente
Kultur Dokumente
6/e
Chapter 8
Analysis Modeling
copyright 1996, 2001, 2005
Thesecoursewarematerialsaretobeusedinconjunction
Requirements Analysis
Requirements analysis
Thesecoursewarematerialsaretobeusedinconjunction
A Bridge
system
description
analysis
model
design
model
Thesecoursewarematerialsaretobeusedinconjunction
Rules of Thumb
The model should focus on requirements that are visible within the
problem or business domain. The level of abstraction should be
relatively high.
Each element of the analysis model should add to an overall
understanding of software requirements and provide insight into
the information domain, function and behavior of the system.
Delay consideration of infrastructure and other non-functional
models until design.
Minimize coupling throughout the system.
Be certain that the analysis model provides value to all
stakeholders.
Keep the model as simple as it can be.
Thesecoursewarematerialsaretobeusedinconjunction
Domain Analysis
Software domain analysis is the identification, analysis,
and specification of common requirements from a
specific application domain, typically for reuse on
multiple projects within that application domain . . .
[Object-oriented domain analysis is] the identification,
analysis, and specification of common, reusable
capabilities within a specific application domain, in
terms of common objects, classes, subassemblies, and
frameworks . . .
Donald Firesmith
Thesecoursewarematerialsaretobeusedinconjunction
Domain Analysis
Thesecoursewarematerialsaretobeusedinconjunction
Data Modeling
Thesecoursewarematerialsaretobeusedinconjunction
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)
Thesecoursewarematerialsaretobeusedinconjunction
Thesecoursewarematerialsaretobeusedinconjunction
10
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
Thesecoursewarematerialsaretobeusedinconjunction
11
ERD Notation
One common form:
object1
(0, m)
relationship
(1, 1)
object 2
attribute
object1
(0, m)
(1, 1)
object 2
Thesecoursewarematerialsaretobeusedinconjunction
12
Building an ERD
Thesecoursewarematerialsaretobeusedinconjunction
13
(1,1)
places
(1,m)
request
for service
(1,1)
standard
task table
(1,1)
selected
from
generates
work
(1,w) tasks
materials
(1,w)
(1,i)
(1,n)
work
order
(1,1)
(1,1)
consists
of
lists
Thesecoursewarematerialsaretobeusedinconjunction
14
Object-Oriented Concepts
Thesecoursewarematerialsaretobeusedinconjunction
15
Classes
template
generalized description
blueprint ... describing a collection of
similar items
Thesecoursewarematerialsaretobeusedinconjunction
16
Building a Class
class name
attributes:
operations
attributes:
operations:
Thesecoursewarematerialsaretobeusedinconjunction
17
What is a Class?
occurrences
things
roles
organizational units
places
structures
external entities
class name
attributes:
operations:
Thesecoursewarematerialsaretobeusedinconjunction
18
Encapsulation/Hiding
The object encapsulates
both data and the logical
procedures required to
manipulate the data
method
method
#2
#1
data
method
#3
method
#6
method
#5
method
#4
19
Class Hierarchy
PieceOfFurniture (superclass)
Table
Chair
Desk
Chable"
subclasses of the
instances of Chair
Thesecoursewarematerialsaretobeusedinconjunction
20
Methods
(a.k.a. Operations, Services)
An executable procedure that is
encapsulated in a class and is designed
to operate on one or more data attributes
that are defined as part of the class.
A method is invoked
via message passing.
Thesecoursewarematerialsaretobeusedinconjunction
21
Scenario-Based Modeling
[Use-cases] are simply an aid to defining what exists
outside the system (actors) and what should be
performed by the system (use-cases). Ivar Jacobson
(1) What should we write about?
(2) How much should we write about it?
(3) How detailed should we make our description?
(4) How should we organize the description?
Thesecoursewarematerialsaretobeusedinconjunction
22
Use-Cases
Thesecoursewarematerialsaretobeusedinconjunction
23
Developing a Use-Case
What are the main tasks or functions that are performed by the
actor?
What system information will the the actor acquire, produce or
change?
Will the actor have to inform the system about changes in the
external environment?
What information does the actor desire from the system?
Does the actor wish to be informed about unexpected changes?
Thesecoursewarematerialsaretobeusedinconjunction
24
Use-Case Diagram
SafeHome
Access camera
surveillance via the
Internet
cameras
ConfigureSafeHome
systemparameters
homeowner
Set alarm
Thesecoursewarematerialsaretobeusedinconjunction
25
Activity Diagram
Supplements the use-case by providing a diagrammatic
representation of procedural flow
enterpassword
anduserID
validpassw
ords/ID
oth
e
rfu
nctio
ns
m
a
als
sy
ele
cto
eb
de
invalidpassw
ords/ID
selectm
ajorfunction prom
ptforreentry
selectsurveilance
thum
bnailview
s
osin
u
tain
trn
ie
rp
e
m
inputtriesrem
ain
selectaspecificcam
era
selectspecific selectcam
eraicon
cam
era-thum
bnails
viewcam
eraoutput
inlabeledwindow
prom
ptfor
anotherview
exitthisfunction
seeanothercam
era
Thesecoursewarematerialsaretobeusedinconjunction
26
Swimlane Diagrams
Allows the modeler to represent the flow of activities described by the use-case and at the
same time indicate which actor (if there are multiple actors involved in a specific use-case)
or analysis class has responsibility for the action described by an activity rectangle
homeowner
camera
interface
enterpassword
anduserID
validpassw
ords/ID
v
passin
w
oa
rlid
ds/ID
selectm
ajorfunction
prom
ptforreentry
oth
e
fu
nc
m
a
yra
lso
btio
ens
selected
selectsurveilance
thum
bnailview
s
noinput
triesrem
ain
inputtries
rem
ain
selectaspecificcam
era
selectspecific
eraicon
cam
era-thum
bnails selectcam
generatevideo
output
viewcam
eraoutput
inlabeledwindow
prom
ptfor
anotherview
e
xitnth
isn
fu
ctio
see
a
th
cn
ao
m
ere
ar
Thesecoursewarematerialsaretobeusedinconjunction
27
Flow-Oriented Modeling
Represents how data objects are transformed at they
move through the system
A data flow diagram (DFD) is the diagrammatic form that
is used
Considered by many to be an old school approach, floworiented modeling continues to provide a view of the
system that is uniqueit should be used to supplement
other analysis model elements
Thesecoursewarematerialsaretobeusedinconjunction
28
input
computer
based
system
output
Thesecoursewarematerialsaretobeusedinconjunction
29
process
data flow
data store
Thesecoursewarematerialsaretobeusedinconjunction
30
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
Thesecoursewarematerialsaretobeusedinconjunction
31
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
Thesecoursewarematerialsaretobeusedinconjunction
32
Data Flow
Data flows through a system, beginning
as input and be transformed into output.
base
height
compute
triangle
area
area
Thesecoursewarematerialsaretobeusedinconjunction
33
Data Stores
Data is often stored for later use.
sensor #
report required
look-up
sensor
data
sensor number
sensor #, type,
location, age
type,
location, age
sensor data
Thesecoursewarematerialsaretobeusedinconjunction
34
Thesecoursewarematerialsaretobeusedinconjunction
35
Constructing a DFDI
Thesecoursewarematerialsaretobeusedinconjunction
36
video
source
processing
request
digital
video
processor
requested
video
signal
monitor
NTSC
video signal
Thesecoursewarematerialsaretobeusedinconjunction
37
Constructing a DFDII
Thesecoursewarematerialsaretobeusedinconjunction
38
p1
c
d
level 1
p2
level 0
f
p4
p3
Thesecoursewarematerialsaretobeusedinconjunction
39
Thesecoursewarematerialsaretobeusedinconjunction
40
PSPEC
narrative
pseudocode (PDL)
equations
tables
diagrams and/or charts
Thesecoursewarematerialsaretobeusedinconjunction
41
analysis model
Maps into
design model
Thesecoursewarematerialsaretobeusedinconjunction
42
Thesecoursewarematerialsaretobeusedinconjunction
43
Thesecoursewarematerialsaretobeusedinconjunction
44
Thesecoursewarematerialsaretobeusedinconjunction
45
combinatorial spec
decision tables
activation tables
Thesecoursewarematerialsaretobeusedinconjunction
46
Thesecoursewarematerialsaretobeusedinconjunction
47
Class-Based Modeling
Thesecoursewarematerialsaretobeusedinconjunction
48
Analysis Classes
External entities (e.g., other systems, devices, people) that produce or consume
information to be used by a computer-based system.
Things (e.g, reports, displays, letters, signals) that are part of the information
domain for the problem.
Occurrences or events (e.g., a property transfer or the completion of a series of robot
movements) that occur within the context of system operation.
Roles (e.g., manager, engineer, salesperson) played by people who interact with the
system.
Organizational units (e.g., division, group, team) that are relevant to an application.
Places (e.g., manufacturing floor or loading dock) that establish the context of the
problem and the overall function of the system.
Structures (e.g., sensors, four-wheeled vehicles, or computers) that define a class of
objects or related classes of objects.
Thesecoursewarematerialsaretobeusedinconjunction
49
Selecting ClassesCriteria
retained information
needed services
multiple attributes
common attributes
common operations
essential requirements
Thesecoursewarematerialsaretobeusedinconjunction
50
Class name
Class Diagram
System
systemID
verificationPhoneNumber
systemStatus
delayTime
telephoneNumber
masterPassword
temporaryPassword
numberTries
program()
display()
reset()
query()
modify()
call()
attributes
operations
Thesecoursewarematerialsaretobeusedinconjunction
51
Class Diagram
FloorPlan
type
name
outsideDimensions
determineType()
positionFloorplan
scale()
changecolor()
is placedwithin
is part of
Camera
type
ID
location
fieldView
panAngle
ZoomSetting
determineType()
translateLocation()
displayID()
displayView()
displayZoom()
Wall
type
wallDimensions
determineType()
computeDimensions ()
is usedtobuild
is usedtobuild
is usedtobuild
WallSegment
Window
Door
type
startCoordinates
stopCoordinates
nextWallSement
type
startCoordinates
stopCoordinates
nextWindow
type
startCoordinates
stopCoordinates
nextDoor
determineType ()
draw()
determineType ()
draw()
determineType ()
draw()
Thesecoursewarematerialsaretobeusedinconjunction
52
CRC Modeling
Thesecoursewarematerialsaretobeusedinconjunction
53
CRC Modeling
Class:
Class:
Description:
Class:
Description:
Class:FloorPlan
Description:
Responsibility:
Description:
Responsibility:
Responsibility:
Responsibility:
Collaborator:
Collaborator:
Collaborator:
Collaborator:
Wall
Camera
Thesecoursewarematerialsaretobeusedinconjunction
54
Class Types
Entity classes, also called model or business classes, are extracted directly
from the statement of the problem (e.g., FloorPlan and Sensor).
Boundary classes are used to create the interface (e.g., interactive screen
or printed reports) that the user sees and interacts with as the software
is used.
Controller classes manage a unit of work [UML03] from start to finish.
That is, controller classes can be designed to manage
Thesecoursewarematerialsaretobeusedinconjunction
55
Responsibilities
56
Collaborations
A class can use its own operations to manipulate its own attributes, thereby
fulfilling a particular responsibility, or
a class can collaborate with other classes.
Thesecoursewarematerialsaretobeusedinconjunction
57
PlayerHead
PlayerBody
PlayerArms
PlayerLegs
Thesecoursewarematerialsaretobeusedinconjunction
58
All participants in the review (of the CRC model) are given a subset of the CRC model index
cards.
All use-case scenarios (and corresponding use-case diagrams) should be organized into
categories.
The review leader reads the use-case deliberately .
As the review leader comes to a named object, she passes a token to the person holding the
corresponding class index card.
When the token is passed, the holder of the class card is asked to describe the responsibilities
noted on the card.
Cards that collaborate should be separated (i.e., no reviewer should have two cards that collaborate).
The group determines whether one (or more) of the responsibilities satisfies the use-case
requirement.
If the responsibilities and collaborations noted on the index cards cannot accommodate the
use-case, modifications are made to the cards .
This may include the definition of new classes (and corresponding CRC index cards) or the
specification of new or revised responsibilities or collaborations on existing cards.
Thesecoursewarematerialsaretobeusedinconjunction
59
Thesecoursewarematerialsaretobeusedinconjunction
60
Multiplicity
Wall
is used to build
1..*
WallSegment
1
is used to build
Window
0..*
Door
Thesecoursewarematerialsaretobeusedinconjunction
61
Dependencies
Camera
DisplayWindow
<<access>>
{password}
Thesecoursewarematerialsaretobeusedinconjunction
62
Analysis Packages
63
Analysis Packages
package name
Environment
+Tree
+Landscape
+Road
+Wall
+Bridge
+Building
+VisualEffect
+Scene
RulesOfTheGame
+RulesOfMovement
+ConstraintsOnAction
Characters
+Player
+Protagonist
+Antagonist
+SupportingRole
Thesecoursewarematerialsaretobeusedinconjunction
64
Behavioral Modeling
Thesecoursewarematerialsaretobeusedinconjunction
65
State Representations
the state of each class as the system performs its function and
the state of the system as observed from the outside as the
system performs its function
Thesecoursewarematerialsaretobeusedinconjunction
66
timer >lockedTime
locked
password =incorrect
&numberOfTries <maxTries
key hit
comparing
reading
password
entered
numberOfTries >maxTries
do: validatePassword
password =correct
selecting
activation successful
Thesecoursewarematerialsaretobeusedinconjunction
67
Thesecoursewarematerialsaretobeusedinconjunction
68
Behavioral Modeling
indicate event
indicate action
Thesecoursewarematerialsaretobeusedinconjunction
69
Sequence Diagram
controlpanel
homeowner
system
ready
sse
en
nsso
ors
rs
system
reading
passwordentered
comparing
request lookup
result
numberOfTries >maxTries
password=correct
locked
request activation
A timer>lockedTime
selecting
activationsuccessful
activationsuccessful
Thesecoursewarematerialsaretobeusedinconjunction
70
Thesecoursewarematerialsaretobeusedinconjunction
71
Specification Guidelines
use a layered format that provides increasing detail
as the "layers" deepen
use consistent graphical notation and apply textual
terms consistently (stay away from aliases)
be sure to define all acronyms
be sure to include a table of contents; ideally,
include an index and/or a glossary
write in a simple, unambiguous style (see "editing
suggestions" on the following pages)
always put yourself in the reader's position, "Would
I be able to understand this if I wasn't intimately
familiar with the system?"
Thesecoursewarematerialsaretobeusedinconjunction
72
Specification Guidelines
Be on the lookout for persuasive connectors, ask why?
keys:certainly, therefore, clearly, obviously, it follows that ...
Watch out for vague terms
keys:some, sometimes, often, usually,ordinarily, most, mostly ...
When lists are given, but not completed, be sure all items are understood
keys:etc., and so forth, and so on, such as
Be sure stated ranges don't contain unstated assumptions
e.g.,Valid codes range from 10 to 100.
Integer? Real? Hex?
Beware of vague verbs such handled,
as
rejected, processed, ...
Beware "passive voice" statements
e.g.,The parameters are initialized.
By what?
Beware "dangling" pronouns
e.g.,The I/O module communicated with the data validation module and
its contol flag is set.
Whose control flag?
Thesecoursewarematerialsaretobeusedinconjunction
73
Specification Guidelines
When a term is explicitly defined in one place, try
substituting the definition forother occurrences of the term
When a structure is described in words, draw a picture
When a structure is described with a picture, try to redraw
the picture to emphasize diferent elements of the structure
When symbolic equations are used, try expressing their
meaning in words
When a calculation is specified, work at least two
examples
Look for statements that imply certainty, then ask for proof
keys; always, every, all, none, never
Search behind certainty statementsbe sure restrictions
or limitations are realistic
Thesecoursewarematerialsaretobeusedinconjunction
74