Coding Guidelines

If you plan to work on the source code of Peter, we ask that you please follow the specified guidelines below, so we can keep uniformity of the code for better reading and maintenance.

Resharper is a great (but expensive) tool to use for help with coding.

Files

  • The name of file must be the same as the name of the of the class, interface or enumeration in the file.
  • Only one class, interface or enumeration is allowed in a file, aside from private classes.
  • File names should start with a capital letter.

File Headers

For all new files please prepend the following header at the top of the file:

For C#:

/**
 * Peter
 * Created by: Peter Development Team
 *    http://peter.codeplex.com/
 * 
 * GNU General Public License version 2 (GPLv2)
 *    http://peter.codeplex.com/license
 *
 *  This code is provided on an AS IS basis, with no WARRANTIES,
 *  CONDITIONS or GUARANTEES of any kind.
 *
 **/

Comments

  • All comments are to be written in English.
  • All properties and methods are to have comments indicating it’s purpose.
  • Comments for the file can be included in the file header (above).
  • A space after the comment delimiter (‘//’ or ‘/*’) should always be included.

Naming

  • All names need to be in English.
  • Member variable need to have ‘m_’ prepended to the name.
  • Non-private fields should not exist, they should be properties.
  • Examples of the expected naming convention are below:

Entity

Naming Format

Sample

Types

UpperCamelCase

ModelMenu

Namespaces

UpperCamelCase

Peter.Logic

Interfaces

IUpperCamelCase

IPeterMenu

Methods

UpperCamelCase

AddHeader

Properties

UpperCamelCase

CanUndo

Events

UpperCamelCase

ActiveContentChanged

Local Variables

lowerCamelCase

okToReturn

Local Constants

UPPERCASE

MAX_TRIES

Parameters

lowerCamelCase

menuHeaderName

Instance Fields (private)

m_UpperCamelCase

m_ModelMenu

Static Fields (private)

s_UpperCamelCase

s_MainDictionary

Constant Fields (not private)

UPPERCASE

MAX_TOTAL_TRIES

Enum Members

UpperCamelCase

MainMenuIcon

All other

lowerCamelCase

somethingElse

Last edited Oct 7, 2013 at 2:39 PM by Jpmon1, version 17