Skip to content

Latest commit

 

History

History
95 lines (66 loc) · 1.37 KB

STYLE.md

File metadata and controls

95 lines (66 loc) · 1.37 KB

Style guide for Moneybags

This style guide is for Java programming for the Moneybags project.

This style is primarily based on Google's Java Styleguide.

Indenting

Text is indented with 2 spaces

if-else blocks

if (something) {
    // logic here
} else if (somethingElse) {
    // different logic here
} else {
    // even more different
}

Variables

Member variables

Private member variables are prefixed with m_

private int m_age = 30;

Member variables use camelCase:

public String firstName = "Brad";

Constants

Constants are in ALL_CAPS with underscores to separate words:

private static final APP_VERSION = "1.0.0";

Methods

Methods names use camelCase:

private void doSomething() {}

Brackets are as such:

Do:

private void doSomething() {
    // happy days
}

Don't:

private void doSomething()
{
    // this is not right
}

Case statements and fall-through behaviour

Fall through is fine as long as there is a comment to inform that it is intentional:

switch (dayOfWeek) {
    case "Saturday":
        // Intentional fall-through
    case "Sunday":
        return "good";
    default:
        return "not good";
}

Interfaces

Interfaces are prefixed with I:

public interface IMyInterface