Coding Standard - Panvina/BattleShips---Six GitHub Wiki

Naming Conventions:

  • Classes, constructors and methods are PascalCase.
  • Fields, variables, and parameters are camelCase.
  • Fields may be prefixed with a _ to make them easier to identify (eg: _text rather than just text).
  • Constants are UPPER_CASE.

Word Choice:

  • Choose easily readable identifier names (eg: a property named HorizontalAlignment is more English-readable than AlignmentHorizontal).
  • Favor readability over brevity (eg: a property name CanScrollHorizontally is better than ScrollableX (an obscure reference to the X-axis)).
  • DO NOT use underscores, hyphens, or any other nonalphanumeric characters.
  • DO NOT use Hungarian notation.
  • AVOID using identifiers that conflict with keywords of widely used programming languages.

Using Abbreviations and Acronyms:

  • DO NOT use abbreviations or contractions as part of identifier names (eg: use GetWindow rather than GetWin).
  • DO NOT use any acronyms that are not widely accepted, and even if they are, only when necessary.

Layout Conventions:

  • Use the default Code Editor settings (smart indenting, four-character indents, tabs saved as spaces).
  • Write only one statement per line.
  • Write only one declaration per line.
  • If continuation lines are not indented automatically, indent them one tab stop (four spaces).
  • Add at least one blank line between method definitions and property definitions.
  • Use parentheses to make clauses in an expression apparent, as shown in the following code.

Commenting Conventions:

  • Place the comment on a separate line, not at the end of a line of code.
  • Begin comment text with an uppercase letter.
  • End comment text with a period.
  • Insert one space between the comment delimiter (//) and the comment text.
  • Do not create formatted blocks of asterisks around comments.

References: