Upload
helena-williamson
View
218
Download
0
Embed Size (px)
Citation preview
Technical Methods for Specifying Requirements
1
When to Use Technical Methods
If the description of the requirement is too complex for natural language and if you cannot afford to have the specification misunderstood, you should consider writing or augmenting that portion of the requirements set with a “technical methods” approach.
2
Examples of Technical Methods
Pseudocode Finite state machines Decision tables and decision trees Activity diagrams (flowcharts) Entity-relationship models And many more
3
Pseudocode
Imperative sentences with a single verb and a single object.
A limited set, typically not more that 40-50, of “action-oriented” verbs from which the sentences must be constructed.
Decisions represented with a formal IF-ELSE-ENDIF structure.
Iterative activities represented with DO-WHILE or FOR-NEXT structures.
4
Pseudocode Example
The algorithm for calculating deferred-service revenue earned for any month is:
Set Sum(x)=0FOR each customer x IF customer purchased paid support AND (Current month) >= (2 months after ship date)) AND (Current month) <= (14 months after ship date)) THEN Sum(x)=Sum(x) + (amount customer paid)/12END
5
Finite State Machines
Sometimes it is convenient to regard the system as a hypothetical machine that can be in only one of a given number of states at any specific time.
In response to an input (from the user or an external source) the machine changes state and carries out some action and/or generates an output.
Both the output and the next state can be determined solely based on understanding the current state and the event that caused the transition.
6
Example of a State Transition Diagram
7
Even Lit
Odd Lit
Count Count
Even Lit/ LOUT
Odd Lit/ LOUT
OFF
Light burned out
Light burned out
1 sec1 sec
Off
OffOff
On
Off
Example of a State Transition Matrix
Event
State On Press
Off Press
Count Press
Bulb Burns Out
Every Second
Output
Off Even lit --- --- --- --- Both Off
Even lit --- Off Odd lit LO/ Even lit
--- Even lit
Odd lit --- Off Even lit LO/ Odd lit
--- Odd lit
Light out/ Even lit
--- Off --- Off LO/ Odd lit
Even lit
Light out/ Odd lit
--- Off --- Off LO/ Even lit
Odd lit
8
Decision Tables and Decision Trees
When a requirement deals with a combination of inputs and different combinations of those inputs lead to different behaviors or outputs, decision tables or decision trees can be helpful.
9
Activity Diagrams
Flowcharts and UML Activity Diagrams are understandable by most people.
They present the same information that can be given in pseudo code, but they show it visually.
10
Entity-Relationship Diagrams
They are useful for showing the relationships among data within the system.
ERDs focus on the external behaviors of the system.
They can be difficult for nontechnical readers to understand.
11