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

Code Cleanup #125

Open
Serverfrog opened this issue Apr 5, 2016 · 4 comments
Open

Code Cleanup #125

Serverfrog opened this issue Apr 5, 2016 · 4 comments

Comments

@Serverfrog
Copy link

Make a Little Code Cleanup

  • use Enums instead of static final int
  • remove unnecessary Folder Structor for utils and store. There are only one Class inside. the Folders just obscure things.
  • remove static references to Activitys or Context.

There are more. Add them Please there. This tool is good but the code ist not the best.

@Yousha
Copy link

Yousha commented Sep 6, 2016

use Enums instead of static final int

Why?

@Serverfrog
Copy link
Author

It's more readable and compilesafe.
Enums are mainly used instead of the "static-final-int-construct" .

@Yousha
Copy link

Yousha commented Sep 6, 2016

Hmm, its NOT a good reason... but do you have any REAL example for this repository?

Because under the hood, compiler generates subclasses for each enum entry.
Also static finals occupy less space and they can be primitive itself.

Maybe that's why Google (in most cases) used static final... (instead of enum)

@Serverfrog
Copy link
Author

The AsyncCheck Class as example:
https://github.com/rampo/UpdateChecker/blob/master/library/src/main/java/com/rampo/updatechecker/ASyncCheck.java

First the Strings and then the Integers as two enums.

What is generated under the hood is not a real counter argument against readability!

It is a Development Standart since the creation of Enums to use them instead of static final variables (for multiple Variables which are used in the same context)

That extends a bit more that you have the possibility to add methods to the Enum Class which can depend on the current used Enum.

Your Store class is a wrong build enum by the way.

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