pietrorampini / UpdateChecker

Increase your app's updates
Apache License 2.0
649 stars 126 forks source link

Code Cleanup #125

Open Serverfrog opened 8 years ago

Serverfrog commented 8 years ago

Make a Little Code Cleanup

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

Yousha commented 8 years ago

use Enums instead of static final int

Why?

Serverfrog commented 8 years ago

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

Yousha commented 8 years ago

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 commented 8 years ago

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.