Can you enumerate some of the reasons Bloch advocates this? It seems like a reasonable thing to suggest, I'd like to know his rationale for it though.
-- Frank W. Zammetti Founder and Chief Software Architect Omnytex Technologies http://www.omnytex.com
David Bolsover wrote:
It is worth taking a look at the excellent book 'Effective Java' by Joshua Bloch - he outlines a number of reasons for avoiding the constant interface pattern and instead advocates the use of a constant utility class as in..
public class MyInterface { public static final String YES = "yes"; }
db
-----Original Message----- From: Carl Smith [mailto:[EMAIL PROTECTED] Sent: 22 January 2005 15:50 To: user@struts.apache.org Subject: constants interface
In Java, sometimes you would define an interface containg the constants:
public interface MyInterface { public static final String YES = "yes"; }
To access the contants, there are two ways
public class WayOne { public void myMethod(){ String yes = MyInterface.YES; //... } }
public class WayTwo implements MyInterface { public void myMethod(){ String yes = YES; //... } }
I am asking which one is better? Or they are Ok and depend on the developer 's flavor?
signature
---------------------------------
Do you Yahoo!?
Yahoo! Search presents - Jib Jab's 'Second Term'
======================================================= This message has been scanned for viruses and dangerous content using Vet Anti-Virus Protection and is believed to be clean. =======================================================
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]