You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Dave Newton <ne...@yahoo.com> on 2008/02/20 19:42:02 UTC

StrutsStatics...

...why *do* we have StrutsStatics as an interface implemented all over?

Dave



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Paul Benedict <pb...@apache.org>.
It should be converted, if possible, to an abstract class. Interfaces are
for defining functionality. Furthermore, interfaces can only be public or
package-private. My advice comes from the guy who invented static imports,
but I can't reference to you what I read. Sorry!

Paul

On Wed, Feb 20, 2008 at 12:51 PM, Musachy Barroso <mu...@gmail.com> wrote:

> I hadn't even noticed that :)
>
> musachy
>
> On Feb 20, 2008 1:48 PM, James Mitchell <jm...@gmail.com> wrote:
> > implements vs imports vs static imports
> >
> > Probably just left over from the pre-j5 era.
> >
> >
> >
> >
> > On Feb 20, 2008 1:42 PM, Dave Newton <ne...@yahoo.com> wrote:
> > > ...why *do* we have StrutsStatics as an interface implemented all
> over?
> > >
> > > Dave
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > > For additional commands, e-mail: dev-help@struts.apache.org
> > >
> > >
> >
> >
> >
> > --
> > James Mitchell
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > For additional commands, e-mail: dev-help@struts.apache.org
> >
> >
>
>
>
> --
> "Hey you! Would you help me to carry the stone?" Pink Floyd
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Re: StrutsStatics...

Posted by Musachy Barroso <mu...@gmail.com>.
I hadn't even noticed that :)

musachy

On Feb 20, 2008 1:48 PM, James Mitchell <jm...@gmail.com> wrote:
> implements vs imports vs static imports
>
> Probably just left over from the pre-j5 era.
>
>
>
>
> On Feb 20, 2008 1:42 PM, Dave Newton <ne...@yahoo.com> wrote:
> > ...why *do* we have StrutsStatics as an interface implemented all over?
> >
> > Dave
> >
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> > For additional commands, e-mail: dev-help@struts.apache.org
> >
> >
>
>
>
> --
> James Mitchell
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by James Mitchell <jm...@gmail.com>.
implements vs imports vs static imports

Probably just left over from the pre-j5 era.



On Feb 20, 2008 1:42 PM, Dave Newton <ne...@yahoo.com> wrote:
> ...why *do* we have StrutsStatics as an interface implemented all over?
>
> Dave
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>



-- 
James Mitchell

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Blake Byrnes <bl...@gmail.com>.
It should also improve perf by a tiny bit since several things like OGNL and
TextProviders iterate over all the interfaces and super classes you
implement/extend.

On Thu, Feb 21, 2008 at 11:03 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2008/2/21, Paul Benedict <pb...@apache.org>:
> >
> > I say fix it in Struts 3.0. Yes, it's a horrible pattern to make a
> > programming shortcut. But it's certainly not acceptable to change it in
> > minor point releases. Better wait for the next major point release to
> make
> > incompatible changes.
>
>
>
> -1. I think that deprecating that interface (and its members), moving the
> constants in the right place, removing StrutsStatics from the "implements"
> directive does not harm anyone.
>
> Antonio
>

Re: StrutsStatics...

Posted by Jeromy Evans <je...@blueskyminds.com.au>.
Musachy Barroso wrote:
> I never thought this would generate such a long thread. Yeah we should
> fix it, but c'on, we have a ton of bugs to fix and new/cool stuff to
> implement :).
>
> musachy
>   
>   

Yeah, this thread is a classic case of non-urgent non-important chatter 
(ref Steven R. Covey's book 
http://en.wikipedia.org/wiki/The_Seven_Habits_of_Highly_Effective_People)
(excluding the divergence back into revision control philosophy which is 
important)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Musachy Barroso <mu...@gmail.com> wrote:
> I never thought this would generate such a long thread. 

Me neither :/ Really, I just wanted confirmation that it was a legacy
holdover.

I vote to deprecate and move the constants into StrutsConstants.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Musachy Barroso <mu...@gmail.com>.
I never thought this would generate such a long thread. Yeah we should
fix it, but c'on, we have a ton of bugs to fix and new/cool stuff to
implement :).

musachy

