Presentation is loading. Please wait.

Presentation is loading. Please wait.

Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Code Design (The use of pseudo code for Elementary Process Descriptions)

Similar presentations


Presentation on theme: "Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Code Design (The use of pseudo code for Elementary Process Descriptions)"— Presentation transcript:

1 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Code Design (The use of pseudo code for Elementary Process Descriptions)

2 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing What are mini specifications? A process descriptor provides a detailed explanation of the internal processing policy of a functional primitive that transforms input data into output data

3 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Documenting a process Various means and tools include l pseudo code (structured English) l decision trees l decision tables l action diagrams l mathematical algorithms

4 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Documenting the policy Need only specify the processing policies necessary to transform data or simply provide data. When stating policy, only specify what rather than how with regard to processing data. Try to specify data transformations from the user’s vantage point.

5 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing A process descriptor... l must exist for every functional primitive in a DFD l must state the ways in which data flowing into the process are transformed into output flows l must state the policy that governs the transformation, not the method to do so l should seek to control redundancy l should use a small set of constructs

6 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Additional process descriptor information As well as logic the process descriptor should mention l processor requirements l security requirements l time requirements l processing requirements l performance requirements l safety requirements

7 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Specifying logic (1) Sequence Repetition AB A A Do WhileRepeat Until

8 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Specifying logic (2) Selection A A B A CB IFIF THEN ELSECASE

9 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Pseudo code/structured English Programming Design Language (PDL) by Caine and Gordon, a ‘pidgin’ language that uses the vocabulary of one language (i.e. English) and the overall syntax of another (i.e. a structured programming language) Tom DeMarco defines structured English as a specification language that uses a limited vocabulary and a limited syntax

10 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Structured English vocabulary The vocabulary consists of l imperative English-language verbs l terms defined in the data dictionary l certain reserved words for logic formulation The structured English minimal set can now be defined

11 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Syntax and variables l Data flows, data stores, common processing routines: upper case hyphenated words (define in data dictionary) l Local variables: upper case hyphenated words (do not define in data dictionary) l Commands, primitive functions, sources/sinks: lower case first letter capitalised l Prepositions/verbs: lower case

12 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Assignment statements Assign values to single variables with VARIABLE = Value / Literal / Expression VARIABLE Value / Literal / Expression Set VARIABLE to Value / Literal / Expression Compute VARIABLE = Expression

13 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Operators (1) Arithmetic expressions l Results are numeric l Operators are:addition (+) subtraction (-) multiplication (*) division (/) exponentiation (**)

14 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Operators (2) Boolean expressions l Results are either True or False l Logical operators And, Or and Not l Relational operators:less than (<) less than or equal (<=) equal (=) not equal ( ) greater than (>) greater than or equal (>=)

15 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Sequence of execution All commands are intended to be executed in a forward sequential order as written unless the logic or command indicates otherwise. It is helpful to establish indentation rules to help identify computational units.

16 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Repetition statements (1) Do While statement While condition Do : statements : EndWhile condition statements False True

17 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Repetition statements (2) Repeat Until statement Repeat : statements : Until condition condition statements True False

18 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Decision statements If...Then...Else If condition then : statements1 : else : statements2 : endif condition statements1 statements2 True False

19 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Input/output statements Various ways of designating flow of data into and out of a functional primitive process are acceptable InputOutput AcceptSend GetPut ReadWrite or Print

20 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing File manipulation These commands not absolutely necessary Create data-entry in data-store-name Delete data-entry from data-store-name Search data-store-name for condition Locate data-element(s) in data-store-name for condition Match data-element-1 to data-element-2 in data-store- name Merge data-store-name-1 into data-store-name-2

21 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Case statements Allows several alternative sets of processing logic to be distinguished without the need for multiple If..Then..Else statements Case 1 (condition) statements1 Endcase 1 Case 2 (condition) statements2 Endcase 2 : Else statements (n+1) Endcases

22 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Common processing routines (1) l Defined in the data dictionary l Can be called more than once in the system l CALL statement lists the parameters needed by the called process to perform its tasks. l The calling process receives the output data elements from the called routine CALL common-processing-routine-name (parameter list)

23 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Common processing routines (2) 7.1.1 Validate currency exchange 7.1.3 Calculate commission fee 7.1.2 Calculate currency value Determine current exchange rate Currency Type Exchange Rate Currency details Converted currency Exchange request Total currency

24 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Common processing routines (2) Calculate Currency Exchangedescriptor 7.1.2 Input Currency details from Validate currency exchange : Call Determine current exchange rate (Currency Type, Exchange Rate) Multiply Currency Value by Exchange Rate : Output Total currency to Calculate commission fee Stop

25 Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Suspension, termination & comments It may be necessary at times to halt processing temporarily: –to allow a passage of time Output Request-For-Info-Msg to Customer WAIT Input Customer-Info from Customer –to wait to be reactivated by another process Output Customer-Rec to Master-File WAIT


Download ppt "Dr. Andy Seddon Staffordshire UNIVERSITY School of Computing Code Design (The use of pseudo code for Elementary Process Descriptions)"

Similar presentations


Ads by Google