Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use final keyword when possible #35

Open
yungpanda opened this issue Jul 23, 2014 · 1 comment
Open

Use final keyword when possible #35

yungpanda opened this issue Jul 23, 2014 · 1 comment
Milestone

Comments

@yungpanda
Copy link

It's a good practice to use the final keyword as much as possible.
Every variable that isn't going to change it's value should be declared final.

Global variables
If you have constant fields they should be declared final for performance. The order of static and final doesn't matter, but try to keep the order the same in all your files.
E.g. LoginActivity has private static final and private final static which looks messy.

Variables inside methods
See http://programmers.stackexchange.com/questions/115690/why-declare-final-variables-inside-methods
*.... It's a good habit to get into along with a number of others; eg: "Make everything final by default, unless otherwise required", "Make everything private by default, unless otherwise required".... *

@yungpanda yungpanda added this to the Code cleanup milestone Jul 23, 2014
@mbamelis
Copy link
Contributor

Classes have been skimmed to a certain extent to apply these principals.

In addition, comment markup has been added to each class. Big sections are labeled with 3-line comment blocks. Titles include (all in caps in the java files): Nested Classes, Nested Interfaces, Static Members, Static Methods, Constructors, Members and, Methods
Each section is further divided with single code lines. These divide each section in a public, protected and, private subsection.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants