Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 43486 invoked from network); 11 Feb 2005 17:33:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 11 Feb 2005 17:33:32 -0000 Received: (qmail 26628 invoked by uid 500); 11 Feb 2005 17:33:22 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 26592 invoked by uid 500); 11 Feb 2005 17:33:22 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 26577 invoked by uid 99); 11 Feb 2005 17:33:21 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from hqvsbh2.ms.com (HELO hqvsbh2.ms.com) (205.228.12.104) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 11 Feb 2005 09:33:20 -0800 Received: from hqvsbh2.ms.com (localhost [127.0.0.1]) by localhost.ms.com (Postfix) with ESMTP id 0748B2E778 for ; Fri, 11 Feb 2005 12:33:18 -0500 (EST) Received: from ny16im01.ms.com (unknown [144.14.206.242]) by hqvsbh2.ms.com (internal Postfix) with ESMTP id C927B2A5D7 for ; Fri, 11 Feb 2005 12:29:13 -0500 (EST) Received: from nywexbh02.msad.ms.com (nywexbh02 [144.14.138.178]) by ny16im01.ms.com (Sendmail MTA Hub) with ESMTP id j1BHTD625144 for ; Fri, 11 Feb 2005 12:29:13 -0500 (EST) Received: from lnwexbh01.msad.ms.com ([172.16.119.58]) by nywexbh02.msad.ms.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 11 Feb 2005 12:29:11 -0500 Received: from LNWEXMB12.msad.ms.com ([172.24.231.27]) by lnwexbh01.msad.ms.com with Microsoft SMTPSVC(5.0.2195.6713); Fri, 11 Feb 2005 17:29:09 +0000 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: RE: Constants for property names Date: Fri, 11 Feb 2005 17:29:10 -0000 Message-ID: <83761BD133421248A07B9D0303827B0C2AD828@LNWEXMB12.msad.ms.com> X-MS-Has-Attach: Importance: normal Priority: normal X-MS-TNEF-Correlator: Thread-Topic: Constants for property names Thread-Index: AcUQJ/gV7xKfGuJ9QJ6jdtiBum2+cgANSGGQ From: "Daffin, Miles (Company IT)" To: "Struts Users Mailing List" X-OriginalArrivalTime: 11 Feb 2005 17:29:09.0856 (UTC) FILETIME=[321BFE00:01C5105F] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N My responses are interspersed.=20 > 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=20 > variable name, it will never be displayed or localized, so=20 > why would you ever want to change it? =20 e.g. Refactor --> rename. (Do you always get it right first time?)=20 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.) =20 > > "/> >=20 > 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. =20 > > - jstl tags > > - xml files (e.g. struts-config, validation) >=20 > Worse: if you have an ActionForm, you can't have a property=20 > 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? >=20 > Yes :) I am unconvinced. -Miles=20 -------------------------------------------------------- =20 NOTICE: If received in error, please destroy and notify sender. Sender = does not waive confidentiality or privilege, and use is prohibited.=20 =20 --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org