Skip to content

Coding Style Elements vs. Source Code Elements

janani-sridhar edited this page Sep 1, 2018 · 18 revisions

Here is the mapping between coding style elements and source code elements we have planned to cover. Initially, we intend to keep a single table for Java and Python (the PLs we're working on). Perhaps, as the project evolves, we will need to create a specific mapping for each language. Let's try to keep it updated to represent what actually we have covered. Later we can also mark the future elements we may cover during future iterations of this project.

Class Pkg decl. Import stmts. Constants Variables Methods or Functions Control stmts.
Blank lines x x
Curly brackets x x x
Indentation x x x
Tabs vs. space x x x x x
Line length x x x x x x x
Import x
Naming x x x x x
File encoding x

Elements of Style:

  1. Indentation:

Class:

Metric: Number of spaces (numeric scale: integer) for indentation following a class declaration. Google Java style guide recommends: +2 spaces (2 spaces per level) Python (PEP 8) style guide recommends: +4 spaces (4 spaces per level)

Method/Function:

Metric: Number of spaces (numeric scale: integer) for indentation following a method/function declaration. Google Java style guide recommends: +2 spaces (2 spaces per level) Python (PEP 8) style guide recommends: +4 spaces (4 spaces per level)

Control Statement:

Metric: Number of spaces (numeric scale: integer) for indentation following a control statement. Google Java style guide recommends: +2 spaces (2 spaces per level) Python (PEP 8) style guide recommends: +4 spaces (4 spaces per level)

  1. Blank lines:

Class:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

Method/Function:

Metric: ??
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

  1. Curly Brackets:

Class:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

Method:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

Control Statement:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

  1. Line Length

Package declaration:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

Import declaration:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

Class:

Metric: ??.
Google Java style guide recommends: ??
Python (PEP 8) style guide recommends: ??

Clone this wiki locally