6.16. Other Requirements

Your program must compile without errors [Compile error: 100 points]

A program that does not compile without errors automatically receives a grade of 0.

Your program should compile without warnings [Warnings: 1-7 points]

Avoid compiler warnings. They usually tell you about an important issue with your program. Since I will compile with warnings turned on, you should also turn them on. That you chose not to request warnings is not an excuse for ignoring them.

The main function should return a result. [Main return: 1 point]

Main returns 0 if all went well and nonzero if there was an error.

Keep simple things simple.

Avoid unnecessary complication in algorithms. Do not use an algorithm that is long and difficult to understand where there is a much simpler algorithm.

Do not use unnecessarily complicated coding. For example, suppose that you need an integer variable numSlots, initially 0. A sensible way to do that is as follows.

  int numSlots = 0;
An unnecessarily complicated way is as follows.
  int* numSlots = new int;
  *numSlots = 0;


Do not include prototypes for functions that are not exported in header files. [Advertise private: 1 point]

If a module has a well-defined interface, do not unnecessarily add information to its header file that is not part of the interface.

Avoid code duplication. [Dup code: 1-5 points]

Do not unnecessarily duplicate sequences of code that are more than two lines long. Use a function.

Do not write a statement in both branches of an if-statement where it would be more sensible to write it either before or after the if-statement.


Do not use instance methods or static methods. [Instance method: 1-6 points]

Do not use classes or create instance methods or static methods within a structure definition. Constructors in structure definitions are allowed.

This course is concerned mainly with physical data structures, although it also covers an introduction to abstract data types. Object-oriented programming is covered in CSCI 3310. Since we cannot take the time in this course to discuss object-oriented programming, and students who have attempted to use it have almost always used it incorrectly, do not try to use object-oriented programming.