Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Managing constants in large applications

807569Jun 30 2006 — edited Jun 30 2006
This 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?
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 28 2006
Added on Jun 30 2006
10 comments
297 views