My responses are interspersed. 

> Daffin, Miles (Company IT) wrote:
> > What do people feel about using constants for property names?
>
> I can't really see the point. A property name is like a 
> variable name, it will never be displayed or localized, so 
> why would you ever want to change it?
 
e.g. Refactor --> rename. (Do you always get it right first time?) 
e.g. Misspelling a property name. How would you tell you had until you
get a run time error of some kind? (String literal constants are evil.)
 
> > <html:text property="<%=Keys.Section0.APPLICANT_NAME%>"/>
> 
> Can you think of a case where this value won't be "applicantName"?

I think you have missed my point, such as it was. The property name here
is defined by the bean. To ensure I don't misspell it I can use a
constant. This makes it easier to maintain the property: rename or
remove.
 
> > - jstl tags
> > - xml files (e.g. struts-config, validation)
> 
> Worse: if you have an ActionForm, you can't have a property 
> whose name depends on a constant!! And what about getters and setters.

What do you mean by 'depends on a constant'? ActionForms have
properties. These have names. These names are used in many places: java,
jsp, xml.

> > Should I forget about defining
> > constants?
> 
> Yes :)

I am unconvinced.

-Miles 
--------------------------------------------------------
 
NOTICE: If received in error, please destroy and notify sender.  Sender does 
not waive confidentiality or privilege, and use is prohibited. 
 

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

Reply via email to