For public facing code, we will follow all the guidelines specified by:
  • FxCop
  • Curly Braces
    • The opening curly brace will be places on the same line as the block it is starting:
public class MyClass {
  public MyClass ( ) {
    if ( this.IsTrue ) {

    }
  }
}

  • NO Public Variables : Use Public Getters and Setters
  • Private fields should be prefixed with a '_' if used at class level
  • At a minimum, all public accessible declarations should be commented with /// comments
  • If a class inherits from another class, the base class name should be in the name of the child class
public class DopplerFeedList : List<DopplerFeed> {

}
  • Copyright Notice
    • Every file should contain the copyright notice
  • Spacing
    • Spaces improve readability by decreasing code density. Here are some guidelines for the use of space characters within code:
      • Do use a single space after a comma between function arguments.
Right:  Console.In.Read(myChar, 0, 1);
Wrong:  Console.In.Read(myChar,0,1); 
  • Do not use a space after the parenthesis and function arguments
Right:  CreateFoo(myChar, 0, 1)
Wrong:  CreateFoo( myChar, 0, 1 ) 
  • Do use spaces inside brackets.
Right:  x = dataArray [ index ];
Wrong:  x = dataArray[index]; 
  • Do use a single space before flow control statements
Right:  while ( x == y )
Wrong:  while(x==y) 
  • Do use a single space before and after comparison operators
Right:  if ( x == y )
Wrong:  if (x==y) 

Last edited Oct 16, 2007 at 8:34 PM by camalot, version 1

Comments

No comments yet.