Naming Conventions

General

While naming conventions seem to vary tremendously from one shop to the next, I'm more for simplicity and readability. As a programmer, I think you'll find these conventions are simple, easy to use and will help you (and others) when going back through code.

Variables

  • Variable names should always be nouns.
  • Type Hungarian notation should never be used on this project (with the only exception begin related to UI). The compiler and IDE track variable types.
  • An _ prefix and camel case should be used for private fields: _firstName.
  • Avoid ambiguous abbreviations. Ctrl+Space will complete long but unambiguous variable names.
  • Use camel case for variables of local scope and argument names: firstName.
  • Use CAPS for constants.
  • Use pascal case for properties: FirstName.
  • Use a suffix of Delegate for delegate definitions.
  • Declare member variables in groups of their type, then alphebetized by name.

Methods

  • Method names should always have a verb in the name (preferably at the beginning) to indicate what they do.
  • Method names should never have prefixes for any reason. (s or s_ for static)
  • Method names should always use pascal casing.
  • Methods should be separated by access level. (public, private, etc.)
  • Methods should be grouped into regions which describe the access level or their general functionality.

Classes

  • Class names shouldn't have prefixes
  • Interfaces should begin with I.
  • Use pascal case for class, interface, structure and enum names.
  • Enum names should be plural.
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-Share Alike 2.5 License.