How to maximize your program grade in CSC270H, Summer 2001

Your program will be graded on two factors, correctness and programming style.

Program correctness

Your program will be automatically compiled and run against test data sets. There are several important points. To get a passing grade, your program must at least meet the first two requirements: it must compile and run without crashing.

What if I can't get my program to work?

Sometimes it happens that your program will have a bug which either prevents it from compiling or causes it to crash, and you can not figure out how to fix the problem.

Hopefully you can isolate the area of the code which has the bug. Now you are left with a dilemna. If you include this code in your submission, your program will not work at all, but if you omit this code, you will not get any partial credit for the hard work you put in.

The solution is to bracket the problem code with:

#ifdef DOES_NOT_WORK 
#endif /* DOES_NOT_WORK */ 
These compiler directives will block the code which appears between the #ifdef and the #endif from being compiled or being run. (Note: you must NOT have a #define DOES_NOT_WORK anywhere in your code!)

It is important that you bracket the problem code carefully. The rest of your program must work without this bracketed code. The goal is to have the program output as close as possible to the correct answer.

For example, suppose the problem asks you to sort your output, but your sorting function is crashing. The solution is to bracket your sort function definition and function call with #ifdef DOES_NOT_WORK and #endif. The result will be a program that produces correct output but does not sort so you will get close to full marks on correctness. Also, you will receive credit for your sorting routine when we examine the printout.

How do I test my code?

Good testing of code is a learned skill. Generally, you need to look at your code and think of what types of data may cause it to fail and then test your program on that data. Generally, there are four types on inputs you must test.

Program style

The programming style of your code will count significantly to your grade. Simply getting your program to run correctly is not enough. Your code must also be simple, easy to read, and easy to understand. A short elegant solution will receive a higher grade than a long, convoluted solution. Please follow the style guidelines. Some key points are as follows.

Click here to go back to the menu, if your browser does not support frames.