Está en la página 1de 62

Software Engineering CSCI 4490

Classes 19, 20, 22, & 23


Classical Analysis

September 24, 26, 29, &


October 1, 2014
Outline
Software Engineering CSCI 4490

Products of Classical Analysis Workflow


Specification Document
Software Project Management Plan

Software Specification Methods


Informal
Semi-Formal
Structured Systems Analysis
Entity-Relationship Modeling (ER Diagrams)
Formal
Finite State Machines (FSMs)
Petri Nets
Z
2
* The Specification Document (The What)
Software Engineering CSCI 4490

Detailed description of what system will do

Faults in specification lead to faults in final software, so

Considerations:
feasibility - can s/w be built as specified?
Q: How to check specification correctness?

3
The Classical Analysis Workflow (Schach Ch 11)
Software Engineering CSCI 4490

Specification document must be


Informal enough for client to understand, but
Formal enough for developers, and be contractually binding.
Free of omissions, contradictions, ambiguities

Acceptance Criteria determinable as part of Specification


Can even begin (some) test case development based on
Requirements Document without yet having any code!
If product passes tests, deemed to satisfy specifications

4
Software Project Management Plan (The roadmap)
Software Engineering CSCI 4490

Once the client has signed off the specifications,


detailed planning and estimating begins

We draw up the software project management plan,


including
What?
How much?
When?

What is the earliest possible time for the SPMP?

The McGraw-Hill Companies, 2011


5
*Formality Versus Informality
Software Engineering CSCI 4490

Informal method: Use natural language like English.


Is this a good way to specify software? Why/Why Not?

6
Formality Versus Informality
Software Engineering CSCI 4490

Informal method: Use natural language like English.

Semiformal methods Formal methods


Structured Systems Analysis Finite State Machines
Entity-Relationship (FSMs)
Modeling (ER Diagrams) Petri Nets
Z

7
Structured Systems Analysis
Software Engineering CSCI 4490

Three popular graphical specification methods of 70s


DeMarco
Gane and Sarsen

Yourdon and Constantine

All are equivalent

All are equally good

The McGraw-Hill Companies, 2011


8
*Data Flow Diagram- Foundation of Gane and
Sarsens Structured System Analysis
Software Engineering CSCI 4490

Graphical Notation used to Describe how data flows between


Processes in a System:
Use Notation That Represents Functional Processing, Data
Stores and Data Movements (flows) Between Sequences of
Functional Units.
Focus is on What'
Happens, Not 'How'
It Happens.
Development
Proceeds Stepwise
Start with Context
Level diagram, and
then refine.

9
Sallys Software An Example Using DFDs
Software Engineering CSCI 4490

Sallys Software Store buys software from various


suppliers and sells it to the public:
Popular software packages are kept in stock, but the
rest must be ordered as required.
Institutions and corporations are given credit facilities,
as are some members of the public.
Sallys Software Store is doing well, with a monthly
turnover of 300 packages at an average retail cost of
$250 each.
Sally hires you to help computerize her business.

The McGraw-Hill Companies, 2011


10
Sallys Software Shop Mini Case Study (cont.)
Software Engineering CSCI 4490

The fundamental issue


What is Sallys objective in computerizing her
business?

The McGraw-Hill Companies, 2011


11
*Sallys Software Shop Mini Case Study (cont.)
Software Engineering CSCI 4490

The danger of many standard approaches:

Gane and Sarsens method


Nine-step method
Stepwise refinement is used in many steps

The McGraw-Hill Companies, 2011


12
How to Perform Structured Systems Analysis
Software Engineering CSCI 4490

1. Draw the data flow diagram


2. Decide what sections to computerize and how (batch
or online)
3. Determine the details of the data flows
4. Define the logic of the processes
5. Define the data stores
6. Define the physical resources
7. Determine the input-output specifications
8. Perform the sizing
9. Determine the hardware requirements

The McGraw-Hill Companies, 2011


13
*Step 1. Draw the DFD
Software Engineering CSCI 4490

First refinement
Infinite number of possible interpretations

The McGraw-Hill Companies, 2011


14
*Step 1. (cont.)
Software Engineering CSCI 4490

Second refinement
Verify that order is valid
Differentiate between items in/out of stock

