Analysis Modeling

advertisement
Object-oriented and Structured
System Models
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 1
Objectives



To understand the context and the
functionality of a system using different
notations
To review some structured notations
To review some of the notations used in the
Unified Modeling Language (UML)
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 2
A Bridge
s ys te m
de s cription
analys is
m ode l
de s ign
m ode l
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 3
3
System modeling


Models are used to communicate with stakeholders.
Different models present the system from different
perspectives
•
•
•
External perspective showing the system’s context or
environment;
Behavioural perspective showing the behaviour of the
system;
Structural perspective showing the system or data
architecture.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 4
Model types





Data processing model shows how the data is
processed at different stages.
Composition model shows how entities are
composed of other entities.
Architectural model shows principal sub-systems.
Classification model shows how entities have
common characteristics.
Stimulus/response model shows the system’s
reaction to events.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 5
Data-processing models

Data flow diagrams (DFDs) may be used to
model the system’s data processing.
•

These show the processing steps as data flows
through a system.
DFDs are an intrinsic part of many analysis
methods.
•
Simple and intuitive notation that customers can
understand.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 6
Order processing DFD
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 7
State machine models

State machine models model the behaviour of the
system in response to external and internal
events/stimuli.
•

These show
•
•
•

often used for modelling real-time systems.
system states as nodes
events as arcs between nodes
when an event occurs, the system moves from one state
to another.
Used a lot in UML
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 8
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
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 9
9
Microwave oven model
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 10
Semantic data models


Semantic data models describe the logical structure
of data processed by the system.
An entity-relation-attribute model sets out
•
•
•


the entities in the system,
the relationships between these entities
and the entity attributes
Widely used in database design. Can readily be
implemented using relational databases.
No specific notation provided in the UML but objects
and associations can be used (VERY SIMILAR to
CLASS HIERARCHY DIAGRAMs)
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 11
Example: Library semantic model
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 12
Object models



Object models describe the system in terms of
object classes and their associations.
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
•
•
•
•
Simple object models
Inheritance models
Aggregation models
Interaction models.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 13
Object Model: Class Diagram
Class name
System
sy st emI D
v erif icat ionPhoneNumber
sy st emSt at us
delay Time
telephoneNumber
mast erPassword
temporary Password
numberTries
program()
display ()
reset ()
query ()
modif y ()
call()
©Ian Sommerville 2006
attributes
operations
Software Engineering, 8th edition. Chapter 8
Slide 14
14
FloorPlan
type
name
outsideDimensions
Class
(Relationship)
Diagram
determineType ( )
positionFloorplan
scale( )
change color( )
is placed wit hin
is part of
Cam era
Wall
t ype
ID
locat ion
f ieldV iew
panA ngle
Zoom Set t ing
t ype
wallDim ensions
determineType ( )
computeDimensions ( )
det erm ineType ()
t ranslat eLocat ion ()
displayID()
displayV iew()
displayZoom ()
is used t o build
is used t o build
is used t o build
WallSegm ent
t ype
st art Coordinat es
st opCoordinat es
next WallSem ent
©Ian Sommerville 2006
determineType ( )
draw( )
Window
Door
t ype
st art Coordinat es
st opCoordinat es
next Window
t ype
st art Coordinat es
st opCoordinat es
next Door
determineType ( )
draw( )
determineType ( )
draw( )
Software Engineering, 8th edition. Chapter 8
Slide 15
15
CRC Modeling

Analysis classes have “responsibilities”
•

Responsibilities are the attributes and operations
encapsulated by the class
Analysis classes collaborate with one another
•
•
Collaborators are those classes that are required
to provide a class with the information needed to
complete a responsibility.
In general, a collaboration implies either a request
for information or a request for some action.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 16
16
CRC Modeling
Class:
Class:
Descript
ion:
Class:
Descript
ion: FloorPlan
Class:
Descript ion:
Responsibility:
Descript ion:
Responsibility:
Responsibility:
Responsibility:
Collaborator:
Collaborator:
Collaborator:
Collaborator:
def ines f loor plan name/ ty pe
manages f loor plan posit ioning
scales f loor plan f or display
scales f loor plan f or display
incorporat es walls, doors and windows
Wall
shows posit ion of v ideo cameras
Camera
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 17
17
Inheritance models



Organize 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.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 18
Library class hierarchy
Library item
Catalo g ue n u mb er
Acq uis ition date
Cos t
Ty pe
Statu s
Number o f cop ies
Acq uire ()
Catalo g ue ()
Disp os e ()
Is su e ()
Return ()
Pub lished item
Recor d ed item
Title
Med iu m
Title
Pub lisher
Boo k
Au tho r
Edition
Pub lication da te
ISBN
©Ian Sommerville 2006
Mag azine
Year
Is su e
Film
Directo r
Date of releas e
Distrib u tor
Compu ter
p ro gram
Versio n
Platfo rm
Software Engineering, 8th edition. Chapter 8
Slide 19
User class hierarchy
Library u ser
Name
Add res s
Pho ne
Reg is tration #
Reg is ter ()
De-r eg is ter ()
Reader
Borrower
Items o n loan
Max . loan s
Affiliation
Staff
Dep ar tmen t
Dep ar tmen t p ho n e
©Ian Sommerville 2006
Stud en t
Majo r sub ject
Home ad d res s
Software Engineering, 8th edition. Chapter 8
Slide 20
Multiple inheritance
Boo k
Voice record in g
Au tho r
Edition
Pub lication da te
ISBN
Speak er
Duration
Recor d ing d ate
Talkin g bo ok
# Tap es
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 21
Object aggregation


An aggregation model shows how classes
that are collections are composed of other
classes.
Aggregation models are similar to the part-of
relationship in semantic data models.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 22
Object aggregation
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 23
Object behaviour modelling

A behavioural model
•
•

shows the interactions between objects
to produce a behaviour that was specified as a
use-case
Collaboration diagrams in UML are used to
model interaction between objects
•
Example: Sequence diagrams
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 24
Sequence diagrams


These show the sequence of events that
take place during some user interaction with
a system.
You read them from top to bottom to see the
order of the actions that take place.
©Ian Sommerville 2006
Software Engineering, 8th edition. Chapter 8
Slide 25
Sequence diagram of ATM
withdrawal
ATM
Card
P IN reques t
Dat abase
Card number
Card OK
P IN
Validate card
Option menu
<<except ion>>
inval id card
Wit hdraw reques t
Amount reques t
Bal ance reques t
Bal ance
Handle request
Amount
Debi t (amount)
<<except ion>>
ins uffi ci ent cash
Debi t res ponse
Card
Card removed
Cas h
©Ian Sommerville 2006
Cas h removed
Recei pt
Complete
trans action
Software Engineering, 8th edition. Chapter 8
Slide 26
Download