This guide is intended to help make clearer the format that is expected for submitted homework assignments. By following these guidelines, you help us streamline the assignment review process resulting in the following wonderful benefits:
Bear in mind that if you choose not to follow these guidelines, you're trusting your grade to the benevolence of the markers and their willingness to sort through any idiosyncrasies. Code Comments Uncommented code will receive a grade of zero as comments serve several important purposes:
Writing good comments is an art and there is certainly no single correct style. However, for this class please try to adhere to the following:
Here's an example of decent commenting from some of George's c++ code: /** \class GaussianClassifier \brief Single Gaussian multidimensional classifier Simple multidimensional Gaussian classifier. The classifier parameters (or model) are stored in the theta control. When the mode control is set to "train" the input slice is used to accumulate information for training. The final theta calculation is completed when the control train is set to true. It can accommodate non-incremental or batch training. The "labels" control is used to provide ground truth about the label(s). The output of the classifier is the ground truth label(s) when the mode control is train. When the mode control is set to "predict" then the output of the classifier is the predicted labels using the trained parameter vector theta. This MarSystems serves as a prototypical classification/regression MarSystem. */ Here's another more humble example from my own (java) code: /** * A more or less simple multimedia player developed with Java Media Framework. * Functionality includes loading images from the local file system or on the web * via http (or other services if available), looping, limiting play to a user * defined clip and fixing the aspect ratio. The class could be used in another * application, for instance, an alternative UI. However, a developer would have * to be careful to instantiate the static variables fd, wd, and playerPanel. This * is certainly a design problem of this current implementation in * need of fixing. * * This was developed with JMF 2.1.1 port to linux. A number of codecs appeared to * to be missing, such as most, if not all, audio... or partially broken. MPEG played * with very marginal quality. Quicktime played but without audio. * * Aaron Hechmer, Multimedia Systems-- CSc 561, 27 January 2004 */ Here are two more examples from my own code. Yes, they were probably written late at night when I was low on sleep and blood-sugar. So, their main purpose is to help me understand in the morning the horrors of my thought process the night before: for (int i=1; i<(coords.length-1);){ int when = getTick(i, coords.length); // did Y change? int y1 = coords[i][1] - coords[i-1][1]; int y2 = coords[i+1][1] - coords[i][1]; // there's a bug here as zero values will default to a "going down" hit... should deal by // perhaps adding a third option or a lookahead that keeps going until it gets a +/- value if (isNegative(i, 1)){ Color color = (Color)timbre.get(new Integer(i)); int timbre; if (up){ // going up! //System.out.println("Y up when " + when); timbre = 1; } else { // going down! //System.out.println("Y down when " + when); timbre = 2; } newMessage(NOTEON, 9, noises.getInstrument(color, timbre), when); newMessage(NOTEOFF, 9, noises.getInstrument(color, timbre), when+1); } if (y1*y2 == 0){i+=2;} // so we don't get two zero readings in a row else {i+=1;} // may have incremented by two already }README File and Test Cases Please include a README file with your assignments. The README can contain useful notes such as compiling issues, environment issues and MOST IMPORTANTLY... how you intend for your program to be used, ie user instructions. Similarly, it's very helpful if you include your test cases. Should our test cases fail, we can give you a zero for the problem. Or we might also try running some of your test cases and attempt to find a simple explanation for the failures. Test cases can be provided in a separate file or even in the body of the source code. In the latter format, it's usually best to comment the test cases out (when working in SML or Scheme). What Else to Hand In In addition to the README file, be sure to include all your commented source files as well as compiled binaries where appropriate (such as with the c++ assignment). For some assignments you will be given some skeletal code or source
libraries to help your project along. You MUST hand in all of these
files as a single functional set. In other words, assume that we
don't have any of the background files! If you will be submitting more than one file for an assignment, please
place the files in an archive. The archiving utility of choice for this class is tar. Although
mostly associated with unix, there are versions of tar that run on MS
Windows and, of course, OSX. If you are unfamiliar with the use of
tar, please consult its manual pages or look for help online.
Briefly, to archive a set of files with tar, do something like the following:
bash% tar -cvf MyArchiveFile.tar asn1/* README This will add all of the files in asn1 to the archive MyArchiveFile.tar along with their pathname "asn1" and the file README. It's probably not necessary for you to compress these archives. However, if you choose to do so, we will be using gzip or bzip2. You may compress your archive with the following command: bash% gzip MyArchiveFile.tar To unzip and extract your files, the syntax is similar. Here we show the procedure in two steps, but it's usually possible to write in a single step (look it up for more details): bash% gunzip MyArchiveFile.tar.gz bash% tar -xvf MyArchiveFile.tarFilename Extensions Here are some standard and widely used file name extensions for many of the file types we'll be using this term. Please adhere to them:
Platforms You may work on any platform you wish. However, your code should compile and run on the Solaris machines in room B215 of the Engineering Lab Wing. If you develop on windows, it's likely that each line ends with a carriage return. Carriage returns sometimes cause trouble when the file is run on a platform that does not use carriage returns. To remove carriage returns run your file through the utility dos2unix, which is available on the Solaris machines, most unix/linux workstations and even on MS Windows if you've installed it. Before You Hand In.... Before you hand in your work, please check that the final copies work. This is particularly important when working with languages like SML or Scheme. Often one may develop functions piecemeal, cutting and pasting into a text file as they go. However, the interpreter environment may differ from the environment recreated by your source file. It's highly recommended that you close and restart your interpreter, load your source file and make one last check that everything works. Remember, the way we will test your file is to compile the entire source file at once. Compilation errors at review time are extremely annoying. If you have code that you simply cannot get to compile, it's best to comment it out and then add a note explaining where you were at with your thinking as well as your best guess for why it doesn't work. Thanks for your help and good luck! Aaron |