On Thu, Feb 21, 2008 at 11:21 AM, Antonio Petrelli
<an...@gmail.com> wrote:
> 2008/2/21, Paul Benedict <pb...@apache.org>:
>  >
>
> > Antonio, you are probably more familiar with the project :-) But the whole
>  > purpose of minor point releases is to say "hey, i am at least compatible
>  > with anything else in the 2.x line" -- if you can meet that requirement,
>  > then you should at least deprecate it in 2.1.
>
>
>
>  +1. But I think that StrutsStatics is only the minor of the problems.
>
>  Antonio
>



-- 
"Hey you! Would you help me to carry the stone?" Pink Floyd

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/21, Paul Benedict <pb...@apache.org>:
>
> Antonio, you are probably more familiar with the project :-) But the whole
> purpose of minor point releases is to say "hey, i am at least compatible
> with anything else in the 2.x line" -- if you can meet that requirement,
> then you should at least deprecate it in 2.1.



+1. But I think that StrutsStatics is only the minor of the problems.

Antonio

Re: StrutsStatics...

Posted by Paul Benedict <pb...@apache.org>.
Antonio, you are probably more familiar with the project :-) But the whole
purpose of minor point releases is to say "hey, i am at least compatible
with anything else in the 2.x line" -- if you can meet that requirement,
then you should at least deprecate it in 2.1.

Paul

On Thu, Feb 21, 2008 at 10:03 AM, Antonio Petrelli <
antonio.petrelli@gmail.com> wrote:

> 2008/2/21, Paul Benedict <pb...@apache.org>:
> >
> > I say fix it in Struts 3.0. Yes, it's a horrible pattern to make a
> > programming shortcut. But it's certainly not acceptable to change it in
> > minor point releases. Better wait for the next major point release to
> make
> > incompatible changes.
>
>
>
> -1. I think that deprecating that interface (and its members), moving the
> constants in the right place, removing StrutsStatics from the "implements"
> directive does not harm anyone.
>
> Antonio
>

Re: StrutsStatics...

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/21, Paul Benedict <pb...@apache.org>:
>
> I say fix it in Struts 3.0. Yes, it's a horrible pattern to make a
> programming shortcut. But it's certainly not acceptable to change it in
> minor point releases. Better wait for the next major point release to make
> incompatible changes.



-1. I think that deprecating that interface (and its members), moving the
constants in the right place, removing StrutsStatics from the "implements"
directive does not harm anyone.

Antonio

Re: StrutsStatics...

Posted by Brian Pontarelli <br...@pontarelli.com>.
Moving to API compat thread.


Don Brown wrote:
> I do agree we need to be much better about how much of our API we
> expose to developers, but I think the question of public vs private
> API goes beyond the Java semantics and into what a typical Struts user
> will encounter.   Unless you are a plugin or framework developer, it
> would be very rare for you to be creating configuration objects, so
> yes, while these are technically public, I'd certainly call them more
> private than, say, the Action interface.
>
> The other example you mention, changing the names of interceptors and
> results, is easily rectified by re-adding them under their old names
> side-by-side the new ones.  I agree this is a change that should have
> been done better.
>
> So the bottom line is what changes can you do when?  As I understand
> the Struts policy, there can be internal changes between minor
> releases as they are generally viewed as "mostly"
> backwards-compatible.  Therefore, I just don't enough justification
> for the statement that 2.1 changes are "completely incompatible",
> especially from the standpoint of a Struts application developer.
>
> Don
>
> On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
>   
>> Don Brown wrote:
>>  > On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
>>  >
>>  >>  Hehe. The changes from 2.0 to 2.1 are completely incompatible, so this
>>  >>  change is minor in comparison.
>>  >>
>>  >
>>  > I disagree with that statement.  For Struts 2 users, the changes are
>>  > only minor.  I think you feel them more because you are working on
>>  > plugins that dig deep into the Struts 2 and XWork 2 code, and yes, the
>>  > internals have changed quite a bit.  I'd say the biggest change, from
>>  > a user standpoint, was not allowing JSP EL expressions in JSP tags,
>>  > and that was first done in 2.0.10.
>>  >
>>
>> I'm pretty sure applications will break. Just look at the changes made
>>  to the names of interceptors, results, etc. Plus, I've got to argue this
>>  point because those APIs that I was using as a plugin developer or in
>>  other similar cases are public APIs. This is very different than
>>  internal APIs. If you are going to make something public, you need to
>>  ensure compatibility because if it is public, people will use it.
>>
>>  I have a good antidote about this. The folks over at Spring had an API
>>  that was public and returned the current proxy (for AOP). They
>>  documented it saying something like, "don't use this even though it is
>>  public." Well, sure enough, a number of people used it and the method
>>  changed a few times and broke a few times over the years. Each release
>>  they did there would be a bug submitted to fix that method and each time
>>  the Spring folks would say, "don't use that method," and after some
>>  moaning and groaning would eventually fix the method.
>>
>>  The moral of the story: if it is public, people will use it and if you
>>  break it, people will complain.
>>
>>
>>  -bp
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>>  For additional commands, e-mail: dev-help@struts.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Don Brown <mr...@twdata.org>.
I do agree we need to be much better about how much of our API we
expose to developers, but I think the question of public vs private
API goes beyond the Java semantics and into what a typical Struts user
will encounter.   Unless you are a plugin or framework developer, it
would be very rare for you to be creating configuration objects, so
yes, while these are technically public, I'd certainly call them more
private than, say, the Action interface.

