Programs that use the int enum pattern are brittle. Because int enums are
compile-time constants, they are compiled into the clients that use them. If the int
associated with an enum constant is changed, its clients must be recompiled. If
they aren’t, they will still run, but their behavior will be undefined.
There is no easy way to translate int enum constants into printable strings. If
you print such a constant or display it from a debugger, all you see is a number,
which isn’t very helpful. There is no reliable way to iterate over all the int enum
constants in a group, or even to obtain the size of an int enum group.
You may encounter a variant of this pattern in which String constants are
used in place of int constants. This variant, known as the String enum pattern, is
even less desirable. While it does provide printable strings for its constants, it can
lead to performance problems because it relies on string comparisons. Worse, it
can lead naive users to hard-code string constants into client code instead of using
field names. If such a hard-coded string constant contains a typographical error, it
will escape detection at compile time and result in bugs at runtime.
My Android Apps