0% found this document useful (0 votes)
925 views

Building Analysis Model

Uploaded by

Dakshata Gaikar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
925 views

Building Analysis Model

Uploaded by

Dakshata Gaikar
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 51

Software Engineering: A Practitioner’s Approach,

6/e

Chapter 8
Analysis Modeling
copyright © 1996, 2001, 2005
R.S. Pressman & Associates, Inc.

For University Use Only


May be reproduced ONLY for student use at the university level
when used in conjunction with Software Engineering: A Practitioner's Approach.
Any other reproduction or use is expressly prohibited.
Requirements Analysis
 Requirements analysis
 specifies software’s operational characteristics
 indicates software's interface with other system elements
 establishes constraints that software must meet
 Requirements analysis allows the software engineer
(called an analyst or modeler in this role) to:
 elaborate on basic requirements established during earlier
requirement engineering tasks
 build models that depict user scenarios, functional activities,
problem classes and their relationships, system and class
behavior, and the flow of data as it is transformed.
A Bridge

system
description

analysis
model

design
model
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.
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
Domain Analysis
 Define the domain to be investigated.
 Collect a representative sample of applications in
the domain.
 Analyze each application in the sample.
 Develop an analysis model for the objects.
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
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
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)
organizational units (e.g., division, team)
places (e.g., manufacturing floor)
structures (e.g., employee record)
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
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
ERD Notation
One common form:
(0, m)
object1 relationship object 2
(1, 1)

attribute
Another common form:

object1 relationship
object 2
(0, m) (1, 1)
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
The ERD: An Example
request
Customer places
for service
(1,1) (1,m)
(1,1)
standard generates (1,n) work
task table order
(1,1) (1,1) (1,1)
selected work (1,w) consists
from (1,w) tasks of

(1,i)
materials lists
Object-Oriented Concepts
 Must be understood to apply class-based
elements of the analysis model
 Key concepts:
 Classes and objects
 Attributes and operations
 Encapsulation and instantiation
 Inheritance
Classes
• object-oriented thinking begins with the
definition of a class, often defined as:
– template
– generalized description
– “blueprint” ... describing a collection of
similar items
• a metaclass (also called a superclass)
establishes a hierarchy of classes
• once a class of items is defined, a
specific instance of the class can be
identified
Building a Class
class name

attributes:

operations

attributes:
operations:
What is a Class?
occurrences roles
things organizational units
places
external entities
structures

class name
attributes:

operations:
Encapsulation/Hiding
The object encapsulates
both data and the logical
procedures required to
manipulate the data method method
#2
#1
data

method
method #3
#6

method method
#5 #4

Achieves “information hiding”


Class Hierarchy
PieceOfFurniture (superclass)

Table Chair Desk ”Chable"

subclasses of the

instances of Chair
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.
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?
Use-Cases
 a scenario that describes a “thread of usage” for
a system
 actors represent roles people or devices play as
the system functions
 users can play a number of different roles for a
given scenario
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?
Use-Case Diagram
Saf e Ho m e

Acce s s cam e ra
s u rve illan ce via t h e cam e ras
Int e rn e t

Co n fig u re Safe Hom e


s ys t e m param e t e rs

h o m e o wn e r

Se t alarm
Activity Diagram
Supplements the use-case by providing a diagrammatic
representation of procedural flow

e n t e r p a ssw ord
a n d u se r ID

valid pas s wor ds / ID invalid pas s wor ds / ID

se le c t ma jo r func t ion prompt fo r re e n t ry


ot her f unct ions
m ay als o be
s elect ed
input t r ies r em ain
se le c t su rve illa n c e
no input
t r ies r em ain

t hum bnail views s elect a s pecif ic cam er a

se le c t sp e c ific
se le c t c a me ra ic o n
c a me ra - t hu mb n a ils

vie w c a me ra o ut pu t
in la be lle d win do w

p ro mp t for
a n ot h e r vie w

exit t his f unct ion s ee anot her cam er a


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, flow-
oriented modeling continues to provide a view of the
system that is unique—it should be used to supplement
other analysis model elements
The Flow Model
Every computer-based system is an
information transform ....

computer
input based output
system
Flow Modeling Notation

external entity

process

data flow

data store
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
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
Data Flow

Data flows through a system, beginning


as input and be transformed into output.
base
compute
area
triangle
height area
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
Data Flow Diagramming:
Guidelines
 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
Control Specification (CSPEC)
The CSPEC can be:
state diagram
(sequential spec)

state transition table


combinatorial spec
decision tables