The other example you mention, changing the names of interceptors and
results, is easily rectified by re-adding them under their old names
side-by-side the new ones.  I agree this is a change that should have
been done better.

So the bottom line is what changes can you do when?  As I understand
the Struts policy, there can be internal changes between minor
releases as they are generally viewed as "mostly"
backwards-compatible.  Therefore, I just don't enough justification
for the statement that 2.1 changes are "completely incompatible",
especially from the standpoint of a Struts application developer.

Don

On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
> Don Brown wrote:
>  > On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
>  >
>  >>  Hehe. The changes from 2.0 to 2.1 are completely incompatible, so this
>  >>  change is minor in comparison.
>  >>
>  >
>  > I disagree with that statement.  For Struts 2 users, the changes are
>  > only minor.  I think you feel them more because you are working on
>  > plugins that dig deep into the Struts 2 and XWork 2 code, and yes, the
>  > internals have changed quite a bit.  I'd say the biggest change, from
>  > a user standpoint, was not allowing JSP EL expressions in JSP tags,
>  > and that was first done in 2.0.10.
>  >
>
> I'm pretty sure applications will break. Just look at the changes made
>  to the names of interceptors, results, etc. Plus, I've got to argue this
>  point because those APIs that I was using as a plugin developer or in
>  other similar cases are public APIs. This is very different than
>  internal APIs. If you are going to make something public, you need to
>  ensure compatibility because if it is public, people will use it.
>
>  I have a good antidote about this. The folks over at Spring had an API
>  that was public and returned the current proxy (for AOP). They
>  documented it saying something like, "don't use this even though it is
>  public." Well, sure enough, a number of people used it and the method
>  changed a few times and broke a few times over the years. Each release
>  they did there would be a bug submitted to fix that method and each time
>  the Spring folks would say, "don't use that method," and after some
>  moaning and groaning would eventually fix the method.
>
>  The moral of the story: if it is public, people will use it and if you
>  break it, people will complain.
>
>
>  -bp
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>  For additional commands, e-mail: dev-help@struts.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Brian Pontarelli <br...@pontarelli.com> wrote:
> Don Brown wrote:
> > On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
> >>  Hehe. The changes from 2.0 to 2.1 are completely incompatible, so this
> >>  change is minor in comparison.
> > I disagree with that statement.  For Struts 2 users, the changes are
> > only minor.  I think you feel them more because you are working on
> > plugins that dig deep into the Struts 2 and XWork 2 code, and yes, the
> > internals have changed quite a bit.  I'd say the biggest change, from
> > a user standpoint, was not allowing JSP EL expressions in JSP tags,
> > and that was first done in 2.0.10.
> >   
> I'm pretty sure applications will break. Just look at the changes made 
> to the names of interceptors, results, etc.

That was started back in 2.0.7, with the old names kept for compatibility,
with the understanding (and documentation) that they'd (the old names) be
removed in 2.1.

> I have a good antidote about this.

Oh, if only there *were* a good antidote.

> The moral of the story: if it is public, people will use it and if you 
> break it, people will complain.

