O'Reilly logo

Practical C++ Programming, 2nd Edition by Steve Oualline

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter 26. Program Design

If carpenters made houses the way programmers design programs, the first woodpecker to come along would destroy all of civilization.

Traditional computer proverb

Now that you've got the mechanics of programming down, we'll take a look at how to design good code. Creating a well-designed program is both a science and an art form. There is lot of science involved in the techniques and rules used to produce a good design. Your artistic side comes in to play when you use these rules to lay out a well-designed and beautiful program.

Design Goals

Before we decide how to make a well-designed program, we need to define what we mean bywell designed. Different people value different things. But in most cases, people tend to value the same attributes. So let's explore what people value in a program:

Reliability

People want a program that works. Crashes are extremely frustrating. They cost people time, cause data loss, and in extreme cases can cost people's lives. So reliability is extremely important.

Economy

Most people, especially managers, don't like to spend money. They want the cheapest software possible.

Ease of use

No program is useful if people can't use it. This may sound a bit obvious, but lots of programmers suffer from the "added feature disease" where they want to cram as many features as possible into their code. The result is something overly complex and difficult to use: in other words, a badly designed program.

Design Factors

Now that we know what we want ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required