I’m reviewing some code from my job from another employee and came across a class consisting of only public static final fields. What is the benefit of this, and how would it be used? My guess is that it makes it easy to retrieve info from XML tags. Any other ideas or knowledge?
Share
It’s a common Java idiom to define (sort of) constants, to avoid harcoding fixed (‘magic’ – probably duplicated and hard to refactor) values in code.
https://softwareengineering.stackexchange.com/questions/59642/best-practices-for-constants
http://www.javapractices.com/topic/TopicAction.do?Id=2
Java enumerations vs. static constants
Best practice for global constants involving magic numbers