Notes on Grading of Programming Assignments


How programs are graded

A program that does not compile or does not link correctly with itself receives a score of 0, no matter how small the error is that leads to that behavior. You are expected to test your work. If it does not compile or link, it is clear that you have never tested what you submitted.

A program that is extremely poorly indented will receive a failing grade, regardless of how well it works. I do not just run your program. I also read it. If it is very poorly indented, it is too difficult to read.

Assuming that a program compiles, links and is sufficiently well-indented, it will start with 100 points and lose points for things that it either does not implement at all or that are done incorrectly. The number of points that you lose will depend on the severity of the error and on how often it is repeated.

Each programming assignment is subject to the coding standards for this course. Be sure that you are aware of them. Scores will suffer for programs that fail to meet the standards.

You will receive feedback that uses the abbreviations shown below. Click on the abbreviation in the grade page. It will take you to this file. Click again to see a detailed description.

After the abbreviation is the name of the function that contains the error or issue, and (usually) the number of points lost, in parentheses.

After the abbreviation is the name of the function that contains the error or issue, and (usually) the number of points lost, in parentheses.

In some cases, you will lose fewer points than the total of all of the individual parts, to account for the overall quality of the submission. But do not count on that.


Grading abbreviations

Those that can lead to at least 5 lost points are shown in red.


Compilation and linkage

COMPILE-ERROR [100 pts]

There are compile errors.

WARNINGS [1-3 pts]

There are compile warnings. The standards require that there be none.

Following the assignment

ALGORITHM [1-20 pts]

An algorithm is incorrect.

DESIGN [1-100 pts]

The program does not follow the required design. The design is not optional or suggested.

EOL-AT-END-OF-OUTPUT [1 pt]

The last character written should be an end-of-line character.

FUNCTIONAL-REQUIREMENTS [1-100 pts]

The program does not do what it is supposed to do.

INPUT-SOURCE [1-3 pts]

The program does not read input from the correct source.

OUPUT-DESTINATION [1-3 pts]

The program does not write to the correct place.

Layout

EXTRA-EMPTY-SPACE [1 pt]

There are too many blank lines.

IF-MULTIPLE-CASES [1 pt]

Layout of if's with multiple cases is not correct. Use format
  if(condition-1)
  {
  }
  else if(condition-2)
  {
  }
  …

INDENT [1-10 pts]

Indentation is not correct.

INDENT-EXTREME [50 pts]

Indentation is extremely bad.

INDENT-SEQUENCE [1-10 pts]

Two statements that are done one after the other should be indented the same amoung.

LONG-LINE [1-2 pts]

Avoid lines longer than 80 characters.

PACKAGE-LINE [1 pt]

Do not put a package line in your file. If you do, I have to remove it.

STATEMENT-COMPONENT [1-3 pts]

A component of an if-, while-, do- or for-statement (or other construct with statements inside it) is required to be a compound statement, { … }

TABS [1 pt]

The program uses tabs but does not say how far apart the tab stops are.

TEMPLATE [1 pt]

You have not used the standard template for assignments. Use it.

USE-BLANK-LINES [1-2 pts]

Put a blank line between one function and the contract for the next function. Put a blank line between a function's contract and its heading.

Variables and parameters

CHANGE-PARAM [1-5 pts]

A function changes the value of a parameter. Use a local variable instead.

DOUBLE-CHANGE [1-2 pts]

A simple statement changes the value of a variable more than once. The standards (and C++) forbid that.

INVISIBLE-CHANGE [1 pt]

A function changes the value of a variable, but the new value is never used.

RETURN-VARIABLE [1 pt]

A function says return variable = value;.

STATIC-VARIABLE [2-20 pts]

The standards forbid static variables, unless explicitly allowed by the assignment.

INSTANCE-VARIABLE [2-20 pts]

The standards forbid using an instance variable as a substitute for a parameter or local variable.

Names of classes, methods and variables

CONFUSING-NAME [1 pt]

Do not use 'o', 'O' or 'l' for a variable name.

METHOD-NAME [1-4 pts]

A method name is misleading or confusing. Choose a better name.

CLASS-NAME [1-4 pts]

A class name is misleading or confusing. Choose a better name.

VARIABLE-NAME [1-4 pts]

A variable name is misleading or confusing. Choose a better name.

Contracts and comments

MARGIN-COMMENTS [1-3 pts]

Avoid putting comments in the margins.

TOP-COMMENT [1-2 pts]

There is no comment near the top of the program telling what the function does when you run it. (That comment serves as a contract for main.)

CONTRACT [1-12 pts]

A contract is not clear and precise.

CONTRACT-CONTEXTUAL

A contract describes how the function is used elsewhere instead of what the function does. Describe what this function accomplishes in terms of its parameters.

