Re: Why use IVAR_KEY static?
Ramsey Gurley <[email protected]>
| Newsgroups | gmane.comp.web.webobjects.wonder-disc |
|---|---|
| Message-ID | <[email protected]> |
A static constant is probably a tad faster too. If you really want to get your pants in a bunch about redundancy and LOC, check out all those static fetch methods. A little clazz pattern magic can make those go away. Ramsey On Feb 2, 2013, at 4:28 PM, John Huss wrote: > The main reason is backwards compatibility. The ERXKey values were added later; taking away the _KEY String constants would break many people's existing code. Of course you can always use your own custom template to avoid the breakage, or to remove the _KEY values if you prefer that. > > John > > > On Sat, Feb 2, 2013 at 4:02 PM, Ray Kiddy <[email protected]> wrote: > > I was wondering something. Why do all the WOLips EOGenerator templates use this kind of logic for attributes? > > public static final ERXKey<String> THING = new ERXKey<String>("thing"); > > public static final String THING_KEY = THING.key(); > > Why have that extra ivar with the "_KEY" suffix? > > It occurred to me that, if one is in java code there is no reason to use it. One can type 4 characters, _ K E Y, or one can hit <dot> k and then the autocomplete brings up the rest. > > And of course, one does not need it in a component. The toString() method in ERXKey returns the key, same as key(). > > So, is there any reason for the extra verbiage in all these EOGenerator-created source files? Just checking. I mean, more code is not always better. > > cheers - ray > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan > _______________________________________________ > Wonder-disc mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wonder-disc > > > ------------------------------------------------------------------------------ > Everyone hates slow websites. So do we. > Make your web apps faster with AppDynamics > Download AppDynamics Lite for free today: > http://p.sf.net/sfu/appdyn_d2d_jan_______________________________________________ > Wonder-disc mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wonder-disc ------------------------------------------------------------------------------ Everyone hates slow websites. So do we. Make your web apps faster with AppDynamics Download AppDynamics Lite for free today: http://p.sf.net/sfu/appdyn_d2d_jan _______________________________________________ Wonder-disc mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wonder-disc