Programming Style Guide
Introduction
General Programming
Brackets
public float Weight
{
get { return _weight;}
set
{
// If there is more than one command in a setter
// then don't keep it on one line.
_weight = value;
UpdateAccordingToWeight();
}
}
public void TryPieceCreation()
{
if( ShouldCreatePiece() )
{
CreatePiece();
}
}Incrementing and Decrementing Values
Use temporary variables to avoid complex statements
Limit use of "value"
Class Layout
Access Modifiers and Static
Regions
Structs as Fields
Comments and Documentation
XML Documentation
Comment code that deviates from expected structure
Comment *any* change to already-written code
Use the capitalized word UPDATE: when modifying already-modified code
Class, Enum, and Member Naming
Properties and Methods should be capitalized
Avoid abbreviations and non-descriptive variable names
Method arguments should be lower-case
Consts and Enums should be upper-case like Properties
Variables should be nouns, Methods should be verbs
Patterns
Methods should only have one exit point
Information-adding Exceptions should be in DEBUG blocks
Last updated
Was this helpful?