How to Plan Out Routines for a Structured Computer Program

Google+ Pinterest LinkedIn Tumblr +

planning.jpg By Troyster,

The spine (or back bone) of most structured (also called modular) programs usually contain 4 basic routines. Some form of initialization followed by input, process and output. Starting from this point and carefully expanding from there in the form of simple subroutines can greatly reduce bugs and coding complexity.

Difficulty: Moderate


Things You’ll Need:



Step 1 The first step is to create the Initialization Routine. This routine is used to define variable names, as well as predefine variable values and types that will be used later in the program. This routine establishes the basic ground work that will be needed throughout your program. All initial values and layouts are set here to be used later in your program.

Step 2 The next step is to create the Input (or Read) Routine. This routine is used to pull in raw data from an outside source. This source can be tape, diskette, hard drive, flash, punch card or even keyboard entry. You can read data for either a preset number of records, until a certain condition is met, or until an end of file marker is reached. There is usually a variable that will change when data reading is complete. This variable is called a flag. In the Input Routine you may collect raw data from multiple sources to be used later in the program.

Step 3 The Process Routine is what is considered to be the heart of your program. This is where you take the raw data that was read and process it in a way that can be used later for future output or other use. The process can be arithmetic where scores are added from a record and then averaged, it can be used to compare or can even organize data in a desired fashion or order. Step 4 The final step is your Output Routine. This takes the results given to it by the Process Routine and sends it to some kind of output device. This output device can be tape, diskette, hard drive, flash, punch card, printer or display screen.

Tips & Warnings


As long as your program starts off with this basic structure, it will be easier to read, troubleshoot and upgrade.

Keep things simple stupid. If a subroutine gets too complex, break it up.

Plan, flowchart and desk check your program ahead of time.

Write out plenty of documentation.

Use logical aids such as Venn diagrams or Boolean equations.


Always make sure your routines have only one entry and exit point.

Avoid goto statements.

Avoid any other bad habits that can turn your program into spaghetti code.


About Author

Leave A Reply