The McGraw-Hill Companies, 2011


15
*Step 1. (cont.)
Software Engineering CSCI 4490

Portion of third refinement


Add invoice/payment details

The McGraw-Hill Companies, 2011


16
Step 1. (cont.)
Software Engineering CSCI 4490

The final DFD is larger


But it is easily understood by the client

When dealing with larger DFDs


Set up a hierarchy of DFDs
A box becomes a DFD at a lower level

The McGraw-Hill Companies, 2011


17
~ICE/Homework: Using DFDs
Software Engineering CSCI 4490

For the Course Project, use a DFD to model the


business process of the project proposed by your
team.

18
Step 2. Decide What Parts to Computerize and How
Software Engineering CSCI 4490

Depends on how much client is prepared to spend


Cost/benefit analysis
Determine solution strategy (How)
General approach to building the product

Find strategies without worrying about constraints

Keep written record of all discarded strategies, and why discarded

Strategy dependent on volume, level of control


Large volumes, tight controls

Small volumes, in-house microcomputer


The McGraw-Hill Companies, 2011
19
*Step 3. Determine the Details of the Data Flows
Software Engineering CSCI 4490

Determine the data items for each data flow

Refine each flow stepwise


Example;

We need a data dictionary for larger products

The McGraw-Hill Companies, 2011


20
Sample Data Dictionary Entries
Software Engineering CSCI 4490

Figure 11.5
The McGraw-Hill Companies, 2011
21
Step 4. Define the Logic of the Processes
Software Engineering CSCI 4490

For process create_invoice Sally has practice of


providing a discount to educational institutions
Sally explains the details of the discount she provides:
10% on up to 4 packages
15% on 5 or more

The McGraw-Hill Companies, 2011


22
*Step 4 . Define the Logic of the Processes (cont.)
Software Engineering CSCI 4490

Translate this into a decision tree

What is the advantage of a decision tree?

23
* Step 5. Define the Data Stores
Software Engineering CSCI 4490

Define the exact contents and representation (format)


Specify the data structure(s) and data types to be used

Specify where immediate access is required


Data immediate-access diagram (DIAD)

Figure 11.8
The McGraw-Hill Companies, 2011
24
* Step 6. Define the Physical Resources
Software Engineering CSCI 4490

For each file, specify:

The McGraw-Hill Companies, 2011


25
Step 7. Determine Input/Output Specifications
Software Engineering CSCI 4490

Specify:

The McGraw-Hill Companies, 2011


26
Step 8. Determine the Sizing
Software Engineering CSCI 4490

Obtain the numerical data needed to determine the


hardware requirements in Step 9

The McGraw-Hill Companies, 2011


27
Step 9. Determine the Hardware Requirements
Software Engineering CSCI 4490

Mass storage requirements

Mass storage for back-up

Input needs

Output devices

Is the existing hardware adequate?


If not, recommend whether to buy or lease additional
hardware
The McGraw-Hill Companies, 2011
28
Entity-Relationship Diagrams (Semi-Formal)
Software Engineering CSCI 4490

For specifying databases divide your database in two logical parts,


entities (e.g. "customer") and relationships ("buys", "pays for").

Author Supplier
1
m
writes
is supplied by p
Project
for use in
n

Autobiog raphy n
n n
Part
reads owns
1 n

1 1

Reader
consists of

Also for OO analysis in determining Objects a system will involve.

29
Data Modeling Notation
Software Engineering CSCI 4490

(b) Crows foot version (ERWin)

30
Data Modeling Notation: ERwin
Software Engineering CSCI 4490

31
Data Modeling Notation: N:M and O-M
Software Engineering CSCI 4490

Note that:
(1) ERwin cannot indicate
true minimum
cardinalities on N:M
relationships
(2) Visio introduces the
intersection table instead
of using a true N:M
model

32
*The Role of Data Dictionaries
Software Engineering CSCI 4490

Generally need further description of named entities


to make model understandable. Collect all
descriptions in a data dictionary:

Advantages:

Q? What data dictionary entries are needed to support your


class project ER model?

33
~ICE/Homework: Using ER Diagrams
Software Engineering CSCI 4490

For the Course Project, identify a minimum of four