That's certainly true.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Brian Pontarelli <br...@pontarelli.com>.
Don Brown wrote:
> On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
>   
>>  Hehe. The changes from 2.0 to 2.1 are completely incompatible, so this
>>  change is minor in comparison.
>>     
>
> I disagree with that statement.  For Struts 2 users, the changes are
> only minor.  I think you feel them more because you are working on
> plugins that dig deep into the Struts 2 and XWork 2 code, and yes, the
> internals have changed quite a bit.  I'd say the biggest change, from
> a user standpoint, was not allowing JSP EL expressions in JSP tags,
> and that was first done in 2.0.10.
>   
I'm pretty sure applications will break. Just look at the changes made 
to the names of interceptors, results, etc. Plus, I've got to argue this 
point because those APIs that I was using as a plugin developer or in 
other similar cases are public APIs. This is very different than 
internal APIs. If you are going to make something public, you need to 
ensure compatibility because if it is public, people will use it.

I have a good antidote about this. The folks over at Spring had an API 
that was public and returned the current proxy (for AOP). They 
documented it saying something like, "don't use this even though it is 
public." Well, sure enough, a number of people used it and the method 
changed a few times and broke a few times over the years. Each release 
they did there would be a bug submitted to fix that method and each time 
the Spring folks would say, "don't use that method," and after some 
moaning and groaning would eventually fix the method.

The moral of the story: if it is public, people will use it and if you 
break it, people will complain.

-bp

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Don Brown <mr...@twdata.org>.
On 2/22/08, Brian Pontarelli <br...@pontarelli.com> wrote:
>
>  Hehe. The changes from 2.0 to 2.1 are completely incompatible, so this
>  change is minor in comparison.

I disagree with that statement.  For Struts 2 users, the changes are
only minor.  I think you feel them more because you are working on
plugins that dig deep into the Struts 2 and XWork 2 code, and yes, the
internals have changed quite a bit.  I'd say the biggest change, from
a user standpoint, was not allowing JSP EL expressions in JSP tags,
and that was first done in 2.0.10.

As for this statics discussion, yes, this code was brought over from
WebWork, but really, is there any pragmatic reason to change it?
Especially stacked up against all the other issues, would we really
get a big bang for the buck?

Don

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Brian Pontarelli <br...@pontarelli.com>.
Hehe. The changes from 2.0 to 2.1 are completely incompatible, so this 
change is minor in comparison. if we were to use the commonly accepted 
versioning scheme of major vs. minor releases, 2.1.x would eventually 
become 3.0 when it goes GA. So, I say make all these "break everything" 
changes now and get it out of our systems so we can solidify the public 
API sooner rather than later.

-bp



Paul Benedict wrote:
> I say fix it in Struts 3.0. Yes, it's a horrible pattern to make a
> programming shortcut. But it's certainly not acceptable to change it in
> minor point releases. Better wait for the next major point release to make
> incompatible changes.
>
> Paul
>
> On Thu, Feb 21, 2008 at 9:51 AM, Dave Newton <ne...@yahoo.com> wrote:
>
>   
>> --- CleverSwine <cl...@fastmail.fm> wrote:
>>     
>>> 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.
>>>       
>> It was a pretty common "cool kid" Java trick, precisely because it could
>> be
>> used to reduce the amount of typing. Doesn't mean it was a good idea.
>>
>>     
>>> 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.
>>>       
>> Just to provide a counter-anecdote, in the dozens of companies for which
>> I've
>> consulted I've seen it in probably half of them, give or take. 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.
>>
>>     
>>> 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.
>>>       
>> Relax.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>> For additional commands, e-mail: dev-help@struts.apache.org
>>
>>
>>     
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Paul Benedict <pb...@apache.org>.
I say fix it in Struts 3.0. Yes, it's a horrible pattern to make a
programming shortcut. But it's certainly not acceptable to change it in
minor point releases. Better wait for the next major point release to make
incompatible changes.

Paul

On Thu, Feb 21, 2008 at 9:51 AM, Dave Newton <ne...@yahoo.com> wrote:

> --- CleverSwine <cl...@fastmail.fm> wrote:
> > 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.
>
> It was a pretty common "cool kid" Java trick, precisely because it could
> be
> used to reduce the amount of typing. Doesn't mean it was a good idea.
>
> > 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.
>
> Just to provide a counter-anecdote, in the dozens of companies for which
> I've
> consulted I've seen it in probably half of them, give or take. 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.
>
> > 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.
>
> Relax.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
>
>

