Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Program Design Language (PDL) - Computer Programming Techniques - Lecture Slides, Slides of Computer Engineering and Programming

Some concept of Computer Programming Techniques are Tree Example, Self-Documenting Code, Programming tools, Program Design Language, Pointers Structs, Introduction Pointers, Data Structures and Operations, Data Abstraction. key points of this lecture are: Program Design Language, Program Design, BuildingRoutine, Program Design Language, Code Itself, Specific Operations, Level of Intent, Level That Generating, PDL Benefits, Reviews Easier

Typology: Slides

2012/2013

Uploaded on 04/25/2013

obesix
obesix 🇺🇸

4.2

(18)

239 documents

1 / 19

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Program Design
Language (PDL)
Docsity.com
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13

Partial preview of the text

Download Program Design Language (PDL) - Computer Programming Techniques - Lecture Slides and more Slides Computer Engineering and Programming in PDF only on Docsity!

1

Program Design

Language (PDL)

2

Steps in Building a Routine

4

Example of Bad PDL

5

Example of Good PDL

7

Design the Routine

Example: ReadErrorMessage()

Spec:

RecordErrorMessage() takes an error code as an input argument and outputs an error message corresponding to the code. It‟s responsible for handling invalid codes. If t h e p r o g r a m i s o p e r a t i n g i n t e r a c t i v e l y , RecordErrorMessage() prints the message to the user. If it‟s operating in batch mode, RecordErrorMessage() logs the message to a message file. After outputting the message, RecordErrorMessage() returns a status variable indicating w h e t h e r i t s u c c e e d e d o r f a i l e d.

8

Design the Routine

 Check the prerequisites

  • check if the job of the routine is well defined and fits into the architecture

 Define the problem that the routine will solve

  • State the problem in enough detail
  • State the Input, Output, Internal data, Error handling

 Name the routine

  • Use precise, unambiguous name (like ReadErrorMessage() )
  • Avoid names with the words „Handle‟, „Process‟ or other vague words

10

Design the Routine

 Think about the data

  • If data manipulation is the main purpose, think about it before the logic.

 Check the PDL

  • Make sure you really understand PDL. Otherwise, how can you understand the code written from it?

 Iterate

  • Try as many ideas as you can in PDL before start coding.
  • Refine until each PDL statement can be translated into one or a few lines of code

11

Turning PDL into Code

 Write the routine declaration

 Added the header comment

 Turn the PDL into comments

 Fill in the code below each comment.

13

Example of a Header Comment

14

Example of PDL

16

Example of Expressing PDL Comments

as Code

17

Complete Routine

19

Complete Routine