NWEN 241 Programming Style Guide

For your NWEN 241 assignment submissions, you should adhere to basic coding style guidelines:
  • Have a descriptive documentation comment on every method
  • Use indentation to show blocks of code clearly.
  • Use meaningful variable and method names.
    Code becomes self-documenting when you use names like "elementCount" instead of "c". Note the use of "Camel case" for the compound name "elementCount". Use camelCase or underscores (for UPPERCASE_CONSTANTS) to make compound names more readable. Also see the C Code Conventions.
  • Use meaningful comments in strategic places.
    Do not comment on every line! For example, there is usually no need to explain the meaning of "count++;" but ensure that main design/implementation decisions are communicated to the reader of your code by concise descriptions.
  • Consistent use of { } and ( ) in the code. For instance, the below examples are both acceptable ways of using { }, but not in the same piece of code. Be consistent with how you use brackets.

if(bar)
{

   //do something

}

The Style Guide for C contains useful tips on good coding style. Note that the above principles must be followed to avoid mark deduction.