160 likes | 327 Views
Technical Methods for Specifying Requirements. When to Use Technical Methods.
E N D
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.
Examples of Technical Methods • Pseudocode • Finite state machines • Decision tables and decision trees • Activity diagrams (flowcharts) • Entity-relationship models • And many more
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.
Pseudocode Example The algorithm for calculating deferred-service revenue earned for any month is: Set Sum(x)=0 FOR 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)/12 END
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.
Example of a State Transition Diagram Light burned out Even Lit Even Lit/ LOUT Off Off OFF On Count Count 1 sec 1 sec Off Off Odd Lit Odd Lit/ LOUT Light burned out
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.
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.
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.