McConnell_2004_CH09_The_PseudoCode_Process Flashcards
Drawing of a diagram of the steps in creating a class…?
Page 216
Draw a diagram of the steps in creating a routine…?
Page 217
What is the definition of ‘pseudocode’…?
It refers to an informal, English-like notation for describing how an algorithm, a routine, a class, or a program will work. The Psuedocode Programming Process defines a specific approach to using pseudocode to streamline the creation of code within routines.
List 4 guidelines for using pseudocode effectively…?
- Use English-like statements that precisely describe specific operations
- Avoid syntactic elements from the target programming language.
- Write pseudocode at the level of intent.
- Write pseudocode at a low enough level that generating code from it will be nearly automatic
List 5 benefits of using pseudocode…?
- Pseudocode makes reviews easier.
- Pseudocode supports the idea of iterative refinement.
- Pseudocode makes changes easier.
- Pseudocode minimizes commenting effort.
- Pseudocode is easier to maintain than other forms of design documentation.
List the 12 steps in the pseudocode design process…?
- Check the prerequisites
- Define the problem the routine will solve.
- Name the routine
- Decide how to test the routine’
- Research functionality available in the standard libraries
- Think about error handling
- Think about efficiency
- Research the algorithms and data types’
- Write the pseudocode
- Think about the data
- Check the pseudocode
- Try a few ideas in the pseudocode, and keep the best (iterate)
See pages 220 to 225 for more information
Outline what needs to be considered in defining the problem a routine must solve.
- The information the routine will hide
- Inputs to the routine
- Outputs from the routine
- Preconditions that are guaranteed to be true before the routine is called (input values with certain ranges, streams initialized, files opened or closed, buffers filled or flushed, etc)
- Postconditions that the routine guarantees will be true before it passes control back to the caller (output values within specified ranges, streams initialized, files opened or closed, buffers filled or flushed etc.)
Discuss what is meant by the term “factored” in relation to creating a routine?
Check whether the code should be further factored: In some cases, you’ll see an explosion of code below one of the initial lines of pseudo code. In this case, you should consider taking one of two courses in action:
Factor the code below the comment into a new routine.
Discuss how pseudocode is used in creating a routine in an actual programming language…?
Once you’ve design the routine, construct it. You can perform construction steps in a nearly standard order, but feel free to vary them as you need to.
What needs to be checked when “mentally checking a routine for errors”?
The first formal formal check of a routine is mental. The cleanup and informal checking steps mentioned earlier are two kinds of mental checks. Another is executing each path mentally. Mentally executing a routine is difficult, and that difficulty is one reason to keep your routines small.