Results 1 to 2 of 2

Thread: Resource Bundles, Properies or Interfaces?

  1. #1
    Join Date
    Feb 2005
    Posts
    4

    Default 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. #2
    Join Date
    Aug 2004
    Location
    u.s.a
    Posts
    399

    Default

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

Similar Threads

  1. Replies: 11
    Last Post: Mar 27th, 2007, 02:18 AM
  2. Context initialization failed
    By kanonmicke in forum Container
    Replies: 7
    Last Post: Sep 29th, 2005, 12:35 AM
  3. Replies: 2
    Last Post: Jul 21st, 2005, 04:07 AM
  4. Replies: 1
    Last Post: Jul 14th, 2005, 09:50 AM
  5. Multiple Resource Bundles Dynamically Loaded
    By frozenquest in forum Web
    Replies: 1
    Last Post: Jan 27th, 2005, 04:06 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •