Wednesday, December 1, 2004

371.aspx

Larry's Coding Conventions

A great, easy to follow, guideline for coding style.


I was surprised to discover that I'm using the same coding style in C# as Larry Osterman uses in C/C++ with some minor exceptions:



  • I start method names in lower case, i.e. I use printError instead of PrintError, (leftover from my Java days)

  • I ALWAYS put the constant part of an evaluation on the left: if (S_OK == result) is safer than if (result == S_OK)
    I know it doesn't really matter that much in C# as the compiler warns you but; better safe than sorry.

For some reason I end up swapping back to hungarian notation when I program in C/C++ for Windows. I guess I can "blame" Programming Windows by Charles Petzold for that :-)


 

No comments:

Post a Comment