|
Top Down Program Development
1. Determine the desired output items that the program must produce. 2. Determine the input items. 3. Design the program as follows: a. Select an algorithm for transforming the input items into the desired outputs. b. Check the chosen algorithm by hand using specific input values. c. Determine variable names for the selected algorithm. 4. Code the algorithm into C++. 5. Test the program using selected test data.
The above was stolen shamelessly from C for Engineers and Scientists by Gary Bronson
1. The first step is to understand what the program is going to do. Make sure you understand the problem and what you want the program to do before you do it. You may find it easier to write statements down on paper such as calculate, print this, get user input, determine, find etc. 2. Decide on what information you will need from the user to solve the programming problem. This might be a bit trickier than you think. User interface design is an art, and at the very least deserves quite a bit of thought. 3. a. Think about how you will take this information from the user and then do calculations on this data. This will be the algorithm that you will use. b. Check that it will work by going through all the steps by hand. c. Select variable names that are descriptive to hold the input, output and any intermediate calculation variables that might be needed. 4. Put it into code. Step through what you have done several times in your mind before compiling. Studies have shown that you are much more likely to find logic problems at this portion of the coding process versus later during the debugging phase. Also your understanding of the problem is fresh and very clear so inconsistencies will tend to stand out. 5. Test and retest. Users will do the strangest things and if you can imagine it, eventually a user will do it to your code.
|
Copyright (c) Yusuf Family Website 2001 |