CISC4080: Programming Assignment Grading?
If your code does not compile, the most points you can earn is 40 pts out of 100.
- If the compilation errors are minor and easy fix, your grade is 40 pts.
- Otherwise, your grade is between 0 and 40 pts depending on the how much code is correct, and how many required functionalities were implemented.
70% points are for the correct implementation of required functionalities.
- 50pts: No compilation or linker errors, and implemented all required functionalities.
- 10pts: Include appropriate amount of error checking and testing
- 10pts: Reasonably efficient: pay attention to code efficiency in both running time and memory requirement
15% points for documentation:
- 3pts: Any comments at all
- 3pts: Document all functions (with one line description,
parameters, return value, pre/post condition)
- 3pts: Document variable declarations
- 3pts: Document major sections of code or main idea of algorithms
- 3 pts: All comments are useful: (For instance, no comments that simply echo the code.)
15% points for good coding style/practice:
- 5pts: Clear logic (no overly-complex logic)
- 3pts: No repeated code
- 2pts: Meaningful variable names,
- 5 pts: indentations (i.e., start each statement with an appropriate number of spaces depending on its indentation level) to make the structure of your code clear. Use blank lines to separate blocks of code. Use 3 spaces for each indentation level.
The following are the indentation rule.
- indent statements within a block statement by one more level, including every statements with the body of a function.
- write the braces of the block statement in separate lines, and align them with the if, else, or that precedes it, (i.e., this is the so-called Allman style).
- indent the body of if statement and if/else statement by one more level
In the following program, each statement's indentation level is marked in the comment:
#include <iostream>
using namespace std;
int main() //indentation level 0
{ // take a line, and align with the function header and matching }
int a, b; //level 1
// enter value of a and b
cout <<"Enter a and b:"; //level 1
cin >> a >> b; //level 1
// calculate the GCD (greatest common division of a and b
while( 1 ) //level 1
{ //opening brace take a line, align with while and the matching }
a = a % b; //indentation level 2
if ( a == 0 ) //level 2
return b; //level 3
b = b % a; //level 2
if ( b == 0 ) //level 2
return a; //level 3
} // align with matching }
} // align with matching {
The editor emacs can help you apply indentation rule. To enable this, and to set the indentation level to 3, you can run the following command at the terminal, which copy my configuation file to your home directory.
cp ~zhang/.emacs ~
Note: evertime emacs starts, it will read the .emacs file under your home directory for configration information. For the automatic indentation rules to apply, you need to name your file with an appropriate suffix (.cc, or .cpp).