Last modified 5 years ago Last modified on 03/15/09 06:29:34

Coding Conventions

Summary

This document outlines the coding conventions used for developing Eraser. These conventions should be used throughout the Eraser sources for easy reading as well as to aid comprehension for future developers.

Identifiers

  • Assembiles
    • All assemblies should be named with the prefix Eraser, a dot, then followed by the namespace for the assembly. Namespace names will be covered in the next section.
  • Namespaces
    • All namespaces should be a logical name describing the use of the classes and functions in the namespace
    • The namespace should allow a developer to quickly guess relatively accurately what the classes and functions in the namespace are for and for quick code editing if bugs do arise.
    • Namespaces start with a capital letter. Subsequent words in the namespace name will have capital letters, i.e. EraserClient
  • Classes
    • All classes should have a logical name describing the functionality and utility of the class.
    • Classes should be documented with C#'s XML comments (type three forward slashes to get VS to fill in the default fields)
    • Class names start with a capital letter. Subsequence words in the name will have capital letters too, i.e. EraserTask
  • Functions
    • All functions in classes will use InterCaps.
    • Prefer properties over getter/setter functions.
  • Constants
    • All constants will use CAPITALS.
  • Enumerations
    • All enumerators should have a descriptive name for use in function parameters.
    • Enumerator names will use InterCaps, but enumerator values, being constant, will use CAPITALS.
  • Variables
    • Class Instance variables
      • All class based variables should start with a small letter, followed by !interCaps. So, int myNumber.
      • Initialise primitive datatypes at point of declaration, if it does not depend on any value.
    • Local variables
      • All local variables (including function parameters) will use !interCaps.
  • Properties
    • All properties will use InterCaps. Do NOT prefix the property with underscores or other markers.