To maintain a concise and consistent code base, we’ll be trying to adopt a coding style that is loose to allow easy contribution, but also tidy. To do this, we use a combination of style guides per language. Generally, you should be following the style guide for that language closely, though you can potentially deviate within reason.

The main languages that undergo style critiques on code contributions are C++, Java, PHP, and Python. At some point in the future, for all languages, an appropriate linter (-Xlint for Java, Pylint for Python, etc.) may be added to ensure proper style on contributions.

General Notes

Code should mainly be “self-commenting” in that keeping code paths simple (breaking complex interactions into functions) and then commenting the functions as necessary. At a minimum, all functions should have comments that give a short description of function usage, parameter details and return details (giving expected types if it’s a dynamic language).


For PHP, please follow the PSR’s as laid out by the language developers, except for the cases listed below. Primarily of interest is PSR-1 and PSR-2, though PSR-4 does lay down some useful info about Namespaces in conjunction with autoloading (which is necessary for any new classes added to the system to ensure proper autoloading). Additionally, PHP code should be written such that the minimum version of PHP that is still supported would work.

if-elseif-else blocks

Each control function should begin on their own line and have one space between the conditional and the opening bracket

if ($a) {
    // stuff
elseif ($b) {
    // stuff
else {
    // stuff

Variable Names

Variable names should be all lowercase and contain underscores to distinguish between words in the variable.


We will follow the jQuery style guide for styling our code. All the Javascript code will be minified when in production so readability is the main goal so things like liberal use of spacing and the like are preferred.


For Python, we use flake8 to check Python code such that it follows things laid out in PEP-8, PEP-257, etc. The code is linted as part of our automated Travis-CI testsuite to ensure compliance. To locally lint the code, you will need to install three modules:

pip3 install flake8 flake8-bugbear flake8-docstrings

and then you can just run flake8 at the root to check all files or pass it an individual file to check just that. To see all files that are currently checked as part of Travis-CI, please look at the .flake8 config file.

For version of Python that code should support, you must support the minimum version of Python3 that comes by default with our supported distros, which at this time is Python 3.4 in Debian 7.


For Java, please follow the guidelines laid out in the Oracle Style Guide.


To do this we’ve modified certain important aspects of the Google Style Guide. This is a living document and will likely change as new issues arise.

When contributing to the homework server keep the following guidelines in mind.

General Rules

Header Files



Class Names

Type or class names should begin with a capital letter and have every word after begin with a capital letter (camel casing).

class MyClassName {...}

Function Names

All functions should be camel cased with the first letter being lowercase.

void getJesseSushi();

Variable Names

All variables should be lower case with underscores

int cats_in_house = 0;