CONTRACT-ENGLISH

A contract does not use correct English, spelling or punctuation.

CONTRACT-HOW

A contract tells how a function works, or tries to explain the function body. Tell what the function accomplishes.

CONTRACT-INCORRECT

A contract is incorrect; what it says is false.

CONTRACT-IRRELEVANT

A contract contains irrelevant information.

CONTRACT-PARAMETER-NAMES

A contract does not refer to parameters by their names. Do not refer to a parameter as the number or it.

CONTRACT-PARAMETERS

A contract does not say how the function's parameters affect what the function accomplishes. Explain how every parameter affects what the function accomplishes.

CONTRACT-REQUIREMENTS

A contract does not mention important requirements on its parameters.

CONTRACT-RETURN

A contract does not tell the significance of the returned value.

CONTRACT-SIDE-EFFECTS

A contract does not document side-effects that the function has. (For example, the function might print something, but the contract does not mention that.)

CONTRACT-VAGUE

A contract is vague or confusing.

CONTRACT-VERBOSE

A contract is much too wordy.

NO-CONTRACT

A function has no contract.

Methods

COMPOUND-JOB [1-2 pts]

A method tries to do more than one basic job. It tries to do too much. Break it up into simpler jobs.

CRIPPLED [1-4 pts]

A function does not do its entire job, or has bugs in it that other functions work around. For example, it relies on its caller either for initialization or for completing the job in ways that the function should do for itself. Don't work around an incorrect function. Fix the function.

EXTRA-PARAM [1-3 pts]

There is an extra parameter that should not be there.

TIE-TOGETHER [1-2 pts]

Do not embed code in a function that more sensibly should be written in a different function, and that function used where the code was embedded.

TRUST [1-3 pts]

One function calls another, but tries to work around a perceived bug in the function that is not really a bug at all. Let the function do its job.

Conditionals: If, switch, etc.

BRANCH-SEPARATION [1 pt]

Code that is only performed when a function takes a particular branch of an if-statement should be written inside that branch, not after the if-statement.

CONSTANT-CONDITION [1-2 pts]

An if-statement has a condition that is either always true or always false. Look more carefully at your program.

EMPTY-THEN [1-2 pts]

An if-statement does nothing when its condition is true. Rewrite the if-statement so that it does nothing when the condition is false, and omit the else part.

REDUNDANT-TEST [1-2 pts]

You are testing a condition again whose value is known. Don't test it.

SWITCH-FALLTHROUGH [1-3 pts]

You have not done a break or return at the end of a part of a switch statement.

Loops

FOR-BODY-CHANGE [1-3 pts]

The body of a for-loop changes the value of a variable that is controlled in for-loop heading.

FOR-BODY-END [1-3 pts]

Do not change the value at which a for-loop ends as a way to force the loop to exit. Use a break-statement for an early exit.

LOOP-END [1 pt]

Code that is performed only in the last iteration of a loop should be moved to after the loop.

LOOP-WITH-RECURSION [1-4 pts]

You have used both a loop and recursion where you should use either a loop or recursion.

MULTIPLE-LOOPS [2-8 pts]

A method contains more than one loop. The standards require at most one loop per method.

NESTED-LOOP-SIMULATION [2-8 pts]

You have use one loop to simulate two or more nested loops by awkward says of altering variables. Use two loops by writing another function that performs the inner loop.

Statements and expressions

BARE-SEMICOLON [1 pt]

You have used a bare semicolon as a do-nothing statement. The coding standards forbid that.

INACCESSIBLE [1-2 pts]

There is code that cannot be reached. A function cannot do anything after it returns. Think again about what you want your function to do.

COMPLICATED-EXPRESSION [1-3 pts]

An expression is too long and complicated. Simplify it by computing parts and storing their values into variables.

LINE-PACK [1 pt]

Do not pack more than one statement per line.

NO-EFFECT [1-3 pts]

A statement does nothing, but is not just {}.

Files

FILE-OPEN [1-5 pts]

After opening a file, check to see whether it was opened successfully.

FILE-CLOSE [1-4 pts]

If you open a file, be sure to close it.

General coding issues

DUP-CODE [1-5 pts]

Some code has been unnecessarily duplicated. This can be because the two branches of an if-statement contain identical code or because code should be put into a function.

SPECIAL-CASE [2 pt]

Do not include unnecessary special cases in algorithms.

Efficiency

DUP-CALL [2-6 pts]

You do duplicate calls to a function where it is easy (or critical for efficiency) to avoid that. Put the result into a variable.

SCAN-FOR-SEARCH [1-3 pts]

You have used a scan algorithm for a problem that is better solved by a search algorithm.

Other

AWKWARD

Code is awkward, difficult to understand.

OTHER

This is used for miscellaneous items.