47
UHD-CMS-CH10 1 Specification Phase Chapter Ten

UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

Embed Size (px)

Citation preview

Page 1: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 1

Specification Phase

Chapter Ten

Page 2: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 2

SPECIFICATION DOCUMENT

The specification document must be• Informal enough for client• Formal enough for developers• Free of omissions, contradictions, ambiguities

Page 3: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 3

SPECIFICATION DOCUMENT

Constraints– Cost

– Time

– Portability

– Reliability

– Response time

Acceptance Criteria– Vital to spell out series of tests

– Product passes tests, deemed to satisfy specs.

– Some are restatements of constraints

Page 4: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 4

SOLUTION STRATEGY

• General approach to building the product• Find strategies without worrying about

constraints• Modify/select strategies in light of constraints• Keep written record of all discarded strategies

and why discarded:– To protect spec team

– To prevent unwise new solutions during maintenance phase

Page 5: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 5

SPECIFICATION METHODS

• Informal• Semi-formal• formal

Page 6: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 6

INFORMAL SPECIFICATIONS

Example:

“if sales of current month are below target sales, then report is to be printed, unless difference between target sales and actual sales is less than half of difference between target sales and actual sales in previous month, or if difference between target sales and actual sales for the current month is under 5%”

Page 7: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 7

INFORMAL SPECIFICATIONS

• Based on Natural Languages• Can be ambiguous

Claim: – ambiguity can not arise when specs done by

professionals

Refutation:– Text Processing case (see textbook)

Page 8: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 8

INFORMAL SPECIFICATIONS

• Conclusion: Natural Language NOT good way to specify product

Fact:– Many organizations still use natural language,

especially for commercial products

Reasons:– Uninformed management

– Under-trained computer professionals

– Management gives in to client pressure

– Management unwilling to invest in training

Page 9: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 9

STRUCTURED SYSTEMS ANALYSISThree popular graphical specification methods

– DeMarco

– Gane and Sarsen

– Yourdon

• Equivalent• Equally good• Many US corporations use them for

commercial products• Gane and Sarsen used for Object-Oriented

design

Page 10: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 10

SSA: CASE STUDY

• Sally’s 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. Institution and corporations are given credit facilities, as are some individuals. Sally’s store is doing well, but despite her business success Sally has been advised to computerize. Should she?

• Better question: what part?

Page 11: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 11

CASE STUDY

Fundamental issue– What is Sally’s objective in computerizing her

business?

Assume– Objective is “to make more money”

• Cost/benefit analysis for each section of business.

Page 12: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 12

CASE STUDY

Gane and Sarsen Technique:• A nine step method• Stepwise refinement in many steps

Page 13: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 13

CASE STUDY• Data flow diagram (DFD) shows logical data

flow (what happens, not how it happens)

Page 14: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 14

STEP 1: DRAW THE DFDFirst refinement

Page 15: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 15

STEP 1- Second Refinement

Page 16: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 16

STEP 1- Portion of third refinement

Page 17: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 17

STEP 1 contd

Final DFD– Larger, BUT easily understood by client

Larger DFDs– Hierarchy of DFDs

– Each box becomes DFD at a lower level

Page 18: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 18

STEP 2: Decide what parts to computerize

• cost/benefit analysis

STEP 3: Refine data flow• Data items for each data flow• Refine each flow stepwise

order:

order identifications

customer details

package details

• Refine further• Need data dictionary

Page 19: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 19

STEP4: Refine Logic of Processes

Example: • Process: Give educational discount

– Sally must explain discount for educational institutions

– 10% on up to 4 packages, 15% on 5 or more

• Translate into decision tree

Page 20: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 20

STEP 5: Refine Data Stores• Define contents and representation (format)• Specify where immediate access is required

– define type of queries

– define Data Immediate Access Diagram (DIAD)

Page 21: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 21

STEP 6: Define Physical Resources

For each file, specify– File name

– Organization

– Storage medium

– Records (to field level)

DBMS:– define each table

STEP 7: Determine I/O Specs• Specify input forms, input screens, printed

output

Page 22: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 22

STEP 8: Perform Sizing

