Home > Articles > Programming

Beginning Programming: Designing a Program

  • Print
  • + Share This
Just as a builder doesn't build a house before designing it, a programmer should not write a program without designing it first. Too often, programmers rush to the keyboard without thinking through the logic. A badly designed program results in lots of bugs and maintenance. In this sample chapter, Greg Perry describes how to ensure that your program design matches the design that the user wants.
This sample chapter is excerpted from Sams Teach Yourself Beginning Programming in 24 Hours, by Greg Perry.
This chapter is from the book

Programmers learn to develop patience early in their programming careers. They learn that proper design is critical to a successful program. Perhaps you have heard the term systems analysis and design. This is the name given to the practice of analyzing a problem and then designing a program from that analysis. Complete books and college courses have been written about systems analysis and design. Of course, you want to get back to hands-on programming—and you'll be doing that very soon. However, to be productive at hands-on programming, you first need to understand the importance of design. This chapter attempts to cover program design highlights, letting you see what productive computer programmers go through before writing programs.

The highlights of this hour include

  • Understanding the importance of program design

  • Mastering the three steps required to write programs

  • Using output definition

  • Comparing top-down and bottom-up designs

  • Seeing how flowcharts and pseudocode are making room for RAD

  • Preparing for the final step in the programming process

The Need for Design

When a builder begins to build a house, the builder doesn't pick up a hammer and begin on the kitchen's frame. A designer must design the new house before anything can begin. As you will soon see, a program should also be designed before it is written.

A builder must first find out what the purchaser of the house wants. Nothing can be built unless the builder has an end result in mind. Therefore, the buyers of the house must meet with an architect. They tell the architect what they want the house to look like. The architect helps the buyers decide by telling them what is possible and what isn't. During this initial stage, the price is always a factor that requires both the designers and the purchasers to reach compromise agreements.

After the architect completes the plans for the house, the builder must plan the resources needed to build the house. Only after the design of the house is finished, the permits are filed, the money is in place, the materials are purchased, and the laborers are hired can any physical building begin. As a matter of fact, the more effort the builder puts into these preliminary requirements, the faster the house can actually be built.

The problem with building a house before it is properly designed is that the eventual owners may want changes made after it is too late to change them. It is very difficult to add a bathroom in the middle of two bedrooms after the house is completed. The goal is to get the owners to agree with the builder on the final house prior to construction. When the specifications are agreed on by all the parties involved, there is little room for disagreement later. The clearer the initial plans are, the fewer problems down the road because all parties agreed on the same house plans.

TIP

The more up-front design work that you do, the faster you will finish the final program.

Sure, this is not a book on house construction, but you should always keep the similarities in mind when writing a program of any great length. You should not go to the keyboard and start typing instructions into the editor before designing the program any more than a builder should pick up a hammer before the house plans are finalized.

Thanks to computer technology, a computer program is easier to modify than a house. If you leave out a routine that a user wanted, you can add it later more easily than a builder can add a room to a finished house. Nevertheless, adding something to a program is never as easy as designing the program correctly the first time.

  • + Share This
  • 🔖 Save To Your Account