Re: StrutsStatics...

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/21, Dave Newton <ne...@yahoo.com>:
>
> > 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.
>
>
> Just to provide a counter-anecdote, in the dozens of companies for which
> I've
> consulted I've seen it in probably half of them, give or take.



Doh! I think that no one can beat the 3500+ LOC of the SqlRepository
interface monster, that, as you can imagine, contains all the SQL queries in
an application. :-) (obviously I am writing about my current workplace).
I am trying to restore sanity in these developers, but it is hard to do it
when the project is so large and no one wants to break anything.
Well, at least I am out of that particular project :-)

Antonio

Re: StrutsStatics...

Posted by Chris Pratt <th...@gmail.com>.
On Fri, Feb 29, 2008 at 8:15 AM, CleverSwine <cl...@fastmail.fm> wrote:
>
>
>  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.
>
No I'm not a committer on the project, but please enlighten me on my
fundamental misunderstanding of Java (this outght to be good).

>
>  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.
>

You are correct, my fingers did not type what my brain told them to.
It should have said:

But it is something I've *noticed* innumerable times, especially when
reviewing Apache Java source.

As I said in the rest of the e-mail, this is not a pattern I use myself.
  (*Chris*)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Al Sutton <al...@alsutton.com>.
Sounds like a good reason why it isn't possible :).

----- Original Message ----- 
From: "Antonio Petrelli" <an...@gmail.com>
To: "Struts Developers List" <de...@struts.apache.org>
Sent: Friday, February 29, 2008 4:21 PM
Subject: Re: StrutsStatics...


> 2008/2/29, CleverSwine <cl...@fastmail.fm>:
>>
>> In some OO languages (C++ comes to
>> mind), the constant interface anti-pattern isn't possible because
>> constants
>> cannot be defined on interfaces.
> 
> 
> Err... Does C++ have interfaces at all? All I recall is that C++ has
> classes.
> 
> Antonio
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/29, CleverSwine <cl...@fastmail.fm>:
>
> In some OO languages (C++ comes to
> mind), the constant interface anti-pattern isn't possible because
> constants
> cannot be defined on interfaces.


Err... Does C++ have interfaces at all? All I recall is that C++ has
classes.

Antonio

Re: [struts-dev] [OT] Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Wes Wannemacher <we...@wantii.com> wrote:
> On Sat, 2008-03-01 at 10:42 -0800, Dave Newton wrote:
> > --- Dale Newfield <Da...@Newfield.org> wrote:
> > > [...] (and therefore none of us that still use emacs could possibly
> > > by good coders) [...]
> > Fixed your typo.
> Don't forget about those of us using ed/cat/butterflies

Still emacs, although that particular sequence has permanently crippled my
left hand.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [struts-dev] [OT] Re: StrutsStatics...

Posted by Wes Wannemacher <we...@wantii.com>.
On Sat, 2008-03-01 at 10:42 -0800, Dave Newton wrote:
> --- Dale Newfield <Da...@Newfield.org> wrote:
> > [...] (and therefore none of us that still use emacs could possibly
> > by good coders) [...]
> 
> Fixed your typo.
> 
> Dave
> 
> 

Don't forget about those of us using ed/cat/butterflies

http://www.xkcd.com/378/

-Wes


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [struts-dev] [OT] Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Dale Newfield <Da...@Newfield.org> wrote:
> [...] (and therefore none of us that still use emacs could possibly
> by good coders) [...]

Fixed your typo.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [struts-dev] [OT] Re: StrutsStatics...

Posted by Dale Newfield <Da...@Newfield.org>.
CleverSwine wrote:
> auto-suggest IDEs...

The combination of your assumption that all "good coders" use IDEs (and 
therefore none of us that still use vi could possibly by good coders), 
continued posting about the same issue without any additional 
contributions to the conversation (this would be an API change, which 
was recently talked to death and I think decided against unless there's 
a very good reason), and your refusal to identify yourself gives us all 
plenty of reason to ignore you.

Since this is quite a generous group of people that develop/support 
Struts, I expect that should you wish to raise this same issue again, 
there's still a chance you'll get a receptive audience, but only if you 
do so politely, without repeating yourself, and non-anonymously.

