pietrorampini / UpdateChecker

Increase your app's updates

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Code Cleanup

Serverfrog opened this issue · comments

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.

use Enums instead of static final int

Why?

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

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)

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.