data elements projected to be used by the project
proposed by your team (a minimum of two of which
shall be related in some manner).
Use an ER diagram to model the relationships
exhibited among the data elements selected above.

34
*Finite State Machines (Formal Method)
Software Engineering CSCI 4490

Formal Model of Different States of the System.


Useful for Software Specification. Formal here means
Mathematical Rigor used to ensure a proper FSM.
A FSM Has 5 Component Parts:

35
* Finite State Machine Example
Software Engineering CSCI 4490

A safe has a combination lock that can be in one of


three positions, labeled 1, 2, and 3.
The dial can be turned left or right (L or R). Six
possible dial movements, 1L, 1R, 2L, 2R, 3L, and 3R.
The combination to the safe is 1L, 3R, 2L; any other dial
movement will cause the alarm to go off

The McGraw-Hill Companies, 2011


36
~*Finite State Machines (cont.)
Software Engineering CSCI 4490

States {Locked, A, B, Safe Unlocked, Sound Alarm}


Set of inputs {1L, 1R, 2L, 2R, 3L, 3R}
Initial state is Locked
Set of final states {Unlocked, Sound Alarm}
Transition function (Transition Table) takes current state and an
input event and returns new set of output events and next state:
Transition Table for Combo Lock
Current
State Locked A B Sound Alarm Safe
Dial Unlocked
Movement
1L A
1R Sound Alarm
2L
2R
3L
3R
37
*Analysis of FSMs
Software Engineering CSCI 4490

Power of FSMs - serves as an abstraction of the behavior


Advantages

Drawbacks?

38
*Where are FSMs used to Specify Software?
Software Engineering CSCI 4490

Commercial products

System software

Real-time systems
Statecharts are a real-time extension of FSMs
CASE tools typically incorporate FSM tool: Statemate,
Rhapsody
39
~Example: Apartment Automatic Garage Door
Software Engineering CSCI 4490

Description:
The door of the basement garage in an apartment building is opened
from the outside by means of a magnetic card. From the inside it is
opened by a floor sensor tripped by an exiting car. There is also a
manual unit with open, close, and stop buttons inside the garage.
Sensors in the door frame are tripped when the door reaches the fully
closed and fully opened positions. An optical sensor mounted on
the door frame ensures that the doorway is free from obstacles,
stopping the door from closing if the light beam is broken. When the
door has been either fully opened or stopped for 1 minute, it
automatically starts moving down, provided there is no obstacle.

Homework: Draw a Finite State Machine that depicts


the operation of the Apartment Automatic Garage
Door.
40
Petri Nets
Software Engineering CSCI 4490

A major difficulty with specifying real-time systems


is timing
Synchronization problems
Race conditions

Deadlock

Often a consequence of poor specifications

The McGraw-Hill Companies, 2011


41
Petri Nets (cont.)
Software Engineering CSCI 4490

Petri nets
A powerful technique for specifying systems that have
potential problems with interrelations

A Petri net consists of four parts:

The McGraw-Hill Companies, 2011


42
Petri Nets (cont.)
Software Engineering CSCI 4490

Set of places P is
{p1,p2, p3, p4}

Set of transitions T
is {t1, t2}

Input functions:
I(t1) = {p2, p4}
I(t2) = {p2}

Output functions:
Figure 11.18
O(t1) = {p1}
O(t2) = {p3, p3}

The McGraw-Hill Companies, 2011


43
Petri Nets (cont.)
Software Engineering CSCI 4490

A marking of a Petri net is an assignment of tokens to


that Petri net

Figure 11.19

Four tokens: one in p1, two in p2, none in p3, and one in
p4
Represented by the vector (1,2,0,1)
The McGraw-Hill Companies, 2011
44
*Petri Nets (cont.)
Software Engineering CSCI 4490

A transition is enabled if each of its input places has


as many tokens in it as there are arcs from the place
to that transition. Which transitions are enabled
(ready to fire)?

The McGraw-Hill Companies, 2011


45
Petri Nets (cont.)
Software Engineering CSCI 4490

Petri nets are indeterminate


Suppose t1 fires

What is the resulting marking?

Figure 11.20

The McGraw-Hill Companies, 2011


46
Petri Nets (cont.)
Software Engineering CSCI 4490