-Dale

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: [OT] Re: StrutsStatics...

Posted by CleverSwine <cl...@fastmail.fm>.

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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org




-- 
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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


[OT] Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- CleverSwine <cl...@fastmail.fm> wrote:
> 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.

>From the first sentence of the first link:

> The distinction between classes and interfaces is a powerful
> language feature present both in Java and C# (along with
> many other languages) but not in C++.

An interface pattern isn't an interface, which is what people were responding
to.

> 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.

> the only personal attack I think I've made was towards Chris.

Which is completely out-of-line and inappropriate in this forum.

You may continue without me.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by CleverSwine <cl...@fastmail.fm>.

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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- CleverSwine <cl...@fastmail.fm> wrote:
> 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.

Ratchet down a notch.

> 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.

...

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. Continued use of the pattern for the reason most people used it
is rendered irrelevant by Java 5.

That aside: not everybody avoided it. If they had, it wouldn't have had to be
written about at all. 

Nobody is saying it's a good technique; that doesn't change that many people
used it.

If you have any further issues with me specifically you can take them up with
me off-line or in person; this is not the forum for spewing invective and
insulting people.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by CleverSwine <cl...@fastmail.fm>.

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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Chris Pratt <th...@gmail.com>.
On Thu, Feb 21, 2008 at 7:34 AM, CleverSwine <cl...@fastmail.fm>
wrote:

>
>
> 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.
>
>
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.  I have never used the
anti-pattern myself, I like to create constants in the classes that they
should live (using the Type-safe Enumerations pattern pre-1.5 and Java
Enumerations post-1.5 whenever appropriate).  But it is something I've need
innumerable times, especially when reviewing Apache Java source.
  (*Chris*)

Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- CleverSwine <cl...@fastmail.fm> wrote:
> 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. 

It was a pretty common "cool kid" Java trick, precisely because it could be
used to reduce the amount of typing. Doesn't mean it was a good idea.

> 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.

Just to provide a counter-anecdote, in the dozens of companies for which I've
consulted I've seen it in probably half of them, give or take. 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.

> 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.

Relax.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by CleverSwine <cl...@fastmail.fm>.

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: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Chris Pratt <th...@gmail.com>.
On Feb 20, 2008 10:42 AM, Dave Newton <ne...@yahoo.com> wrote:

> ...why *do* we have StrutsStatics as an interface implemented all over?
>
>
I don't know for sure, but that's pretty common practice before Java 5's
import static.  It allowed any class that "implements the interface" to
access the constants without having to prefix them.
  (*Chris*)

Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Antonio Petrelli <an...@gmail.com> wrote:
> 2008/2/20, Dave Newton <ne...@yahoo.com>:
> > ...why *do* we have StrutsStatics as an interface implemented all over?
> 
> IMHO all those "constants" should be scattered to all the needing
> classes, not centralized.
> In my past projects, I often had this sort of "statics", but I always
> found a way to put them as private constants in appropriate classes
> (even "utility" classes).

Well, these are all names under which objects are stored in contexts; they
may actually all belong together, but they definitely belong in a utility
class.

> Just my 2 eurocents.

With the US economy the way it is that's probably like a nickel now.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Adam Hardy <ah...@cyberspaceroad.com> wrote:
> I think if you look at StrutsStatics it's not really the constant interface
> antipattern.
> 
> It has just 6 constants which are the keys to retrieve the HTTP servlet api
> objects from whichever maps.

That's the constant interface antipattern; an interface used only to hold
constants, implemented by classes to avoid a small amount of typing.

> I guess if StrutsStatics was subject to a round of refactoring, the code
> for retrieving those API objects would be put into a utility class, with
the 
> constants too.

I don't think I'd put the code to retrieve the objects into the utils. I'd
just put the constants into a new or existing class and deal with the extra
typing. Especially since a StrutsConstants class already exists.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Adam Hardy <ah...@cyberspaceroad.com>.
Actually I'd go one further and say the constant should be a static on the class 
to which it has most relevance. Now that reduces typing and improves clarity.

Instead of

StrutsConstants.RESULT_CONSTANT1;
StrutsConstants.ACTION_CONSTANT1;

Action.CONSTANT1;

I think if you look at StrutsStatics it's not really the constant interface 
antipattern.

