Managing constants in large applications
807569Jun 30 2006 — edited Jun 30 2006This is an issue that has come up many times in my projects. While I try to avoid the practice, I almost always have some sort of Constants.java class that contains a bunch of public static final constants. This includes things like application name, filenames for configuration files, version numbers, network ports, etc. Sometimes I'll split them up into multiple classes (e.g., AppConstants.java and NetworkConstants.java).
Is this an accepted practice in larger applications, or are global constants typically handled differently? I've always considered my solution to be inelegant, but I haven't come up with a better way of doing it. Suggestions?