Table of Contents
Assigned readings: This material is not in the textbook.
Your primary goal in all programming endeavors should be to write code that is reusable without modification.
The purpose of coding standards is to make the code easy to read and understand, by other programmers, and by yourself after being away from it for a time.
Software specifications and evaluation criteria are generally categorized as function or non-functional. Functional criteria have to do with what the program is supposed to do (its function). The main question regarding functionality is whether it produces correct output given correct input. Non-functional criteria have to do with other qualities that are not apparent from the program's functionality. Is the code well documented? How efficient it is? There are hundreds of non-functional measures for software. A few of the most important ones are covered here.
The keys to readability are:
Poor code quality can lead to a multiplicative increase in development cost as programmers waste time trying to decipher and debug it. As the project grows, so does the difficulty in dealing with poor quality code. Execution speed is also important, but don't sacrifice readability and intuitiveness for a marginal increase in speed.
Some of the standards in this document are universal truth, and others are arbitrary convention. You will encounter both kinds of standards in the programming profession (as well as some contradictions to universal truth). Each workplace has its own set of standards, which may conflict with each other and with this document. No two programmers will ever agree 100% on how code should be written and documented. It is more important that members of a team follow the same conventions, even though they may not agree with all of them, so that they can work effectively together. Accordingly, you will be graded on adherence to the standards described here, whether or not you completely agree with them. This will be good practice for your future career.
This document is a trivial example to introduce the concept of coding standards. When working for large organizations such as NASA, the FDA, or the military, coding standards may be hundreds of pages long. They will dictate how to format and document code, how to test code, how to document tests, how to secure code and test data, and much more.
Adherence to these standards could make the difference between an A and a B in the course. However, if your grade in this class is your only reason for writing good code, you should seriously reconsider studying computer science. The point of coding standards is to make you a more productive programmer. They will help you get programs done faster and lead to more efficient and reliable code. This will help you and others who work with your code in the future. This should be your primary motivation for following any standards.
Code quality is about half the grade for programming assignments and is based on the factors described below.