Advertisement
Guest User

Coding Conventions

a guest
May 29th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ada 1.63 KB | None | 0 0
  1. CODING CONVENTIONS
  2.  
  3.     INDENTATION:
  4.     -- Tabs should be used for all indentation.
  5.    
  6.     BRACES:
  7.     -- Braces should appear at the end of the statement definition and on a new line after the function.
  8.     -- i.e. public void     someFunc() {
  9.     --                      doSomething();
  10.     --                  }
  11.    
  12.     WHITESPACE:
  13.     -- No excess whitespace around parentheses.  Example - use "while(x == y)" rather than "while (x == y)"
  14.     -- No excess whitespace inside parentheses.  Example - use "while(x == y)" rather than "while( x == y )"
  15.     -- Use spaces around operators (except for i++ and i--)  Example - use "a > 1" rather than "a>1".
  16.     -- Use spaces after inline punctuation.  Example 1 - use "a, b, c, d, e" rather than "a,b,c,d,e".
  17.    
  18.     COMMENTS:
  19.     -- All comments should be meaningful in some way.
  20.     -- Comments should appear above the line they are about.
  21.     -- Comments should have a space after the //.
  22.     -- New sections of code should be made clear with the following format
  23.     --  ///////////////
  24.     --  //SECTION TITLE
  25.     --  ///////////////
  26.        
  27.     VARIABLE NAMES:
  28.     -- Inside of functions, variable names do not have to follow conventions but must be somewhat meaningful (excluding counter variables), and must be consistent within the function.
  29.     -- Global variables should be prefixed with "g_" and then a letter indicating what datatype it is:
  30.         -- "m" for Menu
  31.         -- "h" for Handle
  32.         -- "b" for Bool
  33.         -- "i" for Int
  34.         -- "f" for Float
  35.         -- "s" for String
  36.     -- On global variables, the next letter, immediatly following the indicator, should be capitalized.  Example - g_bMyBool or g_hMyHandle.
  37.     -- Function names should start lowercase and use capital letters to signify new words.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement