Skip to content

Code style

jalberdi004 edited this page Feb 9, 2018 · 1 revision

Java

Trying to format and use an style guide for the code. In general:

Common rules

  • English should be used both for comments and code
  • 2 blank line indentation.
  • Opening "{" should be at the same line.
  • Closing "}" should be in an independent line.

Class

The structure of the class have to be the following:

  • Attributes
  • Constructor
  • Static methods
  • Getters and setters
  • Public methods
  • Package methods
  • Package private methods
  • Private methods

All abstract method have to go before any non-abstract ones.

Naming convention

  • All the words have to be together.
  • No "_".
  • Acronyms have to be also lower case.

Packages

  • Packages have to start with lower case

Class names

  • Starting with upper case.

Method names

  • Starting with lower case.

Based on http://google.github.io/styleguide/javaguide.html

Python

  • Names as in Java
  • Spaces before and after = (none in case of optional function parameter)
Clone this wiki locally