Now only t2 is enabled

Figure 11.21

What is the marking after it fires?

The McGraw-Hill Companies, 2011


47
Petri Nets (cont.)
Software Engineering CSCI 4490

Inhibitor arcs
An inhibitor arc is marked by a small circle, not an
arrowhead

Figure 11.22
Transition t1 is enabled

The McGraw-Hill Companies, 2011


48
Petri Nets (cont.)
Software Engineering CSCI 4490

Petri nets can also be used for design

Petri nets possess the expressive power necessary for


specifying synchronization aspects of real-time
systems

49
Z
Software Engineering CSCI 4490

Z (pronounced zed) is a formal specification


language
A Z specification consists of four sections:
1. Given sets, data types, and constants
2. State definition
3. Initial state
4. Operations

The McGraw-Hill Companies, 2011


50
1. Given sets
Software Engineering CSCI 4490

Given sets are sets that need not be defined in detail

Names appear in brackets

For the elevator problem we need the set of all buttons

The specification therefore begins


[Button]

The McGraw-Hill Companies, 2011


51
2. State Definition
Software Engineering CSCI 4490

Z specification consists of a number of schemata


A schema consists of a group of variable declarations,
plus
A list of predicates that constrain the values of
variables

Figure 11.25

The McGraw-Hill Companies, 2011


52
Z: The Elevator Problem Case Study
Software Engineering CSCI 4490

In this problem there are four subsets of Button


The floor buttons
The elevator buttons

buttons (the set of all buttons in the elevator problem)

pushed (the set of buttons that have been pushed)

The McGraw-Hill Companies, 2011


53
Schema Button_State
Software Engineering CSCI 4490

Figure 11.26

The McGraw-Hill Companies, 2011


54
3. Initial State
Software Engineering CSCI 4490

The state when the system is first turned on

Button_Init ^= [Button_State' | pushed' = ]

(The caret ^ should be on top of the first equals sign =.


Unfortunately, this is hard to type in PowerPoint!)

The McGraw-Hill Companies, 2011


55
4. Operations
Software Engineering CSCI 4490

Figure 11.27

The McGraw-Hill Companies, 2011


56
Z: The Elevator Problem Case Study (cont.)
Software Engineering CSCI 4490

Figure 11.28

The McGraw-Hill Companies, 2011


57
Analysis of Z
Software Engineering CSCI 4490

Z is the most widely used formal specification


language

It has been used to specify


CICS IBM Transaction Processing System (part)
An oscilloscope

A CASE tool

Many large-scale projects (especially in Europe)

The McGraw-Hill Companies, 2011


58
Analysis of Z (cont.)
Software Engineering CSCI 4490

Difficulties in using Z
The large and complex set of symbols
Training in mathematics is needed

The McGraw-Hill Companies, 2011


59
Analysis of Z (cont.)
Software Engineering CSCI 4490

Reasons for the great success of Z


It is easy to find faults in Z specifications
The specifier must be extremely precise

We can prove correctness (we do not have to)

Only high-school math needed to read Z

Z decreases development time

A translation of a Z specification into English (or


another natural language) is clearer than an informal
specification

The McGraw-Hill Companies, 2011


60
Analysis Testing
Software Engineering CSCI 4490

The analysis artifacts should be checked by means of


a review
Representatives of the client and analysis team must be
present
Walkthroughs and inspections particularly effective

The SPMP must be similarly checked


Pay special attention to the cost and duration estimates

The McGraw-Hill Companies, 2011


61
Specification Document Contents (Classical)
Software Engineering CSCI 4490

1. Introduction (Overview/Problem Statement)


2. Glossary (Data Dictionary)
3. Operating Environment (Environment in which system will run)
4. Interfaces (GUIs, Databases/Datastores, DFDs, FSMs)
5. System Operation (Major ops, internal ops, DFSs, FSMs, ER)
6. Information (Major units of data that system uses, ER diagrams)
7. Performance (Performance parameters to which system must
conform, min/max #users, timing constraints)
8. Parallelism (Portions of system that execute in parallel)
9. Concurrent Engineering (Portions of the system that can be
developed in parallel)
10. Security (What access must be controlled, passwords)

62

También podría gustarte