Re: StrutsStatics...
Chris Pratt wrote: > > I don't know for sure, but that's pretty common practice before Java 5's > import static. > I disagree. This was in practice in the '90s, although to say it was "common" is a stretch. Much more common has always been to define constants in a utility class or within the class that most used the constant. As the original poster wrote at http://www.nabble.com/struts2-design-question-to15595006.html, such code has been in disfavor for many years now. In the dozens of companies for which I've consulted, I haven't seen it done since a client in the educational textbook industry in 2001. Adam Hardy wrote: > I think if you look at StrutsStatics it's not really the constant > interface antipattern. > What?! It is *precisely* the constant interface antipattern. The larger problem is why this exists in XWork code, too (see original poster's comment), and how poor design like this affects the public view of Struts2. Use of the constants interface antipattern is a sign of choosing laziness over good design. CleverSwine -- View this message in context: http://www.nabble.com/StrutsStatics...-tp15595866p15613189.html Sent from the Struts - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StrutsStatics...
Chris Pratt wrote: > I never said it was a good idea, it's just something that was so common > that > they decided to make it part of the language. This statement demonstrates a fundamental misunderstanding of Java. I really hope you are NOT a committer on the struts2 project. Chris Pratt wrote: > But it is something I've need innumerable times, especially when reviewing > Apache Java source. I don't even know where to begin with this statement. You might as well have said, "my parents shoplift, so why shouldn't I?" Justifying poor design by pointing to someone else and saying "But look, he does it, too!" is childish. Dave Newton wrote: > Most recently in 2007, although like WebWork, the code was relatively old, > and they had been unable to switch to Java 5 at that time. This problem has absolutely nothing to do with java5, and it would appear you're just not getting that. Java5 wasn't out in 2001 when Bloch and others wrote about this issue, yet an issue it was... and people avoided it like the plague both pre- and post-Java5. In some OO languages (C++ comes to mind), the constant interface anti-pattern isn't possible because constants cannot be defined on interfaces. -- View this message in context: http://www.nabble.com/StrutsStatics...-tp15595866p15761878.html Sent from the Struts - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: StrutsStatics...
Antonio Petrelli wrote: > Err... Does C++ have interfaces at all? All I recall is that C++ has > classes. Of course it does. A simple google search (http://www.google.com/search?hl=en&q=C%2B%2B+interfaces&btnG=Google+Search) would have shown you. Perhaps you're thinking of C. Al Sutton wrote: > Sunds like a good reason why it isn't possible :). It's not possible because C++ doesn't permit variable declarations in interfaces, and even Java only permits them if they are invariants. newton.dave wrote: > One of the reasons people used the technique was to avoid a minimal amount > of extra keystrokes. Java 5's static imports removed the need for the > extra keystrokes. I disagree. Auto-complete/auto-suggest editors (or "IntelliSense", as Microsoft likes to call it) like JBuilder et. al., and, later, Eclipse, removed the need for the extra keystrokes. newton.dave wrote: > That aside: not everybody avoided it. If they had, it wouldn't have had to > be written about at all. Good point. Newbies to OOP didn't avoid it because they didn't know better. I hope you're not insinuating that the WebWork/XWork/Struts2 team were newbies when they began this framework. I'd like to think MVC frameworks that are apache top-level projects are written by mature (programming-wise), experienced software engineers. newton.dave wrote: > Nobody is saying it's a good technique; that doesn't change that many > people used it. We're just going to have to agree to disagree on that word "many" because I haven't see the constant interface pattern used nearly as frequently as you claim to have. newton.dave wrote: > If you have any further issues with me specifically you can take them up > withme off-line or in person; this is not the forum for spewing invective > and insulting people. I've no issue with you, Dave, and the only personal attack I think I've made was towards Chris. I reiterate that, based on his comments in his thread, I hope he's not a Struts2 committer. Anyone care to shed some light on his involvement with Struts2? Is he a committer? Thanks, Clever Swine -- View this message in context: http://www.nabble.com/StrutsStatics...-tp15595866p15765459.html Sent from the Struts - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [OT] Re: StrutsStatics...
newton.dave wrote: > >>> One of the reasons people used the technique was to avoid a minimal >>> amount of extra keystrokes. Java 5's static imports removed the need >>> for the extra keystrokes. >> I disagree. > > Go ahead. That's why people did it. There's no other reason to do it. Did you purposefully quote me out-of-context? The full quote is: CleverSwine wrote: > I disagree. Auto-complete/auto-suggest editors (or "IntelliSense", as > Microsoft likes to call it) like JBuilder et. al., and, later, Eclipse, > removed the need for the extra keystrokes. Meaning: if you're claiming that people only used the constant interface anti-pattern to save keystrokes, I'm saying that's nonsense because said keystrokes could also have been saved with auto-suggest IDEs... which have been available for 10+ years (i.e., long before Java5 and during the use of the constant interface anti-pattern). Perhaps *some* people did it to save keystrokes, but more often than not people simply repeated bad designs and patterns perpetrated by others because they didn't know any better and/or didn't question and/or subscribe to copy-and-paste development. newton.dave wrote: > >> the only personal attack I think I've made was towards Chris. > > Which is completely out-of-line and inappropriate in this forum. > Sorry, I apologize for that. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/StrutsStatics...-tp15595866p15767479.html Sent from the Struts - Dev mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]