RE: interface for constants

2006-07-18 Thread Krishna, Hari
absolutely not

-Original Message-
From: temp temp [mailto:[EMAIL PROTECTED]
Sent: Tuesday, July 18, 2006 3:43 PM
To: user@struts.apache.org
Subject: interface for constants


I have is a constants interface with static final fields .
Each field value is a call to DAO.

For example 
interface IObjectTypeIds{
public static final int APPLICATION =ObjectDAO.get(APPLICATION);
}

Is this is a good practice ?





-
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.
Notice:  All email and instant messages (including attachments) sent to
or from Franklin Templeton Investments (FTI) personnel may be retained,
monitored and/or reviewed by FTI and its agents, or authorized
law enforcement personnel, without further notice or consent.

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: interface for constants

2006-07-18 Thread Leon Rosenberg

it is a good practice to have a constants interface, but its a really
bad practice to perform hidden data accesses for constant
initialization. In your case a UtilityClass (static methods) with a
controlled initialization would be much better.

if ObjectDAO.get(APPLICATION) fails the results are pretty
undefined, since the whole interface will probably be unloadable by
the classloader and you'll get a lot of classnotfound exceptions...

leon

On 7/18/06, temp temp [EMAIL PROTECTED] wrote:

I have is a constants interface with static final fields .
Each field value is a call to DAO.

For example
interface IObjectTypeIds{
public static final int APPLICATION =ObjectDAO.get(APPLICATION);
}

Is this is a good practice ?





-
Do you Yahoo!?
 Everyone is raving about the  all-new Yahoo! Mail Beta.



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: interface for constants

2006-07-18 Thread George.Dinwiddie
One (of many) problems with this approach is that it may fail to
initialize, but that won't happen until the class is loaded at first
use.  If an application is broken because the database is inaccessible,
it's better to know at deployment.  I use a servlet startup listener
(javax.servlet.ServletContextListener) to perform initialization.

 - George
   http://www.idiacomputing.com/

 -Original Message-
 From: temp temp [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, July 18, 2006 6:13 AM
 To: user@struts.apache.org
 Subject: interface for constants
 
 
 I have is a constants interface with static final fields .
 Each field value is a call to DAO.
 
 For example 
 interface IObjectTypeIds{
 public static final int APPLICATION =ObjectDAO.get(APPLICATION); }
 
 Is this is a good practice ?
 
 
 
 
   
 -
 Do you Yahoo!?
  Everyone is raving about the  all-new Yahoo! Mail Beta.
 

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]