Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
courses:cs331-201701:final [2018/12/14 14:44]
sellis [Coding Standards and Conventions]
courses:cs331-201701:final [2019/04/30 14:48] (current)
sellis [Coding Standards and Conventions]
Line 1: Line 1:
-====== CMPU-331 Compilers (Fall 2018) ======+====== CMPU-331 Compilers (Spring 2019) ======
  
 ~~NOTOC~~ ~~NOTOC~~
Line 26: Line 26:
   * Your project must adhere to a good object-oriented model. Classes must be designed to be functional program units, with correct responsibilities and control. Connections between classes should be clear and logical.   * Your project must adhere to a good object-oriented model. Classes must be designed to be functional program units, with correct responsibilities and control. Connections between classes should be clear and logical.
  
-  * Member variables and functions must be declared ''​private'',​ except for only those functions which must be called from outside that function.+  * Member variables and functions must be declared ''​private'',​ except for only those functions which are called from outside that function.
  
   * Only functions which must be declared ''​static''​ may be declared ''​static''​. (e.g. the ''​main()''​ function in Java.)   * Only functions which must be declared ''​static''​ may be declared ''​static''​. (e.g. the ''​main()''​ function in Java.)
Line 43: Line 43:
  
   * Conditional or iteration statements whose statements are only one line long do not require curly braces; e.g.:   * Conditional or iteration statements whose statements are only one line long do not require curly braces; e.g.:
 +  * 
 <​code>​for (x = 0; x < 20; ++x) <​code>​for (x = 0; x < 20; ++x)
       (for (y = 0; y < 20; ++y)       (for (y = 0; y < 20; ++y)
Line 72: Line 73:
     I'm glad I wrote myself a comment!     I'm glad I wrote myself a comment!
 </​code>​ </​code>​
 +
 +== Errors and Warnings ==
 +
 +  * Your code must compile and run without error.
 +
 +  * Your code should be as free of warnings as possible.
  
 === Python === === Python ===
Line 90: Line 97:
  
   * All local identifiers (including formal parameter names) must be in lower case only.   * All local identifiers (including formal parameter names) must be in lower case only.
 +
 +  * Python enforces consistent indentation as part of its language grammar. Indents should be 4 spaces or 1 tab.
  
   * Reserved words which require parentheses (e.g. ''​if (...)''​) must have a space between the reserved word and the parenthesis. Other functions (e.g. ''​GetNextToken()''​) must not have this space.   * Reserved words which require parentheses (e.g. ''​if (...)''​) must have a space between the reserved word and the parenthesis. Other functions (e.g. ''​GetNextToken()''​) must not have this space.