Difference between revisions of "Team H - OOP344 - 20132"

From CDOT Wiki
Jump to: navigation, search
(Repository)
(Repository)
Line 5: Line 5:
 
=== Master Status ===
 
=== Master Status ===
 
* Master ('''last pushed/being pushed''') by ''Terry''
 
* Master ('''last pushed/being pushed''') by ''Terry''
** Merged in: Added BACKSAPCE, DEL, TAB, F(n), Character Entry
+
** Merged in: Added InTextEditor and ReadOnly
  
 
== Announcements ==
 
== Announcements ==

Revision as of 16:51, 16 June 2013

Modify this page to the needs of your team.
OOP344 | Weekly Schedule | Student List | Teams | Project | Student Resources

Repository

Master Status

  • Master (last pushed/being pushed) by Terry
    • Merged in: Added InTextEditor and ReadOnly

Announcements

Programming Style

Automated Formatting

The majority of formatting rules can be applied automatically using the astyle software.

astyle --style=kr --convert-tabs --pad-header --pad-oper --add-brackets --brackets=linux --lineend=linux file.cpp

Indentation

  • Indents made with spaces
  • Indent size is four characters

Braces

Braces should be made to match the K&R standard. This means that opening braces start on the same line as the expression that precedes them in all cases except for functions, and means that braces starting blocks should be one space away from the expression that precedes it.

Functions will have their opening brace on the line after the declaration, and this brace will be the only character on the line. Closing braces for all blocks should similarly sit alone on the ending line of the scope, except for related expressions like 'else'.

Bracing single-line blocks where it's not strictly necessary is strongly encouraged.

Parentheses

Parentheses should be one space away from keywords such as 'if' and 'for', but should not be spaced when calling functions or operators. Essentially parentheses should be separate when they contain a condition, but attached when they contain an argument list.

Operators

Binary operators should be spaced away from their operands, while unary operators should not.

Classes

Classes must explicitly state the 'private:' tag for consistency even though not technically necessary. The private/protected/public order is preferred. These tags should not be indented relative to the class keyword.

Variable Naming

lowerCamelCase names should be used such as:

curPos
setPos
row
col

Demonstration

class Console {
private:
    int _data;
protected:

public:
    Console();
    ~Console();
}

int foo() { // That brace should be on the next line
    return sizeof (int); // This should be sizeof(int)
}

int bar()
{
    if ( foo() ){ // This brace should be one space away from the if's condition...
        return 3;
    }else if ( bar() ){ // ...and so should these braces
        return 2;
    } else { // This is right
        return 1;
    }
}

int main()
{
    char someChar = '0';
    int i;

    // Although K&R allows for this...
    for (i=0; i<10; i++)
        cout << i;


    // ...please do this instead
    if ( foo() ) {
        bar();
    } else {
        someChar = 'a';
    }

    switch(someChar) { // switch is a keyword, so it should be switch (someChar)
    case '0':
        cout << 0;
        break;
    case 'a':
        cout << 1;
        break;
    }

    someChar+4; // Should be someChar + 4
    ! i; // Should be !i

  return 0;
}

Team Members

Add table rows by replacing sample table row, cell values with yours

OOP344 - Team name
First Name Last Name Section Seneca Id & email wiki id IRC nick GITHUB ID Blog URL
Drew Terrance Kerr A dtkerr Drew Terrance Kerr Praefractus TerryKerr dtkerr
Chisa Takata A ctakata Chisa Takata chisat chisat chisat

Discussions