programming

Tango
commenting.docx

The expectation is that your source code is commented using a best practices approach rather than a comment on every single line.

Include a header comment at the top of every class file that includes your name, course #, assignment name, date of last modification, the purpose of the code (be brief but informative, don’t just say “this is for assignment #5”), and a section on “assumptions”. This assumptions section should state the expected inputs and outputs, any known bugs/issues, and generally how to operate the software.

Use inline comments only when you feel necessary (i.e. not obvious from the text). For example: int x = 5 // this sets x to 5 This is a poor comment. It does not state anything useful.

if (x < 0) // left side of screen … else if (x > 1024) // right side of screen … This is useful because it tells us you are determining the width of your monitor resolution as a bounding box Add a comment block above each function that gives the name and its intended purpose. Choose meaningful names for all variables, parameters, classes, and methods. Use complete words where practical. Use named constants if you plan to reuse certain values frequently. Avoid repetition code by writing appropriate procedures and calling them.

Follow standard formatting: Variables/method names. First letter is lower case, subsequent words are capitalized (camelCase) Ex: windowScreenLeft Class names: Start of word is capitalized along with subsequent words: (ex: ScreenController) Constants: All capitalized Braces: the open brace { goes at the end of the line before the start of the code block. The close brace } goes on its own line. Indentation: indent one level for each level of braces, conditional statements, loops

This is a good resource with more detail.

http://www.cs.cornell.edu/courses/JavaAndDS/JavaStyle.html (Links to an external site.)

 

Statement of Academic Honesty

A statement of academic honesty should be coded as comments for each of the programming assignments that you turn in. 

 

Here is what I would like to see (similar) for all programming assignments: a statement of academic honesty at the end of the code similar to this:

//The code for this programming assignment for "name of course", //"name of program", is my own original submission (unless otherwise cited) in accordance with //the Academic Honesty Policy of the Florida Institute of Technology. //Faithfully submitted by Name, on date.

Including this statement indicates that the work is yours, yours alone, and unique to your submission. Failure to include the required comments and academic honesty statement will result in a substantial deduction of points.