It has just 6 constants which are the keys to retrieve the HTTP servlet api 
objects from whichever maps.

I guess if StrutsStatics was subject to a round of refactoring, the code for 
retrieving those API objects would be put into a utility class, with the 
constants too.


Al Sutton on 21/02/08 07:01, wrote:
> Personally I prefer using something like;
> 
> StrutsConstants.STRUTS_URL........
> 
> I know it's not hip and funky, but it shows very clearly to anyone editing
> the code where the constant is defined.
> 
> The Constant Interface Antipattern or static imports reduce the amount of
> typing you have to do, but imho it reduces code clarity.
> 
> Al.
> 
> ----- Original Message ----- From: "Dave Newton" <ne...@yahoo.com>
> To: "Struts Developers List" <de...@struts.apache.org>
> Sent: Wednesday, February 20, 2008 8:01 PM
> Subject: Re: StrutsStatics...
> 
> 
>> --- Antonio Petrelli <an...@gmail.com> wrote:
>>> 2008/2/20, Dave Newton <ne...@yahoo.com>:
>>> > ...why *do* we have StrutsStatics as an interface implemented all 
>>> over?
>>>
>>> IMHO all those "constants" should be scattered to all the needing
>>> classes, not centralized.
>>> In my past projects, I often had this sort of "statics", but I always
>>> found a way to put them as private constants in appropriate classes
>>> (even "utility" classes).
>>
>> Well, these are all names under which objects are stored in contexts; 
>> they
>> may actually all belong together, but they definitely belong in a utility
>> class.
>>
>>> Just my 2 eurocents.
>>
>> With the US economy the way it is that's probably like a nickel now.
>>
>> Dave
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
>> For additional commands, e-mail: dev-help@struts.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Al Sutton <al...@alsutton.com>.
Personally I prefer using something like;

StrutsConstants.STRUTS_URL........

I know it's not hip and funky, but it shows very clearly to anyone editing
the code where the constant is defined.

The Constant Interface Antipattern or static imports reduce the amount of
typing you have to do, but imho it reduces code clarity.

Al.

----- Original Message ----- 
From: "Dave Newton" <ne...@yahoo.com>
To: "Struts Developers List" <de...@struts.apache.org>
Sent: Wednesday, February 20, 2008 8:01 PM
Subject: Re: StrutsStatics...


> --- Antonio Petrelli <an...@gmail.com> wrote:
>> 2008/2/20, Dave Newton <ne...@yahoo.com>:
>> > ...why *do* we have StrutsStatics as an interface implemented all over?
>>
>> IMHO all those "constants" should be scattered to all the needing
>> classes, not centralized.
>> In my past projects, I often had this sort of "statics", but I always
>> found a way to put them as private constants in appropriate classes
>> (even "utility" classes).
>
> Well, these are all names under which objects are stored in contexts; they
> may actually all belong together, but they definitely belong in a utility
> class.
>
>> Just my 2 eurocents.
>
> With the US economy the way it is that's probably like a nickel now.
>
> Dave
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
> For additional commands, e-mail: dev-help@struts.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Dave Newton <ne...@yahoo.com>.
--- Antonio Petrelli <an...@gmail.com> wrote:
> 2008/2/20, Dave Newton <ne...@yahoo.com>:
> > ...why *do* we have StrutsStatics as an interface implemented all over?
> 
> IMHO all those "constants" should be scattered to all the needing
> classes, not centralized.
> In my past projects, I often had this sort of "statics", but I always
> found a way to put them as private constants in appropriate classes
> (even "utility" classes).

Well, these are all names under which objects are stored in contexts; they
may actually all belong together, but they definitely belong in a utility
class.

> Just my 2 eurocents.

With the US economy the way it is that's probably like a nickel now.

Dave


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org


Re: StrutsStatics...

Posted by Antonio Petrelli <an...@gmail.com>.
2008/2/20, Dave Newton <ne...@yahoo.com>:
> ...why *do* we have StrutsStatics as an interface implemented all over?

IMHO all those "constants" should be scattered to all the needing
classes, not centralized.
In my past projects, I often had this sort of "statics", but I always
found a way to put them as private constants in appropriate classes
(even "utility" classes).

Just my 2 eurocents.

Antonio

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@struts.apache.org
For additional commands, e-mail: dev-help@struts.apache.org