Should I Use Enumerations?
You Should Use Enum Types Any Time You Need to Represent a Fixed Set of Constants. That Includes Natural Enum Types Such as the Planets in Our Solar System and...
You should use enum types any time you need to represent a fixed set of constants. That includes natural enum types such as the planets in our solar system and data sets where you know all possible values at compile time—for example, the choices on a menu, command line flags, and so on.
Why would you use enumerations?
Enumerations make for clearer and more readable code, particularly when meaningful names are used. The benefits of using enumerations include: Reduces errors caused by transposing or mistyping numbers. Makes it easy to change values in the future.
What are the disadvantages of enumerations?
Disadvantages of using Enum as a singleton:
- Coding Constraints. In regular classes, there are things that can be achieved but prohibited in enum classes. Accessing a static field in the constructor, for example. ...
- Serializability. For singletons, it is very common to be stateful.