CS35: Assignment 16

CS35: Programming and Problem Solving
Ray Ontko
Department of Computer Science
Earlham College

Due Wednesday, 1999/10/27

Reading Assignment

Read sections 7.1 through 7.4 in Deitel and Deitel. Optionally, read sections 5.1 and 5.2 in Kernighan and Ritchie.

Journal Opportunity

The technique of step-wise refinement as an approach to problem-solving is a recurring theme in programming. For example, if we apply it to the early stages of program design and development, we encounter the technique known as "pseudo coding". This approach to programming involves:

  1. writing a clear and concise specification of the program in English (or some other natural language),
  2. translating the specification into a C-like language, pseudo-code in which the overall control structures (if, while, for, do, switch, etc) and functional decomposition (function names and parameters) are present but most details remain described, not coded, and finally,
  3. translating the pseudo-code into a working C program by filling in the details.

This top-down approach allows the designer/programmer to focus on the "big picture" (macro) aspects of the program separately from the detailed (micro) aspects of the program.

Using a programming problem you're familiar with, show a specification of the problem, a pseudo-code for the problem, and a program for the problem. How do you know when to stop specifying and start pseudo coding? How do you know when to stop pseudo coding and start coding? Discuss the advantages and disadvantages of such an approach.

Copyright © 1999, Ray Ontko (rayo@ontko.com).