• Describe good styles for presenting programs and the reasons for them.
Your program should be readable, because if it is not readable, the chances of its
being correct are slim. Moreover, if it is unreadable, it will be difficult and time
consuming to test and debug it —to find and correct the errors in it. Take the time,
right from the start, to follow disciplined, careful, programming practices; it will
pay off in the long run. Every time you read your program, because you are mod-
ifying it or debugging it, you will take less time if the program is readable. So,
The major reason for using a disciplined style of programming is
to save you time when dealing with your programs. The best way
to reduce the burden of debugging is not to put errors in the pro-
gram in the first place. Following disciplined programming prac-
tices can help immeasurably in this regard.
Your program should be readable by others as well, not just you. For exam-
ple, consider a program that you have to write for a programming course. The less
time a grader has to spend on your program, the more positive they will feel
toward you and the better your grade will be.
In the professional world, making programs that are readable by others is
even more important. Most programs live a long time and require “maintenance”
—changes to adapt them to new and different requirements, upgrades in other
software, new hardware, and so forth. Quite likely, the author of the program will
not be around when maintenance is required, so someone else must read and
understand the program enough to update it successfully.
Some of the programming habits discussed in this chapter concern syntacti-
cal measures, like indenting program parts properly and using certain conven-