Chapter 6a

Six Step Programming Process - Introduction


 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

The Rationale

The following is a way to develop programs that has evolved over a period of almost twenty years to help students succeed with their introductory programming course. It is systematic, it is organized, and it works. That does not make it the one and only way to create programs (it isn't), but it is far superior to the hacking, guessing, and messing around process that many people seem to want to try first.

Use of this process is required for programs developed in the CS 135 course. Once you leave this course and go on to others, you may have your choice of program development strategies, although you will actually be given more stringent specifications if you go to work for a software development company. However, whatever system you choose to use hereafter should incorporate organized strategies as opposed to haphazard defaults. Enough said.

There are several reasons to use an organized program development process:

  1. It is true that most people can slap together trivial programs without working their way through a design and development process. As long as you plan to write trivial programs -- which will get you about halfway through this course (and nowhere in industry) -- hacking will work, at least to some extent. If you intend to write non-trivial programs, and possibly even get paid for it, you simply must have an organized and refined strategy for doing so

  2. The number two goal for a quality program is that it works. The number one goal is to write programs that other people can read and understand without spending very costly hours trying to figure out what it was you were trying to do. You can no more guarantee that your program is bug-free than you can guarantee that it won't rain. On the other hand, you CAN guarantee well-organized and effective program design and documentation, especially if you start with a well-organized and effective development process. Finally, you should be aware that for most products, including software, the working life of the software will be much longer than the development time, assuming your software product was of good quality. This means that in industry, much more time -- and money -- is spent on maintenance than on development

  3. There are rumors that students taking this course are actually enrolled in other courses. If this is true and you prefer to hack your way through programs, taking other courses is very foolish. However, if you plan on taking this course and others all at the same time, you had better have an organized and systematic way to design and develop your programs (and for the present introductory course, it must be this one). There is simply not enough time, with or without sleep, to try to hack programs together and remain coherent and reasonably healthy (and then there's that GPA thing . . . )

  4. The best has been saved for last: The number one problem students have with introductory programming classes is that they get psyched out by how "hard" it appears to be to write programs. Truth: It IS really hard to write readable, quality programs that work. However, just as it would be rather foolish to build a four-story building in an afternoon without any plans, it is just as silly to develop a non-trivial program under the same circumstances. One of the fundamental laws of programming is NEVER SOLVE BIG PROBLEMS. Whether you are fixing a leaky roof, or developing a massive database, no intelligent professional will try to do the whole thing at one sitting, and without advance planning. The smart ones will break the problems down into easily conquerable smaller components . . . and the others will flounder. There is no in between

The Process

The steps of the process are pretty straightforward. Steps one and two are conducted by writing English-language or pseudocode steps as comments in the main function area, as well as other areas where appropriate. When step two is completed, the developer should be able to "run" the program in her head or on paper, and it should correctly solve the problem.

There will always be subroutines, known as functions in the C++ programming language, in every program you write for this course. These are the tools that support your programming process by taking care of unique parts of the program. If you will be developing functions, they must be specified (i.e., their specifications are written) and located (i.e., the location where the functions are called is specified) in step three; if you are not developing functions, you will still need to show the location of the functions you will be using.

Once you have identified and specified the functions as needed, function prototypes and stub functions are developed and placed in the program if you are developing any of them. If you are not creating functions to be used in the program, you will not have to deal with prototypes and stubs.

In step four, the main function is implemented (i.e., the program code is written for the main function).

If you are not conducting any function development, step four is the final step. The program will run without further development, and you can assume that your steps five and six will be identical to your step four.

If you are developing any of your own functions, step five is used to design the functions that were previously specified. Step five is considered a recursive process because the developer actually reuses steps 1, 2, and 3 to design these functions in the same way he developed the main program. When step four is complete, the solution to each function should be clearly stated in pseudocode, and any functions needed by the supporting functions are specified and designed. If new functions are developed for the supporting functions, they too are designed and developed using steps 1, 2, and 3.

Finally, step six is used to implement the code in the supporting functions. At the point of implementing step six, writing the code is pretty easy since the steps and design statements have already been developed in step five.

Here is the nutshell explanation of each step:

  1. Write the major actions of the program in fewer than 8 to 10 steps

  2. Expand on the major actions with more specific details related to each of the major steps; the programming solution is completed in English form

  3. Design, specify, and locate the functions necessary to solve the problem. You will identify the use of others' functions, and you will also be developing the prototypes and stub functions required by the design(s) and specification(s) for your own functions (as needed)

  4. Using the previously developed steps, write the code for the main function; this is a complete, compilable, and runnable program. If you have decided to create your own functions, it will not work yet. However, if you are only using others' functions, step 4 will complete the program and steps 5 and 6 will be identical to step 4

  5. Using the previously developed function specifications and comments, reuse steps 1, 2, and 3 to develop the programming solutions for each individual function in pseudocode/English. This includes designing and specifying any further functions required by the functions you have previously developed; this recursive process continues until all supporting functions contain all the pseudocode steps required to solve each of their individual tasks

  6. Following the design and steps developed in step five, the code is written for the supporting functions, a process called implementing the function code

The six step process is used to develop programs in a modular way, which naturally means using functions. However, it can also be used in a way to introduce programming without functions, although that trims it down to a four step process.

When you are first writing programs and you are not developing your own functions yet, your program will be complete at step 4. This means that your steps 5 and 6 will be identical to your step 4. However, once you begin writing your own functions, you will need to move into the actions required by steps 5 and 6.

With that in mind . . . Go on to the first step of the program from here.