CS202 Fall 2007
The following standards apply to all complete programs written for homework assignments in this class. These do not apply to program fragments, nor to quizzes and tests.
· All programs must include a sample run.
· All programs must include comments giving information about the purpose of the program and it’s author.
· All programs that input a number should check if that number is within the bounds required by the program and handle errors gracefully (unless any number is accepted by the program).
· All functions (except main) should have prototypes.
· All classes should have interfaces defined in a header (.h) file and implementations in a separate source (.cpp) file.
· Use functions often! They are a great way to modularize a program. They make writing easier, they make debugging easier, and they can often be reused in other programs. (Reusing code from previous assignments is encouraged!)
· Comment just about everything. Reading a comment is usually easier than figuring out what a statement is supposed to do all over again. This is also a good habit to get into if, in the future, other people will be modifying your programs. (And if you are ever a professional programmer, other people will be modifying your programs. You don’t want them to hate you; see Hubris, below.)
From Programming Perl, 2nd ed., by Larry
Wall, Randal L. Schwartz, and Tom Christiansen, O’Reilly, 1996.
The quality that makes you go to great effort to reduce overall energy expenditure. It makes you write labor-saving programs that other people will find useful, and document what you wrote so you don’t have to answer so many questions about it. Hence, the first great virtue of a programmer. ...
The anger you feel when the computer is being lazy. This makes you write programs that don’t just react to your needs, but actually anticipate them. Or at least that pretend to. Hence, the second great virtue of a programmer.
Excessive pride, the sort of thing Zeus zaps you for. Also the quality that makes you write (and maintain) programs that other people won’t want to say bad things about. Hence, the third great virtue of a programmer.