Introductory Programming Tutorial Project 1: Program Development Techniques
The
recommended method for developing programs is to use the techniques called
top-down design and stepwise refinement. Top-down design in
the simplest sense
refers to starting with a very broad, general solution such as simply having a
program that will load and run without errors. For example, I recommend that you
start your coding of every project with the following minimal working code:
#include <iostream>
int main()
{
return 0;
}
Enter this minimal code then compile, build and execute with NO errors or warnings before continuing to develop your project. This initial program has no output, but when it runs, you know you have a working, error-free program from the very beginning. It is considered to be best practice to create a written program design using some form of pseudocode format. The pseudocode design can also be developed using top-down design and stepwise refinement.
Stepwise refinement refers to building
functionality into a program in steps (incrementally). After each small step is
added you should build and execute the program in order to
catch and fix errors as soon as they are introduced. If you have errors you
need to fix them and build and execute again before continuing
development. If you do not use these techniques you will most
likely experience many frustrating and wasted hours sitting at the
computer trying to write programs.
As an example, if the program requirements specify that the program will prompt
the user to enter two integer numbers, then add the two numbers together, and
then display the results, you might build the program incrementally using these
steps:
|
1. |
4. |
|
2. |
5. |
|
3. |
6.
int main() |