Style Guide

Coordinator
May 21, 2013 at 11:33 PM
I think it might be good to established a coding style guide. I already have my own style, but I wanted to find out what others think?

What is most important to you?

I prefer braces below declarations and Camel Case Names like NameSomthingLessGeneric. I also prefer spaces instead of tabs. I like 4 spaces instead of 8.
May 23, 2013 at 5:32 AM
Establishing a coding style guide is a good idea.

I prefer using Pascal Notation for public class members and Camel Notation for private class members. I usually give one tab space for each subsequent level of nested code block. Somehow, I don't really like giving spaces, it's always been tabs. I too prefer braces below declarations.
Coordinator
May 23, 2013 at 1:00 PM
Edited May 23, 2013 at 1:15 PM
In terms of whitespace I would really prefer no blank newlines or carriage returns unless they are necessary. For example:
class BadExample
{
    public void Bad()
    {
          int a  = 1;
          int b  = 1;
    }

    public void Example()
    {
    }

    // Lots of unnecessary space

}
This is a real pet hate of mine, because version control systems often see a new line as a change. In the past I have seen people commit code that doesn't actually have any real changes to the code. Instead I've seen developers just add new lines or take them out. I feel that this is simply time wasting or procrastination.

Ideally I would prefer this:
class GoodExample
{
    /*
     * Information about method
     * 
     */
     ///
     /// <summary>
     /// This text goes into the documentation and shows up in intellisense
     /// </summary>
     /// 
    public void Good()
    {
          int a  = 1;
          int b  = 1;
    }
    /*
     * Information about method
     * 
     */
    public void Example()
    {
    }
}
If you need whitespace like on the "bad example" then you should probably have a comment in its place. That way you are at least putting in something more useful in the source code.