Determine data for step 9:– Volume of input (daily or hourly)

– Size, frequency. Deadline for each printer report

– Size, number of records processed

– Size of each file

Page 23: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 23

STEP 9: Hardware Requirements

– Mass Storage requirements

– Input needs

– Output devices

– Is existing hardware adequate?

However– Response time can NOT be determined

Page 24: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 24

ENTITY-RELATIONSHIP DIAGRAMS• Semi-Formal technique• Data-Oriented • Widely used in specifying databases• used for Object-Oriented Analysis

• Example: Author, Biography, Reader

Page 25: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 25

ENTITY-RELATIONSHIP DIAGRAMS

1-to-many relationships

Page 26: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 26

ENTITY-RELATIONSHIP DIAGRAMS

Many-to-many relationships

Page 27: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 27

FORMAL TECHNIQUES

• Finite State Machines• Petri Nets• Z

Page 28: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 28

FINITE STATE MACHINES

• 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). Thus there are 6 possible dial movements: 1L, 1R, 2L, 2R, 3L, and 3R. The combination to the safe is 1L, 3R, 2L. Any other dial movement cause the alarm to go off.

Page 29: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 29

FINITE STATE MACHINES

• Set of states: (SafeLocked, A, B, SafeUnlocked, SoundAlarm)

• Set of inputs:( 1L, 1R, 2L, 2R, 3L, 3R)• Transition function:• Initial State: SafeLocked• Set if final states: (SafeUnlocked, SoundAlarm)

Page 30: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 30

FSM--State Transition Diagram(STD)

Page 31: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 31

FSM--State Transition Table

Page 32: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 32

EXTENDED FSM

• Extended FSM with global predicates– predicate: condition in terms of global state/event or

a combination of them

• Transition rules have form:– State and Event and Predicate ==> New State

Page 33: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 33

ELEVATOR PROBLEM

Page 34: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 34

ELEVATOR PROBLEM

Page 35: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 35

ELEVATOR PROBLEM

Page 36: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 36

ELEVATOR PROBLEM

Page 37: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 37

ELEVATOR PROBLEM

Page 38: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 38

ELEVATOR PROBLEM

Page 39: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 39

ELEVATOR PROBLEM

Page 40: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 40

Page 41: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 41

POWER OF FSM TO SPEC COMPLEX SYSTEMS• Specs take simple form• Specification is

– Easy to write down

– Easy to validate

– Easy to convert into design

– Easy to generate code automatically

– More precise than graphical methods

– Almost as easy to understand

• However– Timing considerations not handled

Page 42: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 42

WHO IS USING FSMS?

• Commercial Products– Menu driven

– Various states/screens

– Automatic code generation a major plus

• System Software– Operating systems

– Word processors

– Spreadsheets

• CASE tools– Statemate

Page 43: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 43

PETRI NETS

• Powerful technique for specifying systems with potential timing problems– Concurrency and synchronization

– Race conditions

– Deadlock

– originally used by automata theorists

– now used in performance evaluation, O/S, and SE fields

Page 44: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 44

Formal Specifications - Cont.

• Z– a formal specification language

– uses set theory, functions, and discrete math.

– Initially difficult to learn

– the most widely language

Page 45: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 45

Testing during Spec. Phase

• Walkthrough• Inspection (more powerful)

– team of inspectors checks specs against a checklist

• If a formal tech. is used other testing tech. such as correctness-proving methods can be applied, simulation of FSM/Petri Nets etc.

Page 46: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 46

CASE tools

• Two classes– Graphical tools

• DFD, FSMs, Petri nets, ER diagrams

– Data dictionary

• the two should be integrated• E.g.,

– Analyst/Designer, Excelerator, software through pictures, system architect, and Teamwork

Page 47: UHD-CMS-CH101 Specification Phase Chapter Ten. UHD-CMS-CH102 SPECIFICATION DOCUMENT The specification document must be Informal enough for client Formal

UHD-CMS-CH10 47

Metrics• Five fundamental metrics

– size

• number of items in the data dictionary

– cost

– duration

– effort

– quality

• number faults found during inspection

• This information is tentative at best