Title: ITIS 3310 Software Architecture and Design Chapter 8 Analysis Modeling
1ITIS 3310 Software Architecture and Design
Chapter 8Analysis Modeling
2Introduction
- Tom DeMarco (1979) on goals of analysis modeling
- The products of analysis must be highly
maintainable. This applies particularly to the
Target Document - Problems of size must be dealt with using
partitioning. The Victorian novel specification
is out. - Graphics have to be used whenever possible.
- We have to differentiate between logical
essential and physical implementation
considerations
3Introduction
- At the very least we need
- Something to help us partition our requirements
and document that partition before specification
- Some means of keeping track of and evaluating
interfaces - New tools to describe logic and policy, something
better than narrative text - Such a model is the beginning of the software
engineering process - Source for the specification of what will be built
4Introduction
- Analysis models
- Combination of methods to depict requirements for
- Data
- Behavior
- Better than written word
- Easier to understand
- Better to review for
- Correctness
- Completeness
- Consistency
- Different perspectives increase probability that
problems will be detected
5Requirements Analysis
- Requirements analysis
- Specifies softwares operational characteristics
- Indicates software's interface with other system
elements - Establishes constraints that software must meet
- Requirements analysis allows the software
engineer to - Elaborate on basic requirements established
earlier - 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 - Emphasis is what not how
6Objectives
- Analysis models have three primary objectives
- Describe what the customer requires
- Establish a basis for creating the design
- Define requirements that can be validated once
software is built
7A Bridge
Customer may be unsure of precise requirements
Developer may be unsure of how to accomplish
solution
Bridge between system description and design model
8Rules 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 - Dont worry about details at this time
- Each element of the analysis model should
- Add to an overall understanding of software
requirements - Provide insight into the information domain,
function and behavior of the system - Delay consideration of infrastructure and other
non-functional models until design
9Rules of Thumb
- Minimize coupling throughout the system
- Interconnectedness kept to a minimum
- Be certain that the analysis model provides value
to all stakeholders - Keep the model as simple as it can be
10Domain 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 . . .
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
11Domain 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
12Analysis Modeling Approaches
- Structured Modeling
- Considers
- Data
- Processes that transform data
- Data modeled by defining attributes and
relationships - Processes Modeled to show transformations
- Object-Oriented Analysis
- Defines classes and their collaborations
13Analysis Model
Scenario-based Elements Use-Cases Text Use
Cases Diagrams Activity Diagrams Swim Lane
Diagrams
Flow-oriented Elements Data Flow
Diagrams Control-Flow diagrams Processing
Narratives
Class-based Elements Class Diagrams Analysis
Packages CRC Models Collaboration Diagrams
Behavioral Elements State Diagrams Sequence
Diagrams
14Resume 2/8
15Data Modeling
- Data Models
- Focus attention on the data domain
- Examine data objects independently of processing
- Exist at the customers level of abstraction
- Indicate how data objects relate to one another
- Typically concerned with data objects
16What 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
17Typical 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)
18Data Objects and Attributes
A data object encapsulates data only, i.e., it
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
19What 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
20What is a Relationship?
- Relationships define the roles of objects within
the context of the software to be built
Owns
Insured to drive
21What is a Relationship?
- Cardinality
- The number of occurrences of objects in a given
relationship - Modality
- Whether or not a relationship is mandatory or
optional
22ERD Notation
One common form
(0, m)
object
object
relationship
1
2
(1, 1)
attribute
Another common form
relationship
object
object
1
2
(1, 1)
(0, m)
23ERD Notation
http//www.smartdraw.com/tutorials/software-erd/er
dcardinality.htm
24ERD Notation
http//www.umsl.edu/sauter/analysis/er/er_intro.h
tml
25The ERD An Example
request for service
Customer
places
(1,1)
(1,m)
(1,1)
standard task table
(1,n)
work order
generates
(1,1)
(1,1)
(1,1)
(1,w)
work tasks
selected from
consists of
(1,w)
(1,i)
materials
lists
26Object-Oriented Concepts
- Goal
- Define all classes, their behaviors, and the
relationships between them - Relevant to the problem to be solved
- Key concepts
- Classes and objects
- Attributes and operations
- Encapsulation and instantiation
- Inheritance
- Not an input-process-output model
27Classes
- Class defined as
- Template
- Generalized description
- blueprint ... describing a collection of
similar items - Metaclass (also called a superclass) establishes
a hierarchy of classes - Specific instances of the class can be identified
28Building a Class
29What is a Class?
occurrences
roles
organizational units
things
places
external entities
structures
class name
attributes
operations
30Encapsulation/Hiding
The object encapsulates both data and the
logical procedures required to manipulate the data
method 2
method 1
data
method 3
method 6
method 4
method 5
Achieves information hiding
31Class Hierarchy
PieceOfFurniture (superclass)
Table
Chair
Desk
Chable"
subclasses of the
instances of Chair
32Methods(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.
33Scenario-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?
34Developing a Use-Case
- What are the main tasks or functions that are
performed by the actor? - What system information will 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?
35Use-Case Diagram
36Activity Diagram
Supplements the use-case by providing a
diagrammatic representation of procedural flow
37Swimlane 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
38Flow-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 uniqueit
should be used to supplement other analysis model
elements
39The Flow Model
Every computer-based system is an information
transform ....
computer based system
input
output
40Flow Modeling Notation
external entity
process
data flow
data store
41External 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
42Process
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
43Data Flow
Data flows through a system, beginning as input
and be transformed into output.
base
compute triangle area
area
height
44Data Stores
Data is often stored for later use.
sensor
sensor , type, location, age
look-up sensor data
report required
type, location, age
sensor number
sensor data
45Data Stores
http//www.smartdraw.com/examples/software-dfd/cou
rsereg.htm
46Data Flow DiagrammingGuidelines
- 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
47Constructing a DFDI
- Review the data model to isolate data objects
(nouns) and use a grammatical parse to determine
operations (verbs) - Determine external entities (producers and
consumers of data) - Create a level 0 DFD
48Level 0 DFD Example
processing request
user
requested video signal
digital video processor
monitor
video source
NTSC video signal
49Constructing a DFDII
- 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
50The Data Flow Hierarchy
a
b
P
x
y
level 0
c
p2
a
f
p1
level 1
b
p4
d
5
g
p3
e
51Data Flow Errors
Gray Hole
Black Hole
Miracle
www.sims.berkeley.edu/courses/ is208A/s04/lectures
/208-dataflowdgm.ppt
52Data Flow Errors
www.sims.berkeley.edu/courses/ is208A/s04/lectures
/208-dataflowdgm.ppt
53Flow Modeling Notes
- Each bubble is refined until it does just one
thing - 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)
54Process Specification (PSPEC)
bubble
PSPEC
narrative
pseudocode (PDL)
equations
tables
diagrams and/or charts
55DFDs A Look Ahead
Maps into
Analysis model
56Control Flow Diagrams
- Events or control items
- Implemented as Boolean values
- True/False
- 1/0
- List of discrete conditions
- Empty, Jammed, Full
- and the processes that manage them
57Control Flow Diagrams
- Analyze candidates for events
- Listing all sensors that are "read" by the
software - Listing all interrupt conditions
- Listing all "switches" that are actuated by an
operator - Listing all data conditions
- Recalling the noun/verb parse that was applied to
the processing narrative, review all "control
items" as possible CSPEC inputs/outputs - Control flow diagram is "superimposed" on the DFD
- Shows events that control the processes
58Control Flow Diagram
beeper on/off
copies done
full
manage copying
read operator input
problem light
start
reload process
empty
create user displays
perform problem diagnosis
jammed
display panel enabled
59Class-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
60Analysis Classes
- External entities (e.g., systems, devices,
people) - Produce or consume information to be used by a
computer-based system - Things (e.g, reports, displays, letters, signals)
- 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) - Occur within the context of system operation
- Roles (e.g., manager, engineer, salesperson)
- Played by people who interact with the system
61Analysis Classes
- Organizational units (e.g., division, group,
team) - Relevant to an application
- Places (e.g., manufacturing floor or loading
dock) - Establish the context of the problem and the
overall function of the system - Structures (e.g., sensors, four-wheeled vehicles,
or computers) - Define a class of objects or related classes of
objects
62Selecting ClassesCriteria
- What should be included in the analysis model?
- Retained information
- Class will be useful if information associated
with it is necessary for the system to function - Needed services
- Class has a set of identifiable operations that
change the value of its attributes in some way - Multiple attributes
- That is, major information instead of single
attribute (minor) information
63Selecting ClassesCriteria
- What should be included in the analysis model
(cont.)? - Common attributes
- The class has a set of attributes that apply to
all instances of the class - Common operations
- The class has a set of operations that apply to
all instances of the class - Essential requirements
- External entities that produce or consume
information essential to the operation of the
system will almost always be represented by a
class
64Class Diagram
Class name
Attributes
Operations
65Class Diagram
66CRC Modeling
- Class-Responsibility-Collaboration Model
- 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
67CRC Modeling
68Class Types
- Entity classes, also called model or business
classes, are extracted directly from the
statement of the problem - 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
69Class Types
- Controller classes manage a unit of work from
start to finish - Controller classes can be designed to manage
- Creation or update of entity objects
- 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
70Responsibilities
- 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.
71Collaborations
- Classes fulfill their responsibilities in one of
two ways - Uses its own operations to manipulate its own
attributes, thereby fulfilling a particular
responsibility, or - Collaborates with other classes
- Collaborations
- Identify relationships between classes
- Are identified by determining whether a class can
fulfill each responsibility itself
72Collaborations
- Three different generic relationships between
classes - Is-part-of
- Has-knowledge-of
- Depends-upon
73Composite Aggregate Class
Is-part-of relationship
74Associations 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
75Multiplicity
76Dependencies
77Analysis 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.
78Analysis Packages
79Behavioral Modeling
- Static representations
- Class diagrams
- CRC models
- Any class-oriented models
- Systems have behaviors
- Characterized by
- Events
- What they are
- How the system responds to them
- Time
80Behavioral Modeling
- 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
81State Representations
- Two different characterizations of states must be
considered - 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 - The state of a class may be both passive and
active - A passive state is simply the current status of
all of an objects attributes - The active state of an object indicates the
current status of the object as it undergoes a
continuing transformation or processing
82State Diagram for the ControlPanel Class
83State Terminology
- State Observable circumstances that
characterize the behavior of a system at a given
time - State transition 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
84Behavioral 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 diagram or a sequence diagram
85Sequence Diagram
86Writing the Software Specification
Everyone knew exactly what had to be done until
someone wrote it down!
87Specification Guidelines
88Specification Guidelines
89Specification Guidelines
90Summary
- Analysis Modeling
- Create a variety of depictions of software
requirements - Information
- Function
- Behavior
- Different philosophies available
- Structured analysis
- Object Oriented Analysis
- Can be complementary
- Models used
- Scenario-based users point of view
- Flow what happens to data
- Class-based objects data and actions