CSE 283 Introduction to Object Oriented Design
Barbara Nostrand, Ph.D.
CIS 351 Programming Standards
Java File Headers
Each programming assignment must begin with header comments. Header comments are comments that appear at the beginning of the source code, before anything else.
The header comments include the following information:
// File name // Your name // Date written // Program name // Assignment number // A description of the problem being solved // A description of the overall structure of the program
Each import statement should import exactly one library and should be followed on the same line by a comment listing the classes needed from that library.
Unlike import statements in Java, the include mechanism in C++ opens a separate file and reads its entire contents before continuing reading the current file. Consequently, there are two common uses for the include mechanism in C++. The first is using a header file to replicate the import statement in Java. The names of header files should always end with the .h filename extension.
A second use for include files is to insert library source code into the source code for a new program. This hellps facilitate code sharing. However, since C++ programs are linked after compilation, this feature is largely duplicated by separately compiling C++ files and then linking them together.
All local includes (enclosed in quotes) must follow system includes (enclosed
#include <cassert> #include <string> #include "metric.h"
The program file must begin with comments, then #include statements, then function prototypes. Each function used must have a function prototype.
Comments MUST be used liberally throughout the program. Comments must describe each section of code and, where appropriate, a single line of code. Each function must have comments describing its purpose.
All variables (with the possible exception of loop indexes) should be declared at the beginning of the method or block in which it is defined. For each object defined, a comment must be included describing what is stored in the variable and how it is used.
Run-Time Program Identification
The output of the program must begin with a description of the program (can be the same things said in the header comments). You must also print your name. For text-based programs, this should be several lines of text preceding the first prompt. For GUI programs, this should be a seperate Frame displayed briefly before the program begins interacting with the user.
Communicating with the User
When accepting input from the keyboard, you must prompt the user before each value desired. This is true regardless of whether you produce a GUI interface or a text-based interface.
When printing output, everything must be labelled. No numbers or words should be in the output without a label either before or after them.
You must echo the input in the output. Thus, if you read in the number of feet (27.6), you must output something like
27.6 feet = 8.41248 meters.
If you are given a sample dialog, you must match your output exactly to that sample dialog (to include blanks lines and spacing). You must match the sample dialog in the instructions for the assignment.
Last modified: 2007 SEP 09 firstname.lastname@example.org