Java Effective - V
90 points to make your coffee

5. Enums and Annotations

JAVA supports two special-purpose families of reference types: a kind of class called an enum type, and a kind of interface called an annotation type.

34. Use enums over int Constants

35. Use instance fields instead of Ordinals.

36. Use enumsets instead of bit-fields.

37. Use EnumMaps when needed to partition enums

38. Emulate enum extensiblity with Interfaces

39. Use annotations to naming patterns

40. Consistently use the @Overrides annotations

41. Use marker interfaces to define types

- Marker interfaces have no methods but merely marks the implementing class as having some property. Consider serialiazble, it means an implementing class can be serialized.
- Marker annotations can do the same but using iterfaces as markers have 2 benifits:
  - Marker interface provide checking at compile time, marker annotations work only at runtime.
  - Marker interfaces can be targeted in an interface hierarchy by being defined as a subtype of another interface. Marker annotations will work on any class or method if it is defined as ElementType.TYPE.
*****
Written by Martin on 30 May 2019