Announcement Announcement Module
Collapse
No announcement yet.
Resource Bundles, Properies or Interfaces? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Resource Bundles, Properies or Interfaces?

    Hi.
    I was wondering: What do you guys use and why when it comes to coding names that are very unlikely to change, like
    Code:
     setSql("SP_GET_NAME").
    Do you use a properties file where you can code something like
    Code:
    setSql(myProps.getProperty("spGetName"));
    ?
    do you use interfaces or classes with constants where you can do
    Code:
    setSql(myConstants.spGetName);
    ?
    or do you use resource bundles?

    Any preferences?. Here's my take on it:
    Having a class/interface that contains constants is useful because if you (for whatever reason) change the name of one property, you will be forced by the compiler to fix it everywhere. If you use properties or bundles you may miss a few and find out about them in production
    On the file (properties/bundles) approach, you don't need to recompile the code if you make changes to the properties.

    I am still undecided as to what to use. Any preferences out there?

    Francisco.

  • #2
    I think the book "Effective Java" recommended the use of a class for constants.

    Comment

    Working...
    X