Java transgression #3
Do not use interfaces to act as the container for constants. Interfaces should only be used to define types. Using an interface causes internal detail, such as constants, to leak into the class’s public API. Once something becomes part of the public API you can never get rid of it.
Consider an abstract class with public static final constants. Using an abstract class is an implementation of the “uses” association. With the use of an abstract class, the intent is clear and design abuse such as when using interfaces cannot propagate to other classes.
Resource
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment