stds

Beginners Development Coding Standards

As implemented in C++

  • Single line logic statements, with spaces.

if ( foo == bar ) {
    ...
}
  • Same goes for Class declarations, or functions. Functions must space as if it was a logic statement.

class foo {
    public:

    foo() {
        ...
    }
    void bar( int arg ) {
        ...
    }
};
  • Main method should be neat and clean

int main ( int argc, char ** argv ) {
    ...
}
  • C++ Example

int main ( int argc, char ** argv ) {
    int  foo = 0;
    int  bar = 1;
    bool baz = false;

    bar = get_blumpkin( foo );

    if ( bar == 1 )
        frobernate( baz );

    if ( baz || bar != 3 ) {
        do_stuff();
        open_blotch( foo );  // we blotch the foo
    } else {
        baz_the_bar( foo );
    }

    /*
     * This is a multi line comment
     * Line up the lines so it looks nice
     * Because this just looks fantastic
     *
     */

    std::cout << "Well, hey there.\n";

}

As implemented in Java

public class Example {
        public static void main(String[] args) {
                
                    int     foo = 0;
                    int     bar = 1;
                    boolean baz = false;

                    bar = getBlumpkin( foo );

                    if ( bar == 1 )
                        frobernate( baz );

                    if ( baz || bar != 3 ) {
                        doStuff();
                        openBlotch( foo );  // we blotch the foo
                    } else {
                        bazTheBar( foo );
                    }

                    /*
                     * This is a multi line comment
                     * Line up the lines so it looks nice
                     * Because this just looks fantastic
                     *
                     */

                    System.out.println( "Well, hey there." );
        }
}

BeginnersTeam/FocusGroups/Development/Joining/stds (last edited 2009-10-11 17:39:28 by cpe-76-189-210-251)