Changes between Version 2 and Version 3 of CodingStandards


Ignore:
Timestamp:
Dec 31, 1969, 4:20:58 PM (54 years ago)
Author:
shauser
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CodingStandards

    v2 v3  
    11= OpenSHA Coding Standards =
    2 Good code is not only well-written, efficient, and well-documented, but also is written with a uniform formatting standard. Below I outline some suggested coding standards we all try to stick with in order to provide a uniform and clean look and feel to our source code files. Please feel free to update this if you feel strongly about a certain topic, these rules are meant to serve as a starting point only.
     2Anyone working on OpenSHA should strive to write efficient, well-documented, and testable code. To facilitate a uniform appearenceGood code is not only well-written, efficient, and well-documented, but also is written with a uniform formatting standard. Below I outline some suggested coding standards we all try to stick with in order to provide a uniform and clean look and feel to our source code files. Please feel free to update this if you feel strongly about a certain topic, these rules are meant to serve as a starting point only.
    33
    44Many of the configurations recommended below can be set within your IDE of choice.
     
    1010'''Line Length''' : A single line of code shall not exceed the 80 character printable page width. This rule helps when printing the page, or when viewing the code on a fixed-width terminal.
    1111
    12    '''Line Wrapping''' : When a single line of code must extend beyond the above 80 character max, the next line should be indented by two (2) tabs (with "tabs" as outlined above).
     12'''Line Wrapping''' : When a single line of code must extend beyond the above 80 character max, the next line should be indented by two (2) tabs (with "tabs" as outlined above).
    1313
    1414'''Code Blocks''' : Code contained within a containing block shall always be indented by a single tab from the containing block. When creating a new block of code (i.e. functions, loops, if-statements, etc...), the opening bracket "{" shall be on the same line as the start of the block and the closing bracket shall be on its own line aligned to the opening indentation of that block. This is true except for when the code block can fit entirely on a single line, in such a case it is allowable to do so however there should be sufficient space for a leading ''and'' trailing space between the code-block body and the brackets. For example: