Code Design - PowerPoint PPT Presentation

1 / 25
About This Presentation
Title:

Code Design

Description:

provides a detailed explanation of the internal processing policy of a ... Programming Design Language (PDL) by Caine and Gordon, a pidgin' language that ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 26
Provided by: compu354
Category:
Tags: caine | code | design

less

Transcript and Presenter's Notes

Title: Code Design


1
Code Design
  • (The use of pseudo code
  • for process descriptors)

2
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
Documenting a process
  • Various means and tools include
  • pseudo code (structured English)
  • decision trees
  • decision tables
  • action diagrams
  • mathematical algorithms

4
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
    users vantage point.

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

6
Additional process descriptor information
  • As well as logic the process descriptor should
    mention
  • processor requirements
  • security requirements
  • time requirements
  • processing requirements
  • performance requirements
  • safety requirements

7
Specifying logic (1)
  • Sequence
  • Repetition

Do While
Repeat Until
8
Specifying logic (2)
  • Selection

A
IF
IF THEN ELSE
CASE
9
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
Structured English vocabulary
  • The vocabulary consists of
  • imperative English-language verbs
  • terms defined in the data dictionary
  • certain reserved words for logic formulation
  • The structured English minimal set can now be
    defined

11
Syntax and variables
  • Data flows, data stores, common processing
    routines upper case hyphenated words (define in
    data dictionary)
  • Local variables upper case hyphenated words (do
    not define in data dictionary)
  • Commands, primitive functions, sources/sinks
    lower case first letter capitalised
  • Prepositions/verbs lower case

12
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
Operators (1)
  • Arithmetic expressions
  • Results are numeric
  • Operators are addition ()
  • subtraction (-)
  • multiplication ()
  • division (/)
  • exponentiation ()

14
Operators (2)
  • Boolean expressions
  • Results are either True or False
  • Logical operators And, Or and Not
  • Relational operators less than (lt)
  • less than or equal (lt)
  • equal ()
  • not equal (lt gt)
  • greater than (gt)
  • greater than or equal (gt)

15
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
Repetition statements (1)
  • Do While statement
  • While condition Do
  • statements
  • EndWhile

False
True
17
Repetition statements (2)
  • Repeat Until statement
  • Repeat
  • statements
  • Until condition

statements
condition
True
False
18
Decision statements
  • If...Then...Else
  • If condition then
  • statements1
  • else
  • statements2
  • endif

condition
True
False
statements1
statements2
19
Input/output statements
  • Various ways of designating flow of data into and
    out of a functional primitive process are
    acceptable
  • Input Output
  • Accept Send
  • Get Put
  • Read Write or Print

20
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
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 (n1)
  • Endcases

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

23
Common processing routines (2)
Exchange request
Currency details
Total currency
Converted currency
Currency Type
Exchange Rate
Determine current exchange rate
24
Common processing routines (2)
  • Calculate Currency Exchange descriptor 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
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
Write a Comment
User Comments (0)
About PowerShow.com