activation tables
Guidelines for Building a CSPEC
list all sensors that are "read" by the software
list all interrupt conditions
list all "switches" that are actuated by the operator
list all data conditions
recalling the noun-verb parse that was applied to the
software statement of scope, review all "control items"
as possible CSPEC inputs/outputs
describe the behavior of a system by identifying its
states; identify how each state is reach and defines
the transitions between states

focus on possible omissions ... a very common error in


specifying control, e.g., ask: "Is there any other way I
can get to this state or exit from it?"
Class-Based Modeling
 Identify analysis classes by examining the
problem statement
 Use a “grammatical parse” to isolate potential
classes
 Identify the attributes of each class
 Identify operations that manipulate the attributes
Selecting Classes—Criteria

retained information
needed services
multiple attributes
common attributes
common operations
essential requirements
Class Diagram
Class name
System
systemID
verificationPhoneNumber
systemStatus attributes
delayTime
telephoneNumber
masterPassword
temporaryPassword
numberTries

program()
display()
reset()
query() operations
modify()
call()
Class Diagram
Flo o rPlan
type
name
outs ideDimensions

determineType ( )
pos itionFloorplan
s cale( )
change color( )

is pla c e d wit hin

is pa rt of

Ca m e ra Wa ll

t yp e t yp e
ID wa llDim e n s io ns
lo c a t io n
fie ld Vie w
p a n An gle
Zo o m Se t t in g
determineType ( )
d e t e rm in e Ty p e ()
computeDimensions ( )
t ra n s la t e Lo c a t io n ()
d is p la y ID()
d is p la y Vie w()
d is p la y Zoo m ()
is us e d t o build is us e d t o build

is us e d t o build

Wa llSe gm e nt Window Door

type type t y pe
s t a rt Co o rd in a t e s s t a rt Coo rd in a t e s s t a rt Co ordina t e s
s t o p Co ord in a t e s s t o pCoo rd ina t e s s t op Co ordin a t e s
n e xt Wa llSe m e nt n e x t Win do w ne xt Do or

determineType ( ) determineType ( ) determineType ( )


draw( ) draw( ) draw( )
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.
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
 the creation or update of entity objects;
 the instantiation of boundary objects as they obtain information from
entity objects;
 complex communication between sets of objects;
 validation of data communicated between objects or between the user and
the application.
Responsibilities
 System intelligence should be distributed across classes
to best address the needs of the problem
 Each responsibility should be stated as generally as
possible
 Information and the behavior related to it should reside
within the same class
 Information about one thing should be localized with a
single class, not distributed across multiple classes.
 Responsibilities should be shared among related classes,
when appropriate.
Collaborations
 Classes fulfill their responsibilities in one of two ways:
 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.
 Collaborations identify relationships between classes
 Collaborations are identified by determining whether a class can fulfill each
responsibility itself
 three different generic relationships between classes [WIR90]:
 the is-part-of relationship
 the has-knowledge-of relationship
 the depends-upon relationship
Composite Aggregate Class
Player

PlayerHead PlayerBody PlayerArms PlayerLegs


Associations and Dependencies

 Two analysis classes are often related to one another in


some fashion
 In UML these relationships are called associations
 Associations can be refined by indicating multiplicity (the term
cardinality is used in data modeling
 In many instances, a client-server relationship exists
between two analysis classes.
 In such cases, a client-class depends on the server-class in some
way and a dependency relationship is established
Multiplicity
Wa ll

1 1 1

is used to build is used to build

1..* 0..* is used to build 0..*

Wa llSe g m e n t Win d o w Do o r
Dependencies

DisplayWindow Camera

<<access>>

{password}
Analysis Packages
 Various elements of the analysis model (e.g., use-cases,
analysis classes) are categorized in a manner that
packages them as a grouping
 The plus sign preceding the analysis class name in each
package indicates that the classes have public visibility
and are therefore accessible from other packages.
 Other symbols can precede an element within a package.
A minus sign indicates that an element is hidden from
all other packages and a # symbol indicates that an
element is accessible only to packages contained within a
given package.
Analysis Packages
p ackag e n ame

En viro nm e n t
+Tree
+Landscape
+Road
+Wall
+Bridge
+Building Rule s OfThe Gam e
+VisualEffect
+Scene +RulesOfMovement
+ConstraintsOnAction

Charact e rs

+Player
+Protagonist
+Antagonist
+SupportingRole
Behavioral Modeling
 The behavioral model indicates how software will respond to
external events or stimuli. To create the model, the analyst must
perform the following steps:
 Evaluate all use-cases to fully understand the sequence of interaction within
the system.
 Identify events that drive the interaction sequence and understand how
these events relate to specific objects.
 Create a sequence for each use-case.
 Build a state diagram for the system.
 Review the behavioral model to verify accuracy and consistency.

You might also like