You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by cowwoc <co...@bbs.darktech.org> on 2008/06/12 07:03:00 UTC

Making Component easier to Generify


Have you considered moving from subclassing to composition in Wicket using
Callable<T>?

Currently it is quite common for developers to subclass a component in order
to override isVisible() and other properties. I am proposing that instead
the component classes become final and properties may only be set using
setter methods. The setter methods would take Callable<T> instead of T, so
for example setVisible(boolean) would become setVisible(Callable<Boolean>)

The benefit of this approach is that you could introduce static factory
methods to the Wicket components which would make them much easier to use in
their Generic form. You could then introduce various helper classes to
create Callable<T> for constant values, such as Callable.valueOf(true) would
return a Callable<Boolean> that always returns true.
-- 
View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by James Carman <ja...@carmanconsulting.com>.
If you override a method and your implementation violates the Liskov
Substitution Principle, then it's your fault! :)


On Thu, Jun 12, 2008 at 11:54 AM, cowwoc <co...@bbs.darktech.org> wrote:
>
>
> Actually, it's the other way around. Authors make methods final not because
> *you* might make a mistake but rather because *they* might. Using final
> methods simplifies their design a lot because they don't have to do all the
> work you mentioned. Secondly, it leaves the API open to extension (without
> breaking backwards compatibility) in a way that would be lost if anyone
> could override the methods.
>
> I personally agree with your approach with the following major caveat: if
> developers are able to override any method then it must be understood that
> any implementation making assumptions not guaranteed by the API
> specification is liable to break in future releases. Keep in mind that very
> few things ever are guaranteed by the specification, so practically speaking
> this means that your code is very likely to break as new releases come out.
>
> To be honest, I personally prefer approach #2 over final methods for public
> projects because (in my experience) even open-source projects take forever
> to fix bugs or add features that you might need right away. I'm a strong
> believer that implementations that make incorrect assumptions deserve to
> break in subsequent releases. One final benefit of #1 worth mentioning,
> however, is that incorrect assumptions end up in a compile-time error
> (roughly speaking) and even smart developers make mistakes every once in a
> while. Consider what happens if you override foo() and forget to invoke
> super.foo() by mistake. Those kinds of mistakes happen all the time. I'm
> toying with the idea that approach #1 makes sense for in-house projects
> where you are a co-owner and can make changes very quickly while approach #2
> makes sense for public projects when developers can't afford to wait on the
> project owner. Put another way, maybe #1 makes sense for mature APIs whereas
> #2 makes sense for experimental APIs (used to flesh out the various
> use-cases you need to support).
>
> Gili
>
>
> Brill Pappin wrote:
>>
>> I understand the reasoning, however I think "best practice" can be
>> debated.
>> To use your example Swing allows the user to override quite a bit, and
>> it doesn't make any (or very few) assumptions on what should and
>> should not be done.
>>
>> I don't like API's that assume I'm an idiot and prevent me from
>> manipulating them how I see fit. If I cause a bug that I have to deal
>> with, thats *my* problem to resolve.
>>
>> In my book (and I'm not the only one) excessive use of final is an
>> anti-pattern.
>>
>> - Brill Pappin
>>
>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>
>>>
>>> Brill,
>>>
>>> This is actually an API "best practice". Classes fall into two
>>> categories:
>>> ones designed for subclassing, and ones designed to be final. The
>>> same goes
>>> for methods. Swing is full of examples of what goes wrong when people
>>> override methods in classes that haven't been designed with
>>> subclassing in
>>> mind.
>>>
>>> Gili
>>>
>>>
>>> Brill Pappin wrote:
>>>>
>>>> on removing the finals
>>>>
>>>> The final members are the worst thing I've had to deal with in Wicket
>>>> so far.
>>>> Although I understand that there may be a reason for them, they are
>>>> more a hinderance than anything else and seem to be trying to
>>>> "protect
>>>> users from themselves".
>>>>
>>>> - Brill Pappin
>>>>
>>>>
>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>
>>>>>
>>>>>
>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>> using
>>>>> Callable<T>?
>>>>>
>>>>> Currently it is quite common for developers to subclass a component
>>>>> in order
>>>>> to override isVisible() and other properties. I am proposing that
>>>>> instead
>>>>> the component classes become final and properties may only be set
>>>>> using
>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>> T, so
>>>>> for example setVisible(boolean) would become
>>>>> setVisible(Callable<Boolean>)
>>>>>
>>>>> The benefit of this approach is that you could introduce static
>>>>> factory
>>>>> methods to the Wicket components which would make them much easier
>>>>> to use in
>>>>> their Generic form. You could then introduce various helper
>>>>> classes to
>>>>> create Callable<T> for constant values, such as
>>>>> Callable.valueOf(true) would
>>>>> return a Callable<Boolean> that always returns true.
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> --
> View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17803373.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Brill Pappin <br...@pappin.ca>.
Very thoughtful and some good points, I don't entirely disagree with  
that.

- Brill

On 12-Jun-08, at 11:54 AM, cowwoc wrote:

>
[...]

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by cowwoc <co...@bbs.darktech.org>.

Actually, it's the other way around. Authors make methods final not because
*you* might make a mistake but rather because *they* might. Using final
methods simplifies their design a lot because they don't have to do all the
work you mentioned. Secondly, it leaves the API open to extension (without
breaking backwards compatibility) in a way that would be lost if anyone
could override the methods.

I personally agree with your approach with the following major caveat: if
developers are able to override any method then it must be understood that
any implementation making assumptions not guaranteed by the API
specification is liable to break in future releases. Keep in mind that very
few things ever are guaranteed by the specification, so practically speaking
this means that your code is very likely to break as new releases come out.

To be honest, I personally prefer approach #2 over final methods for public
projects because (in my experience) even open-source projects take forever
to fix bugs or add features that you might need right away. I'm a strong
believer that implementations that make incorrect assumptions deserve to
break in subsequent releases. One final benefit of #1 worth mentioning,
however, is that incorrect assumptions end up in a compile-time error
(roughly speaking) and even smart developers make mistakes every once in a
while. Consider what happens if you override foo() and forget to invoke
super.foo() by mistake. Those kinds of mistakes happen all the time. I'm
toying with the idea that approach #1 makes sense for in-house projects
where you are a co-owner and can make changes very quickly while approach #2
makes sense for public projects when developers can't afford to wait on the
project owner. Put another way, maybe #1 makes sense for mature APIs whereas
#2 makes sense for experimental APIs (used to flesh out the various
use-cases you need to support).

Gili


Brill Pappin wrote:
> 
> I understand the reasoning, however I think "best practice" can be  
> debated.
> To use your example Swing allows the user to override quite a bit, and  
> it doesn't make any (or very few) assumptions on what should and  
> should not be done.
> 
> I don't like API's that assume I'm an idiot and prevent me from  
> manipulating them how I see fit. If I cause a bug that I have to deal  
> with, thats *my* problem to resolve.
> 
> In my book (and I'm not the only one) excessive use of final is an  
> anti-pattern.
> 
> - Brill Pappin
> 
> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
> 
>>
>> Brill,
>>
>> This is actually an API "best practice". Classes fall into two  
>> categories:
>> ones designed for subclassing, and ones designed to be final. The  
>> same goes
>> for methods. Swing is full of examples of what goes wrong when people
>> override methods in classes that haven't been designed with  
>> subclassing in
>> mind.
>>
>> Gili
>>
>>
>> Brill Pappin wrote:
>>>
>>> on removing the finals
>>>
>>> The final members are the worst thing I've had to deal with in Wicket
>>> so far.
>>> Although I understand that there may be a reason for them, they are
>>> more a hinderance than anything else and seem to be trying to  
>>> "protect
>>> users from themselves".
>>>
>>> - Brill Pappin
>>>
>>>
>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>
>>>>
>>>>
>>>> Have you considered moving from subclassing to composition in Wicket
>>>> using
>>>> Callable<T>?
>>>>
>>>> Currently it is quite common for developers to subclass a component
>>>> in order
>>>> to override isVisible() and other properties. I am proposing that
>>>> instead
>>>> the component classes become final and properties may only be set
>>>> using
>>>> setter methods. The setter methods would take Callable<T> instead of
>>>> T, so
>>>> for example setVisible(boolean) would become
>>>> setVisible(Callable<Boolean>)
>>>>
>>>> The benefit of this approach is that you could introduce static
>>>> factory
>>>> methods to the Wicket components which would make them much easier
>>>> to use in
>>>> their Generic form. You could then introduce various helper  
>>>> classes to
>>>> create Callable<T> for constant values, such as
>>>> Callable.valueOf(true) would
>>>> return a Callable<Boolean> that always returns true.
>>>> -- 
>>>> View this message in context:
>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17803373.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by James Carman <ja...@carmanconsulting.com>.
On Thu, Jun 12, 2008 at 11:08 AM, Brill Pappin <br...@pappin.ca> wrote:
> I understand the reasoning, however I think "best practice" can be debated.
> To use your example Swing allows the user to override quite a bit, and it
> doesn't make any (or very few) assumptions on what should and should not be
> done.
>
> I don't like API's that assume I'm an idiot and prevent me from manipulating
> them how I see fit. If I cause a bug that I have to deal with, thats *my*
> problem to resolve.
>
> In my book (and I'm not the only one) excessive use of final is an
> anti-pattern.

While I agree that using final all over the place is in general a bad
idea, there are other reasons to use the final modifier on a method.
It can also help performance (although these particular cases might
not be good examples of where you'd want to squeeze every last bit of
performance out at the cost of disallowing extensibility).

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by James Carman <ja...@carmanconsulting.com>.
That's funny.  By default I make every local variable final if I can.
I guess it's just out of habit.  I usually do the same for method
parameters, too (I'm less diligent about that one).  For methods, I
usually just leave them be until I know for sure that I need them to
be final.

On Thu, Jun 12, 2008 at 11:42 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> i mean generally, for methods, fields, and func args :) most of this
> stuff can stay final, but people dont bother doing it because its
> extra typing.
>
> -igor
>
> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
> <ja...@carmanconsulting.com> wrote:
>> You mean like C++?
>>
>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg <ig...@gmail.com> wrote:
>>> indeed. i wouldnt mind if final was the default in java :)
>>>
>>> -igor
>>>
>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>> <ma...@gmail.com> wrote:
>>>> Without the use of final wicket would not have made it this far.
>>>>
>>>> Martijn
>>>>
>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>>>>> I understand the reasoning, however I think "best practice" can be debated.
>>>>> To use your example Swing allows the user to override quite a bit, and it
>>>>> doesn't make any (or very few) assumptions on what should and should not be
>>>>> done.
>>>>>
>>>>> I don't like API's that assume I'm an idiot and prevent me from manipulating
>>>>> them how I see fit. If I cause a bug that I have to deal with, thats *my*
>>>>> problem to resolve.
>>>>>
>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>> anti-pattern.
>>>>>
>>>>> - Brill Pappin
>>>>>
>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>
>>>>>>
>>>>>> Brill,
>>>>>>
>>>>>> This is actually an API "best practice". Classes fall into two categories:
>>>>>> ones designed for subclassing, and ones designed to be final. The same
>>>>>> goes
>>>>>> for methods. Swing is full of examples of what goes wrong when people
>>>>>> override methods in classes that haven't been designed with subclassing in
>>>>>> mind.
>>>>>>
>>>>>> Gili
>>>>>>
>>>>>>
>>>>>> Brill Pappin wrote:
>>>>>>>
>>>>>>> on removing the finals
>>>>>>>
>>>>>>> The final members are the worst thing I've had to deal with in Wicket
>>>>>>> so far.
>>>>>>> Although I understand that there may be a reason for them, they are
>>>>>>> more a hinderance than anything else and seem to be trying to "protect
>>>>>>> users from themselves".
>>>>>>>
>>>>>>> - Brill Pappin
>>>>>>>
>>>>>>>
>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>>>>> using
>>>>>>>> Callable<T>?
>>>>>>>>
>>>>>>>> Currently it is quite common for developers to subclass a component
>>>>>>>> in order
>>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>>> instead
>>>>>>>> the component classes become final and properties may only be set
>>>>>>>> using
>>>>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>>>>> T, so
>>>>>>>> for example setVisible(boolean) would become
>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>
>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>> factory
>>>>>>>> methods to the Wicket components which would make them much easier
>>>>>>>> to use in
>>>>>>>> their Generic form. You could then introduce various helper classes to
>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>> Callable.valueOf(true) would
>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>> Apache Wicket 1.3.3 is released
>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Gwyn Evans <gw...@gmail.com>.
Hmm...  (As an aside, I wonder if they mean "pray in the jungle" or "prey in
the jungle"? :-))

/Gwyn

On Sat, Jun 14, 2008 at 8:23 AM, Martijn Dashorst <
martijn.dashorst@gmail.com> wrote:

> Or with qi4j (http://qi4j.org)
>
> Martijn
>
> On Sat, Jun 14, 2008 at 5:37 AM, Eelco Hillenius
> <ee...@gmail.com> wrote:
> >> It's good to know that when you reach the same conclusion it is a
> deliberate
> >> one.
> >> BTW, interfaces are useful for this, but not a necessity. Or am I the
> only
> >> one thinking that
> >
> > No, I agree with you mostly. However, I was trying (back then) to
> > define separate dimensions of components (the fact that they can be
> > rendered is one, and for form components for instance, the fact that
> > they can validate is another). If you have a bunch of useful
> > distinctions like that, you can just decorate them for specific
> > purposes. Maybe.
> >
> >> (I seem to be... hmm...). More interfaces mean even more
> >> scrolling through the I's in the javadoc, nooooo, lol.
> >
> > Indeed, it gets ugly pretty fast. Mixins and interfaces with
> > implementations like scala has would be wonderful here, but alas,
> > we'll have to work with Java.
> >
> > Eelco
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> > For additional commands, e-mail: users-help@wicket.apache.org
> >
> >
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Ah, you beat me to that. I should've read the thread entirely before 
posting :)

Martijn Dashorst wrote:
> Or with qi4j (http://qi4j.org)
>
> Martijn
>
> On Sat, Jun 14, 2008 at 5:37 AM, Eelco Hillenius
> <ee...@gmail.com> wrote:
>   
>>> It's good to know that when you reach the same conclusion it is a deliberate
>>> one.
>>> BTW, interfaces are useful for this, but not a necessity. Or am I the only
>>> one thinking that
>>>       
>> No, I agree with you mostly. However, I was trying (back then) to
>> define separate dimensions of components (the fact that they can be
>> rendered is one, and for form components for instance, the fact that
>> they can validate is another). If you have a bunch of useful
>> distinctions like that, you can just decorate them for specific
>> purposes. Maybe.
>>
>>     
>>> (I seem to be... hmm...). More interfaces mean even more
>>> scrolling through the I's in the javadoc, nooooo, lol.
>>>       
>> Indeed, it gets ugly pretty fast. Mixins and interfaces with
>> implementations like scala has would be wonderful here, but alas,
>> we'll have to work with Java.
>>
>> Eelco
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Martijn Dashorst <ma...@gmail.com>.
Or with qi4j (http://qi4j.org)

Martijn

On Sat, Jun 14, 2008 at 5:37 AM, Eelco Hillenius
<ee...@gmail.com> wrote:
>> It's good to know that when you reach the same conclusion it is a deliberate
>> one.
>> BTW, interfaces are useful for this, but not a necessity. Or am I the only
>> one thinking that
>
> No, I agree with you mostly. However, I was trying (back then) to
> define separate dimensions of components (the fact that they can be
> rendered is one, and for form components for instance, the fact that
> they can validate is another). If you have a bunch of useful
> distinctions like that, you can just decorate them for specific
> purposes. Maybe.
>
>> (I seem to be... hmm...). More interfaces mean even more
>> scrolling through the I's in the javadoc, nooooo, lol.
>
> Indeed, it gets ugly pretty fast. Mixins and interfaces with
> implementations like scala has would be wonderful here, but alas,
> we'll have to work with Java.
>
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Igor Vaynberg wrote:
> On Fri, Jun 13, 2008 at 2:44 PM, Matthijs Wensveen <m....@func.nl> wrote:
>   
>> By the way, the article I supplied and the article on wikipedia do just the
>> same thing. If you look at VerticalScrollBarDecorator.draw you'll see that
>> it delegates the method to the wrapped Window.
>>     
>
> decorator classes in the onjava article do not perform method
> delegation across all methods in JComponent, therefore its not a
> decorator by your own definition?
>   

It's still is a decorator, but I agree it does not do exactly as I 
thought a proper decorator should do. The delegation is still there, but 
it is hidden because the wrapped class is added as a child to the 
decorator. The super.xxx calls take care of calling the needed methods 
on the wrapped class. But this only works for hierarchies like swing.

Hmm.. if I were very puristic, I might not call this decoration at all, 
in the OO-sense of the pattern. This really just takes a component and 
puts it somewhere else. It *is* transparent to the (api) user however. 
It doesn't need to know or care this has happened, so in that sense it 
is a decorator.

Also, I did say: "It is not entirely impossible to decorate a class with 
final methods, you just can't delegate the final methods" . So, "my 
definition" does not enforce that every method should be delegated. You 
may read the words "Implementing each and every method of a class and 
delegating to another class is indeed what is needed" as "Implementing 
each and every method of a class and delegating to another class is 
indeed what is *usually / generally* needed" :)

>
>   
>> Also look at the C++ example.
>> C++ doesn't have interfaces. So, maybe this is a ui decorator as well...?
>>     
>
> actually c++ does have interfaces, they are modeled as "pure virtual"
> classes, which is what the c++ Window class in the wikipedia article
> is.
>   

Okay, but then abstract classes in java are interfaces as well :). You 
said decoration *only* works with interfaces, and there was no way for 
me to know that your notion of the term interface included classes as 
well (because then what are we even arguing about :) )

Hm, anyway, let's drop the almost religious fanaticism. We could argue 
about the definition of the term decorator all year, presumably, but 
whatever it is called, what I want can't be done in wicket because of 
some final methods that are in the way. The Link.onClick problem is 
still unsolved.

Matthijs

> -igor
>
>   
>> At
>> the end of the article there is a list of other design patterns from the GoF
>> book, unfortunately I couldn't find anything about the software decorator
>> pattern you mentioned (also googled it without avail).
>>
>> So, okay, let's end this discussion for Godwin's sake.
>>
>> I really do want to know how to add behaviour in a transparent way to an
>> existing Link's onClick method. Using Behavior or some other means. AOP is
>> an option but feels hacky just to do this (pointcuts should generally match
>> more than one joinpoint). Event listeners are another (but I won't dare
>> begin that discussion again).
>>
>> Best regards,
>> Matthijs
>>
>> Igor Vaynberg wrote:
>>     
>>> looked over the article. what they do is a ui decorator, it is not the
>>> software decorator pattern. there is no method delegation to the child
>>> component. what they create is a composite, you can do the same thing
>>> in wicket with a Border.
>>>
>>> -igor
>>>
>>> On Thu, Jun 12, 2008 at 9:55 PM, Igor Vaynberg <ig...@gmail.com>
>>> wrote:
>>>
>>>       
>>>> right. so when you would do it with a class you will actually have to
>>>> rewire all the methods to forward to the delegate instead of calling
>>>> super. that is pure insanity and does not make any sense when methods
>>>> hold logic. that is why it works with an interface, no logic for you
>>>> to override and forward to the delegate, only the message dispatch
>>>> itself. sure, technically you can do it even with a concrete class,
>>>> but you can also do a lot of other things that dont make sense.
>>>>
>>>> -igor
>>>>
>>>> On Thu, Jun 12, 2008 at 5:54 PM, Matthijs Wensveen <m....@func.nl>
>>>> wrote:
>>>>
>>>>         
>>>>> Igor Vaynberg wrote:
>>>>>
>>>>>           
>>>>>> look at the java example. notice Window is an interface.
>>>>>>
>>>>>>
>>>>>>             
>>>>> Yeah, but that's just because it's good practice to use the interface
>>>>> when
>>>>> there is one. Notice that the actually decorated class is a new
>>>>> SimpleWindow() in DecoratedWindowTest. Window might as well have been an
>>>>> abstract class, or even a concrete one. The idea is that the contract of
>>>>> the
>>>>> class you wrap is maintained, if that is an interface your decorator
>>>>> implements that, when it's a class your decorator extends it. Same idea.
>>>>> Of
>>>>> course, interfaces are cleaner and you can even decorate more then one
>>>>> interface when you want to, but decorating a class is not uncommon
>>>>> practice
>>>>> (at least where I come from).
>>>>>
>>>>> Example: http://www.onjava.com/pub/a/onjava/2003/02/05/decorator.html
>>>>>
>>>>>
>>>>>           
>>>>>> eg you cant do: add(new DecoratedComponent(someOtherComponent));
>>>>>>
>>>>>>
>>>>>>             
>>>>> No, because component has final methods that you can't override so you
>>>>> can't
>>>>> delegate to them (that whas my point), but not because you can't
>>>>> decorate a
>>>>> class.
>>>>>
>>>>> Matthijs.
>>>>>
>>>>> PS. If you insist on that you can only decorate an interface, I'll call
>>>>> it
>>>>> wrap-extend or something :)
>>>>>
>>>>>
>>>>>           
>>>>>> -igor
>>>>>>
>>>>>> On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> Why would the decorator design pattern only work with interfaces?
>>>>>>> Maybe
>>>>>>> we're talking about two different this here? (I'm talking about this
>>>>>>> one:
>>>>>>> http://en.wikipedia.org/wiki/Decorator_pattern)
>>>>>>>
>>>>>>> I can see why behaviors were introduced. A simple example: a factory
>>>>>>> method
>>>>>>> creates a link. In my subclass I want the same link with the same
>>>>>>> onClick
>>>>>>> behavior but I also want "hello" to be outputted to System.out. How
>>>>>>> would
>>>>>>> I
>>>>>>> go about doing this with a Behavior? I couldn't figure it out...
>>>>>>> (which
>>>>>>> isn't saying it's impossible).
>>>>>>>
>>>>>>> Matthijs
>>>>>>>
>>>>>>> igor.vaynberg@gmail.com wrote:
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> decorators only work with interfaces, component class is not. This is
>>>>>>>> part of the reason why we have behaviors
>>>>>>>>
>>>>>>>> -igor
>>>>>>>>
>>>>>>>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> Some useful design patterns like Decorator don't work with final
>>>>>>>>> methods. Wicket components sometimes have overridable factory
>>>>>>>>> methods
>>>>>>>>> for child components. The decorator pattern could be very useful
>>>>>>>>> here,
>>>>>>>>> because you'd be able to decorate the original component with some
>>>>>>>>> extra
>>>>>>>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>>>>>>>> work because some methods are final.
>>>>>>>>>
>>>>>>>>> Matthijs
>>>>>>>>>
>>>>>>>>> Igor Vaynberg wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> i mean generally, for methods, fields, and func args :) most of
>>>>>>>>>> this
>>>>>>>>>> stuff can stay final, but people dont bother doing it because its
>>>>>>>>>> extra typing.
>>>>>>>>>>
>>>>>>>>>> -igor
>>>>>>>>>>
>>>>>>>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>>>>>>>> <ja...@carmanconsulting.com> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>>>> You mean like C++?
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>>>>>>>> <ig...@gmail.com>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>>>>>>>
>>>>>>>>>>>> -igor
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>>>>>>>> <ma...@gmail.com> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Martijn
>>>>>>>>>>>>>
>>>>>>>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>>>>>>>> wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>                           
>>>>>>>>>>>>>> I understand the reasoning, however I think "best practice" can
>>>>>>>>>>>>>> be
>>>>>>>>>>>>>> debated.
>>>>>>>>>>>>>> To use your example Swing allows the user to override quite a
>>>>>>>>>>>>>> bit,
>>>>>>>>>>>>>> and
>>>>>>>>>>>>>> it
>>>>>>>>>>>>>> doesn't make any (or very few) assumptions on what should and
>>>>>>>>>>>>>> should
>>>>>>>>>>>>>> not be
>>>>>>>>>>>>>> done.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>>>>>>>> manipulating
>>>>>>>>>>>>>> them how I see fit. If I cause a bug that I have to deal with,
>>>>>>>>>>>>>> thats
>>>>>>>>>>>>>> *my*
>>>>>>>>>>>>>> problem to resolve.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> In my book (and I'm not the only one) excessive use of final is
>>>>>>>>>>>>>> an
>>>>>>>>>>>>>> anti-pattern.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>                             
>>>>>>>>>>>>>>> Brill,
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>>>>>>>> categories:
>>>>>>>>>>>>>>> ones designed for subclassing, and ones designed to be final.
>>>>>>>>>>>>>>> The
>>>>>>>>>>>>>>> same
>>>>>>>>>>>>>>> goes
>>>>>>>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>>>>>>>> people
>>>>>>>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>>>>>>>> subclassing in
>>>>>>>>>>>>>>> mind.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Gili
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>                               
>>>>>>>>>>>>>>>> on removing the finals
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> The final members are the worst thing I've had to deal with
>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>>>> so far.
>>>>>>>>>>>>>>>> Although I understand that there may be a reason for them,
>>>>>>>>>>>>>>>> they
>>>>>>>>>>>>>>>> are
>>>>>>>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>>>>>>>> "protect
>>>>>>>>>>>>>>>> users from themselves".
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>                                 
>>>>>>>>>>>>>>>>> Have you considered moving from subclassing to composition
>>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>>>>>>>> component
>>>>>>>>>>>>>>>>> in order
>>>>>>>>>>>>>>>>> to override isVisible() and other properties. I am proposing
>>>>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>>>>> the component classes become final and properties may only
>>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>>> set
>>>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>>>> setter methods. The setter methods would take Callable<T>
>>>>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>>> T, so
>>>>>>>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> The benefit of this approach is that you could introduce
>>>>>>>>>>>>>>>>> static
>>>>>>>>>>>>>>>>> factory
>>>>>>>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>>>>>>>> easier
>>>>>>>>>>>>>>>>> to use in
>>>>>>>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>>>>>>>> classes
>>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at
>>>>>>>>>>>>>>>>> Nabble.com.
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>>                                   
>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>                                 
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at
>>>>>>>>>>>>>>> Nabble.com.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>                               
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>                             
>>>>>>>>>>>>> --
>>>>>>>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>>>>>>>> http://wicketinaction.com
>>>>>>>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>                           
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
On Fri, Jun 13, 2008 at 2:44 PM, Matthijs Wensveen <m....@func.nl> wrote:
> By the way, the article I supplied and the article on wikipedia do just the
> same thing. If you look at VerticalScrollBarDecorator.draw you'll see that
> it delegates the method to the wrapped Window.

decorator classes in the onjava article do not perform method
delegation across all methods in JComponent, therefore its not a
decorator by your own definition?


> Also look at the C++ example.
> C++ doesn't have interfaces. So, maybe this is a ui decorator as well...?

actually c++ does have interfaces, they are modeled as "pure virtual"
classes, which is what the c++ Window class in the wikipedia article
is.

-igor

> At
> the end of the article there is a list of other design patterns from the GoF
> book, unfortunately I couldn't find anything about the software decorator
> pattern you mentioned (also googled it without avail).
>
> So, okay, let's end this discussion for Godwin's sake.
>
> I really do want to know how to add behaviour in a transparent way to an
> existing Link's onClick method. Using Behavior or some other means. AOP is
> an option but feels hacky just to do this (pointcuts should generally match
> more than one joinpoint). Event listeners are another (but I won't dare
> begin that discussion again).
>
> Best regards,
> Matthijs
>
> Igor Vaynberg wrote:
>>
>> looked over the article. what they do is a ui decorator, it is not the
>> software decorator pattern. there is no method delegation to the child
>> component. what they create is a composite, you can do the same thing
>> in wicket with a Border.
>>
>> -igor
>>
>> On Thu, Jun 12, 2008 at 9:55 PM, Igor Vaynberg <ig...@gmail.com>
>> wrote:
>>
>>>
>>> right. so when you would do it with a class you will actually have to
>>> rewire all the methods to forward to the delegate instead of calling
>>> super. that is pure insanity and does not make any sense when methods
>>> hold logic. that is why it works with an interface, no logic for you
>>> to override and forward to the delegate, only the message dispatch
>>> itself. sure, technically you can do it even with a concrete class,
>>> but you can also do a lot of other things that dont make sense.
>>>
>>> -igor
>>>
>>> On Thu, Jun 12, 2008 at 5:54 PM, Matthijs Wensveen <m....@func.nl>
>>> wrote:
>>>
>>>>
>>>> Igor Vaynberg wrote:
>>>>
>>>>>
>>>>> look at the java example. notice Window is an interface.
>>>>>
>>>>>
>>>>
>>>> Yeah, but that's just because it's good practice to use the interface
>>>> when
>>>> there is one. Notice that the actually decorated class is a new
>>>> SimpleWindow() in DecoratedWindowTest. Window might as well have been an
>>>> abstract class, or even a concrete one. The idea is that the contract of
>>>> the
>>>> class you wrap is maintained, if that is an interface your decorator
>>>> implements that, when it's a class your decorator extends it. Same idea.
>>>> Of
>>>> course, interfaces are cleaner and you can even decorate more then one
>>>> interface when you want to, but decorating a class is not uncommon
>>>> practice
>>>> (at least where I come from).
>>>>
>>>> Example: http://www.onjava.com/pub/a/onjava/2003/02/05/decorator.html
>>>>
>>>>
>>>>>
>>>>> eg you cant do: add(new DecoratedComponent(someOtherComponent));
>>>>>
>>>>>
>>>>
>>>> No, because component has final methods that you can't override so you
>>>> can't
>>>> delegate to them (that whas my point), but not because you can't
>>>> decorate a
>>>> class.
>>>>
>>>> Matthijs.
>>>>
>>>> PS. If you insist on that you can only decorate an interface, I'll call
>>>> it
>>>> wrap-extend or something :)
>>>>
>>>>
>>>>>
>>>>> -igor
>>>>>
>>>>> On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl>
>>>>> wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> Why would the decorator design pattern only work with interfaces?
>>>>>> Maybe
>>>>>> we're talking about two different this here? (I'm talking about this
>>>>>> one:
>>>>>> http://en.wikipedia.org/wiki/Decorator_pattern)
>>>>>>
>>>>>> I can see why behaviors were introduced. A simple example: a factory
>>>>>> method
>>>>>> creates a link. In my subclass I want the same link with the same
>>>>>> onClick
>>>>>> behavior but I also want "hello" to be outputted to System.out. How
>>>>>> would
>>>>>> I
>>>>>> go about doing this with a Behavior? I couldn't figure it out...
>>>>>> (which
>>>>>> isn't saying it's impossible).
>>>>>>
>>>>>> Matthijs
>>>>>>
>>>>>> igor.vaynberg@gmail.com wrote:
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> decorators only work with interfaces, component class is not. This is
>>>>>>> part of the reason why we have behaviors
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> Some useful design patterns like Decorator don't work with final
>>>>>>>> methods. Wicket components sometimes have overridable factory
>>>>>>>> methods
>>>>>>>> for child components. The decorator pattern could be very useful
>>>>>>>> here,
>>>>>>>> because you'd be able to decorate the original component with some
>>>>>>>> extra
>>>>>>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>>>>>>> work because some methods are final.
>>>>>>>>
>>>>>>>> Matthijs
>>>>>>>>
>>>>>>>> Igor Vaynberg wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> i mean generally, for methods, fields, and func args :) most of
>>>>>>>>> this
>>>>>>>>> stuff can stay final, but people dont bother doing it because its
>>>>>>>>> extra typing.
>>>>>>>>>
>>>>>>>>> -igor
>>>>>>>>>
>>>>>>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>>>>>>> <ja...@carmanconsulting.com> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> You mean like C++?
>>>>>>>>>>
>>>>>>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>>>>>>> <ig...@gmail.com>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>>>>>>
>>>>>>>>>>> -igor
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>>>>>>> <ma...@gmail.com> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>>>>>>
>>>>>>>>>>>> Martijn
>>>>>>>>>>>>
>>>>>>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>>>>>>> wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> I understand the reasoning, however I think "best practice" can
>>>>>>>>>>>>> be
>>>>>>>>>>>>> debated.
>>>>>>>>>>>>> To use your example Swing allows the user to override quite a
>>>>>>>>>>>>> bit,
>>>>>>>>>>>>> and
>>>>>>>>>>>>> it
>>>>>>>>>>>>> doesn't make any (or very few) assumptions on what should and
>>>>>>>>>>>>> should
>>>>>>>>>>>>> not be
>>>>>>>>>>>>> done.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>>>>>>> manipulating
>>>>>>>>>>>>> them how I see fit. If I cause a bug that I have to deal with,
>>>>>>>>>>>>> thats
>>>>>>>>>>>>> *my*
>>>>>>>>>>>>> problem to resolve.
>>>>>>>>>>>>>
>>>>>>>>>>>>> In my book (and I'm not the only one) excessive use of final is
>>>>>>>>>>>>> an
>>>>>>>>>>>>> anti-pattern.
>>>>>>>>>>>>>
>>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Brill,
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>>>>>>> categories:
>>>>>>>>>>>>>> ones designed for subclassing, and ones designed to be final.
>>>>>>>>>>>>>> The
>>>>>>>>>>>>>> same
>>>>>>>>>>>>>> goes
>>>>>>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>>>>>>> people
>>>>>>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>>>>>>> subclassing in
>>>>>>>>>>>>>> mind.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Gili
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> on removing the finals
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The final members are the worst thing I've had to deal with
>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>>> so far.
>>>>>>>>>>>>>>> Although I understand that there may be a reason for them,
>>>>>>>>>>>>>>> they
>>>>>>>>>>>>>>> are
>>>>>>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>>>>>>> "protect
>>>>>>>>>>>>>>> users from themselves".
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Have you considered moving from subclassing to composition
>>>>>>>>>>>>>>>> in
>>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>>>>>>> component
>>>>>>>>>>>>>>>> in order
>>>>>>>>>>>>>>>> to override isVisible() and other properties. I am proposing
>>>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>>>> the component classes become final and properties may only
>>>>>>>>>>>>>>>> be
>>>>>>>>>>>>>>>> set
>>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>>> setter methods. The setter methods would take Callable<T>
>>>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>>> T, so
>>>>>>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> The benefit of this approach is that you could introduce
>>>>>>>>>>>>>>>> static
>>>>>>>>>>>>>>>> factory
>>>>>>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>>>>>>> easier
>>>>>>>>>>>>>>>> to use in
>>>>>>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>>>>>>> classes
>>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at
>>>>>>>>>>>>>>>> Nabble.com.
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>>> For additional commands, e-mail:
>>>>>>>>>>>>>>>> users-help@wicket.apache.org
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at
>>>>>>>>>>>>>> Nabble.com.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>>>>>>> http://wicketinaction.com
>>>>>>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
I am not aware of a distinction between software decorator and ui 
decorator. But seeing as wicket is a ui framework, I'll go with ui 
decorator. Border looks somewhat like a decorator, but since it does not 
wrap another component, it is not. Also Border needs different markup 
than the component it 'decorates' which makes it nontransparent, which 
is kind of the point of decorators. I like to thing of decorators as 
classes that piggyback behavior on existing instances.

Implementing each and every method of a class and delegating to another 
class is indeed what is needed, but is certainly not insanity. If you 
use eclipse you can do this easily by adding a member field of a certain 
type, right-click it and select Source > Generate Delegate Methods. When 
decorating a class is common and intended use of that class, an API 
usually supplies a SomethingSomethingDecorator class (extends / 
implements SomethingSomething) that delegates every method by default. 
You'd then only have to subclass that class.

Calling super in methods that only implement an interface as in your 
reply is just not possible (does not even compile), you need to subclass 
in order to be able to do that.
To return to the final method argument. It is not entirely impossible to 
decorate a class with final methods, you just can't delegate the final 
methods. An important one to be able to delegate in wicket is 
MarkupContainer.add. Otherwise you'd break the hierarchy with a 
decorated MarkupContainer.

By the way, the article I supplied and the article on wikipedia do just 
the same thing. If you look at VerticalScrollBarDecorator.draw you'll 
see that it delegates the method to the wrapped Window. Also look at the 
C++ example. C++ doesn't have interfaces. So, maybe this is a ui 
decorator as well...? At the end of the article there is a list of other 
design patterns from the GoF book, unfortunately I couldn't find 
anything about the software decorator pattern you mentioned (also 
googled it without avail).

So, okay, let's end this discussion for Godwin's sake.

I really do want to know how to add behaviour in a transparent way to an 
existing Link's onClick method. Using Behavior or some other means. AOP 
is an option but feels hacky just to do this (pointcuts should generally 
match more than one joinpoint). Event listeners are another (but I won't 
dare begin that discussion again).

Best regards,
Matthijs

Igor Vaynberg wrote:
> looked over the article. what they do is a ui decorator, it is not the
> software decorator pattern. there is no method delegation to the child
> component. what they create is a composite, you can do the same thing
> in wicket with a Border.
>
> -igor
>
> On Thu, Jun 12, 2008 at 9:55 PM, Igor Vaynberg <ig...@gmail.com> wrote:
>   
>> right. so when you would do it with a class you will actually have to
>> rewire all the methods to forward to the delegate instead of calling
>> super. that is pure insanity and does not make any sense when methods
>> hold logic. that is why it works with an interface, no logic for you
>> to override and forward to the delegate, only the message dispatch
>> itself. sure, technically you can do it even with a concrete class,
>> but you can also do a lot of other things that dont make sense.
>>
>> -igor
>>
>> On Thu, Jun 12, 2008 at 5:54 PM, Matthijs Wensveen <m....@func.nl> wrote:
>>     
>>> Igor Vaynberg wrote:
>>>       
>>>> look at the java example. notice Window is an interface.
>>>>
>>>>         
>>> Yeah, but that's just because it's good practice to use the interface when
>>> there is one. Notice that the actually decorated class is a new
>>> SimpleWindow() in DecoratedWindowTest. Window might as well have been an
>>> abstract class, or even a concrete one. The idea is that the contract of the
>>> class you wrap is maintained, if that is an interface your decorator
>>> implements that, when it's a class your decorator extends it. Same idea. Of
>>> course, interfaces are cleaner and you can even decorate more then one
>>> interface when you want to, but decorating a class is not uncommon practice
>>> (at least where I come from).
>>>
>>> Example: http://www.onjava.com/pub/a/onjava/2003/02/05/decorator.html
>>>
>>>       
>>>> eg you cant do: add(new DecoratedComponent(someOtherComponent));
>>>>
>>>>         
>>> No, because component has final methods that you can't override so you can't
>>> delegate to them (that whas my point), but not because you can't decorate a
>>> class.
>>>
>>> Matthijs.
>>>
>>> PS. If you insist on that you can only decorate an interface, I'll call it
>>> wrap-extend or something :)
>>>
>>>       
>>>> -igor
>>>>
>>>> On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl>
>>>> wrote:
>>>>
>>>>         
>>>>> Why would the decorator design pattern only work with interfaces? Maybe
>>>>> we're talking about two different this here? (I'm talking about this one:
>>>>> http://en.wikipedia.org/wiki/Decorator_pattern)
>>>>>
>>>>> I can see why behaviors were introduced. A simple example: a factory
>>>>> method
>>>>> creates a link. In my subclass I want the same link with the same onClick
>>>>> behavior but I also want "hello" to be outputted to System.out. How would
>>>>> I
>>>>> go about doing this with a Behavior? I couldn't figure it out... (which
>>>>> isn't saying it's impossible).
>>>>>
>>>>> Matthijs
>>>>>
>>>>> igor.vaynberg@gmail.com wrote:
>>>>>
>>>>>           
>>>>>> decorators only work with interfaces, component class is not. This is
>>>>>> part of the reason why we have behaviors
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> Some useful design patterns like Decorator don't work with final
>>>>>>> methods. Wicket components sometimes have overridable factory methods
>>>>>>> for child components. The decorator pattern could be very useful here,
>>>>>>> because you'd be able to decorate the original component with some
>>>>>>> extra
>>>>>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>>>>>> work because some methods are final.
>>>>>>>
>>>>>>> Matthijs
>>>>>>>
>>>>>>> Igor Vaynberg wrote:
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> i mean generally, for methods, fields, and func args :) most of this
>>>>>>>> stuff can stay final, but people dont bother doing it because its
>>>>>>>> extra typing.
>>>>>>>>
>>>>>>>> -igor
>>>>>>>>
>>>>>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>>>>>> <ja...@carmanconsulting.com> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> You mean like C++?
>>>>>>>>>
>>>>>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>>>>>> <ig...@gmail.com>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>>>>>
>>>>>>>>>> -igor
>>>>>>>>>>
>>>>>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>>>>>> <ma...@gmail.com> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>>>>>
>>>>>>>>>>> Martijn
>>>>>>>>>>>
>>>>>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>>>>>> wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>>>>>>>> debated.
>>>>>>>>>>>> To use your example Swing allows the user to override quite a bit,
>>>>>>>>>>>> and
>>>>>>>>>>>> it
>>>>>>>>>>>> doesn't make any (or very few) assumptions on what should and
>>>>>>>>>>>> should
>>>>>>>>>>>> not be
>>>>>>>>>>>> done.
>>>>>>>>>>>>
>>>>>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>>>>>> manipulating
>>>>>>>>>>>> them how I see fit. If I cause a bug that I have to deal with,
>>>>>>>>>>>> thats
>>>>>>>>>>>> *my*
>>>>>>>>>>>> problem to resolve.
>>>>>>>>>>>>
>>>>>>>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>>>>>>>> anti-pattern.
>>>>>>>>>>>>
>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>
>>>>>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>>>> Brill,
>>>>>>>>>>>>>
>>>>>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>>>>>> categories:
>>>>>>>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>>>>>>>> same
>>>>>>>>>>>>> goes
>>>>>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>>>>>> people
>>>>>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>>>>>> subclassing in
>>>>>>>>>>>>> mind.
>>>>>>>>>>>>>
>>>>>>>>>>>>> Gili
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>                           
>>>>>>>>>>>>>> on removing the finals
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>> so far.
>>>>>>>>>>>>>> Although I understand that there may be a reason for them, they
>>>>>>>>>>>>>> are
>>>>>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>>>>>> "protect
>>>>>>>>>>>>>> users from themselves".
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>                             
>>>>>>>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>>>>>> component
>>>>>>>>>>>>>>> in order
>>>>>>>>>>>>>>> to override isVisible() and other properties. I am proposing
>>>>>>>>>>>>>>> that
>>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>>> the component classes become final and properties may only be
>>>>>>>>>>>>>>> set
>>>>>>>>>>>>>>> using
>>>>>>>>>>>>>>> setter methods. The setter methods would take Callable<T>
>>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>>> of
>>>>>>>>>>>>>>> T, so
>>>>>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>>>>>>>> factory
>>>>>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>>>>>> easier
>>>>>>>>>>>>>>> to use in
>>>>>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>>>>>> classes
>>>>>>>>>>>>>>> to
>>>>>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>>>>>> --
>>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>
>>>>>>>>>>>>>>>                               
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>                             
>>>>>>>>>>>>> --
>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>                           
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>> --
>>>>>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>>>>>> http://wicketinaction.com
>>>>>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
looked over the article. what they do is a ui decorator, it is not the
software decorator pattern. there is no method delegation to the child
component. what they create is a composite, you can do the same thing
in wicket with a Border.

-igor

On Thu, Jun 12, 2008 at 9:55 PM, Igor Vaynberg <ig...@gmail.com> wrote:
> right. so when you would do it with a class you will actually have to
> rewire all the methods to forward to the delegate instead of calling
> super. that is pure insanity and does not make any sense when methods
> hold logic. that is why it works with an interface, no logic for you
> to override and forward to the delegate, only the message dispatch
> itself. sure, technically you can do it even with a concrete class,
> but you can also do a lot of other things that dont make sense.
>
> -igor
>
> On Thu, Jun 12, 2008 at 5:54 PM, Matthijs Wensveen <m....@func.nl> wrote:
>> Igor Vaynberg wrote:
>>>
>>> look at the java example. notice Window is an interface.
>>>
>>
>> Yeah, but that's just because it's good practice to use the interface when
>> there is one. Notice that the actually decorated class is a new
>> SimpleWindow() in DecoratedWindowTest. Window might as well have been an
>> abstract class, or even a concrete one. The idea is that the contract of the
>> class you wrap is maintained, if that is an interface your decorator
>> implements that, when it's a class your decorator extends it. Same idea. Of
>> course, interfaces are cleaner and you can even decorate more then one
>> interface when you want to, but decorating a class is not uncommon practice
>> (at least where I come from).
>>
>> Example: http://www.onjava.com/pub/a/onjava/2003/02/05/decorator.html
>>
>>> eg you cant do: add(new DecoratedComponent(someOtherComponent));
>>>
>>
>> No, because component has final methods that you can't override so you can't
>> delegate to them (that whas my point), but not because you can't decorate a
>> class.
>>
>> Matthijs.
>>
>> PS. If you insist on that you can only decorate an interface, I'll call it
>> wrap-extend or something :)
>>
>>> -igor
>>>
>>> On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl>
>>> wrote:
>>>
>>>>
>>>> Why would the decorator design pattern only work with interfaces? Maybe
>>>> we're talking about two different this here? (I'm talking about this one:
>>>> http://en.wikipedia.org/wiki/Decorator_pattern)
>>>>
>>>> I can see why behaviors were introduced. A simple example: a factory
>>>> method
>>>> creates a link. In my subclass I want the same link with the same onClick
>>>> behavior but I also want "hello" to be outputted to System.out. How would
>>>> I
>>>> go about doing this with a Behavior? I couldn't figure it out... (which
>>>> isn't saying it's impossible).
>>>>
>>>> Matthijs
>>>>
>>>> igor.vaynberg@gmail.com wrote:
>>>>
>>>>>
>>>>> decorators only work with interfaces, component class is not. This is
>>>>> part of the reason why we have behaviors
>>>>>
>>>>> -igor
>>>>>
>>>>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> Some useful design patterns like Decorator don't work with final
>>>>>> methods. Wicket components sometimes have overridable factory methods
>>>>>> for child components. The decorator pattern could be very useful here,
>>>>>> because you'd be able to decorate the original component with some
>>>>>> extra
>>>>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>>>>> work because some methods are final.
>>>>>>
>>>>>> Matthijs
>>>>>>
>>>>>> Igor Vaynberg wrote:
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> i mean generally, for methods, fields, and func args :) most of this
>>>>>>> stuff can stay final, but people dont bother doing it because its
>>>>>>> extra typing.
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>>>>> <ja...@carmanconsulting.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> You mean like C++?
>>>>>>>>
>>>>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>>>>> <ig...@gmail.com>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>>>>
>>>>>>>>> -igor
>>>>>>>>>
>>>>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>>>>> <ma...@gmail.com> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>>>>
>>>>>>>>>> Martijn
>>>>>>>>>>
>>>>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>>>>> wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>>>>>>> debated.
>>>>>>>>>>> To use your example Swing allows the user to override quite a bit,
>>>>>>>>>>> and
>>>>>>>>>>> it
>>>>>>>>>>> doesn't make any (or very few) assumptions on what should and
>>>>>>>>>>> should
>>>>>>>>>>> not be
>>>>>>>>>>> done.
>>>>>>>>>>>
>>>>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>>>>> manipulating
>>>>>>>>>>> them how I see fit. If I cause a bug that I have to deal with,
>>>>>>>>>>> thats
>>>>>>>>>>> *my*
>>>>>>>>>>> problem to resolve.
>>>>>>>>>>>
>>>>>>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>>>>>>> anti-pattern.
>>>>>>>>>>>
>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>
>>>>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Brill,
>>>>>>>>>>>>
>>>>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>>>>> categories:
>>>>>>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>>>>>>> same
>>>>>>>>>>>> goes
>>>>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>>>>> people
>>>>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>>>>> subclassing in
>>>>>>>>>>>> mind.
>>>>>>>>>>>>
>>>>>>>>>>>> Gili
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> on removing the finals
>>>>>>>>>>>>>
>>>>>>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>> so far.
>>>>>>>>>>>>> Although I understand that there may be a reason for them, they
>>>>>>>>>>>>> are
>>>>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>>>>> "protect
>>>>>>>>>>>>> users from themselves".
>>>>>>>>>>>>>
>>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>>> using
>>>>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>>>>> component
>>>>>>>>>>>>>> in order
>>>>>>>>>>>>>> to override isVisible() and other properties. I am proposing
>>>>>>>>>>>>>> that
>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>> the component classes become final and properties may only be
>>>>>>>>>>>>>> set
>>>>>>>>>>>>>> using
>>>>>>>>>>>>>> setter methods. The setter methods would take Callable<T>
>>>>>>>>>>>>>> instead
>>>>>>>>>>>>>> of
>>>>>>>>>>>>>> T, so
>>>>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>>>>>>> factory
>>>>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>>>>> easier
>>>>>>>>>>>>>> to use in
>>>>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>>>>> classes
>>>>>>>>>>>>>> to
>>>>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>>>>> --
>>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> --
>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>>>>> http://wicketinaction.com
>>>>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by ig...@gmail.com.
LOL.

-igor

On 6/13/08, James Carman <ja...@carmanconsulting.com> wrote:
> On Fri, Jun 13, 2008 at 7:02 PM, Matthijs Wensveen <m....@func.nl>
> wrote:
>
>> It's good to know that when you reach the same conclusion it is a
>> deliberate
>> one.
>> BTW, interfaces are useful for this, but not a necessity. Or am I the only
>> one thinking that (I seem to be... hmm...). More interfaces mean even more
>> scrolling through the I's in the javadoc, nooooo, lol.
>
> Interfaces aren't required to create decorators.  Commons proxy (via
> Javassist and CGLIB) can create decorators for bean classes or
> interfaces.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
right. so when you would do it with a class you will actually have to
rewire all the methods to forward to the delegate instead of calling
super. that is pure insanity and does not make any sense when methods
hold logic. that is why it works with an interface, no logic for you
to override and forward to the delegate, only the message dispatch
itself. sure, technically you can do it even with a concrete class,
but you can also do a lot of other things that dont make sense.

-igor

On Thu, Jun 12, 2008 at 5:54 PM, Matthijs Wensveen <m....@func.nl> wrote:
> Igor Vaynberg wrote:
>>
>> look at the java example. notice Window is an interface.
>>
>
> Yeah, but that's just because it's good practice to use the interface when
> there is one. Notice that the actually decorated class is a new
> SimpleWindow() in DecoratedWindowTest. Window might as well have been an
> abstract class, or even a concrete one. The idea is that the contract of the
> class you wrap is maintained, if that is an interface your decorator
> implements that, when it's a class your decorator extends it. Same idea. Of
> course, interfaces are cleaner and you can even decorate more then one
> interface when you want to, but decorating a class is not uncommon practice
> (at least where I come from).
>
> Example: http://www.onjava.com/pub/a/onjava/2003/02/05/decorator.html
>
>> eg you cant do: add(new DecoratedComponent(someOtherComponent));
>>
>
> No, because component has final methods that you can't override so you can't
> delegate to them (that whas my point), but not because you can't decorate a
> class.
>
> Matthijs.
>
> PS. If you insist on that you can only decorate an interface, I'll call it
> wrap-extend or something :)
>
>> -igor
>>
>> On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl>
>> wrote:
>>
>>>
>>> Why would the decorator design pattern only work with interfaces? Maybe
>>> we're talking about two different this here? (I'm talking about this one:
>>> http://en.wikipedia.org/wiki/Decorator_pattern)
>>>
>>> I can see why behaviors were introduced. A simple example: a factory
>>> method
>>> creates a link. In my subclass I want the same link with the same onClick
>>> behavior but I also want "hello" to be outputted to System.out. How would
>>> I
>>> go about doing this with a Behavior? I couldn't figure it out... (which
>>> isn't saying it's impossible).
>>>
>>> Matthijs
>>>
>>> igor.vaynberg@gmail.com wrote:
>>>
>>>>
>>>> decorators only work with interfaces, component class is not. This is
>>>> part of the reason why we have behaviors
>>>>
>>>> -igor
>>>>
>>>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>>>
>>>>
>>>>>
>>>>> Some useful design patterns like Decorator don't work with final
>>>>> methods. Wicket components sometimes have overridable factory methods
>>>>> for child components. The decorator pattern could be very useful here,
>>>>> because you'd be able to decorate the original component with some
>>>>> extra
>>>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>>>> work because some methods are final.
>>>>>
>>>>> Matthijs
>>>>>
>>>>> Igor Vaynberg wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> i mean generally, for methods, fields, and func args :) most of this
>>>>>> stuff can stay final, but people dont bother doing it because its
>>>>>> extra typing.
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>>>> <ja...@carmanconsulting.com> wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> You mean like C++?
>>>>>>>
>>>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>>>> <ig...@gmail.com>
>>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>>>
>>>>>>>> -igor
>>>>>>>>
>>>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>>>> <ma...@gmail.com> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>>>
>>>>>>>>> Martijn
>>>>>>>>>
>>>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>>>> wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>>>>>> debated.
>>>>>>>>>> To use your example Swing allows the user to override quite a bit,
>>>>>>>>>> and
>>>>>>>>>> it
>>>>>>>>>> doesn't make any (or very few) assumptions on what should and
>>>>>>>>>> should
>>>>>>>>>> not be
>>>>>>>>>> done.
>>>>>>>>>>
>>>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>>>> manipulating
>>>>>>>>>> them how I see fit. If I cause a bug that I have to deal with,
>>>>>>>>>> thats
>>>>>>>>>> *my*
>>>>>>>>>> problem to resolve.
>>>>>>>>>>
>>>>>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>>>>>> anti-pattern.
>>>>>>>>>>
>>>>>>>>>> - Brill Pappin
>>>>>>>>>>
>>>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Brill,
>>>>>>>>>>>
>>>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>>>> categories:
>>>>>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>>>>>> same
>>>>>>>>>>> goes
>>>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>>>> people
>>>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>>>> subclassing in
>>>>>>>>>>> mind.
>>>>>>>>>>>
>>>>>>>>>>> Gili
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> on removing the finals
>>>>>>>>>>>>
>>>>>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>>>>>> Wicket
>>>>>>>>>>>> so far.
>>>>>>>>>>>> Although I understand that there may be a reason for them, they
>>>>>>>>>>>> are
>>>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>>>> "protect
>>>>>>>>>>>> users from themselves".
>>>>>>>>>>>>
>>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>>>>>> Wicket
>>>>>>>>>>>>> using
>>>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>>>
>>>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>>>> component
>>>>>>>>>>>>> in order
>>>>>>>>>>>>> to override isVisible() and other properties. I am proposing
>>>>>>>>>>>>> that
>>>>>>>>>>>>> instead
>>>>>>>>>>>>> the component classes become final and properties may only be
>>>>>>>>>>>>> set
>>>>>>>>>>>>> using
>>>>>>>>>>>>> setter methods. The setter methods would take Callable<T>
>>>>>>>>>>>>> instead
>>>>>>>>>>>>> of
>>>>>>>>>>>>> T, so
>>>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>>>
>>>>>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>>>>>> factory
>>>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>>>> easier
>>>>>>>>>>>>> to use in
>>>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>>>> classes
>>>>>>>>>>>>> to
>>>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>>>> --
>>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> --
>>>>>>>>>>> View this message in context:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>>>> http://wicketinaction.com
>>>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Igor Vaynberg wrote:
> look at the java example. notice Window is an interface.
>   

Yeah, but that's just because it's good practice to use the interface 
when there is one. Notice that the actually decorated class is a new 
SimpleWindow() in DecoratedWindowTest. Window might as well have been an 
abstract class, or even a concrete one. The idea is that the contract of 
the class you wrap is maintained, if that is an interface your decorator 
implements that, when it's a class your decorator extends it. Same idea. 
Of course, interfaces are cleaner and you can even decorate more then 
one interface when you want to, but decorating a class is not uncommon 
practice (at least where I come from).

Example: http://www.onjava.com/pub/a/onjava/2003/02/05/decorator.html

> eg you cant do: add(new DecoratedComponent(someOtherComponent));
>   

No, because component has final methods that you can't override so you 
can't delegate to them (that whas my point), but not because you can't 
decorate a class.

Matthijs.

PS. If you insist on that you can only decorate an interface, I'll call 
it wrap-extend or something :)

> -igor
>
> On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl> wrote:
>   
>> Why would the decorator design pattern only work with interfaces? Maybe
>> we're talking about two different this here? (I'm talking about this one:
>> http://en.wikipedia.org/wiki/Decorator_pattern)
>>
>> I can see why behaviors were introduced. A simple example: a factory method
>> creates a link. In my subclass I want the same link with the same onClick
>> behavior but I also want "hello" to be outputted to System.out. How would I
>> go about doing this with a Behavior? I couldn't figure it out... (which
>> isn't saying it's impossible).
>>
>> Matthijs
>>
>> igor.vaynberg@gmail.com wrote:
>>     
>>> decorators only work with interfaces, component class is not. This is
>>> part of the reason why we have behaviors
>>>
>>> -igor
>>>
>>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>>
>>>       
>>>> Some useful design patterns like Decorator don't work with final
>>>> methods. Wicket components sometimes have overridable factory methods
>>>> for child components. The decorator pattern could be very useful here,
>>>> because you'd be able to decorate the original component with some extra
>>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>>> work because some methods are final.
>>>>
>>>> Matthijs
>>>>
>>>> Igor Vaynberg wrote:
>>>>
>>>>         
>>>>> i mean generally, for methods, fields, and func args :) most of this
>>>>> stuff can stay final, but people dont bother doing it because its
>>>>> extra typing.
>>>>>
>>>>> -igor
>>>>>
>>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>>> <ja...@carmanconsulting.com> wrote:
>>>>>
>>>>>
>>>>>           
>>>>>> You mean like C++?
>>>>>>
>>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>>> <ig...@gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>
>>>>>>             
>>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>>
>>>>>>> -igor
>>>>>>>
>>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>>> <ma...@gmail.com> wrote:
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>>
>>>>>>>> Martijn
>>>>>>>>
>>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>>>>> debated.
>>>>>>>>> To use your example Swing allows the user to override quite a bit,
>>>>>>>>> and
>>>>>>>>> it
>>>>>>>>> doesn't make any (or very few) assumptions on what should and should
>>>>>>>>> not be
>>>>>>>>> done.
>>>>>>>>>
>>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>>> manipulating
>>>>>>>>> them how I see fit. If I cause a bug that I have to deal with, thats
>>>>>>>>> *my*
>>>>>>>>> problem to resolve.
>>>>>>>>>
>>>>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>>>>> anti-pattern.
>>>>>>>>>
>>>>>>>>> - Brill Pappin
>>>>>>>>>
>>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> Brill,
>>>>>>>>>>
>>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>>> categories:
>>>>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>>>>> same
>>>>>>>>>> goes
>>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>>> people
>>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>>> subclassing in
>>>>>>>>>> mind.
>>>>>>>>>>
>>>>>>>>>> Gili
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>>>> on removing the finals
>>>>>>>>>>>
>>>>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>>>>> Wicket
>>>>>>>>>>> so far.
>>>>>>>>>>> Although I understand that there may be a reason for them, they
>>>>>>>>>>> are
>>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>>> "protect
>>>>>>>>>>> users from themselves".
>>>>>>>>>>>
>>>>>>>>>>> - Brill Pappin
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>>>>> Wicket
>>>>>>>>>>>> using
>>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>>
>>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>>> component
>>>>>>>>>>>> in order
>>>>>>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>>>>>>> instead
>>>>>>>>>>>> the component classes become final and properties may only be set
>>>>>>>>>>>> using
>>>>>>>>>>>> setter methods. The setter methods would take Callable<T> instead
>>>>>>>>>>>> of
>>>>>>>>>>>> T, so
>>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>>
>>>>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>>>>> factory
>>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>>> easier
>>>>>>>>>>>> to use in
>>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>>> classes
>>>>>>>>>>>> to
>>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>>> --
>>>>>>>>>>>> View this message in context:
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>                         
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>                       
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>>
>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>> --
>>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>>> http://wicketinaction.com
>>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
look at the java example. notice Window is an interface.

eg you cant do: add(new DecoratedComponent(someOtherComponent));

-igor

On Thu, Jun 12, 2008 at 5:05 PM, Matthijs Wensveen <m....@func.nl> wrote:
> Why would the decorator design pattern only work with interfaces? Maybe
> we're talking about two different this here? (I'm talking about this one:
> http://en.wikipedia.org/wiki/Decorator_pattern)
>
> I can see why behaviors were introduced. A simple example: a factory method
> creates a link. In my subclass I want the same link with the same onClick
> behavior but I also want "hello" to be outputted to System.out. How would I
> go about doing this with a Behavior? I couldn't figure it out... (which
> isn't saying it's impossible).
>
> Matthijs
>
> igor.vaynberg@gmail.com wrote:
>>
>> decorators only work with interfaces, component class is not. This is
>> part of the reason why we have behaviors
>>
>> -igor
>>
>> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>>
>>>
>>> Some useful design patterns like Decorator don't work with final
>>> methods. Wicket components sometimes have overridable factory methods
>>> for child components. The decorator pattern could be very useful here,
>>> because you'd be able to decorate the original component with some extra
>>> functionality (Link.onClick for example). Unfortunately this doesn't
>>> work because some methods are final.
>>>
>>> Matthijs
>>>
>>> Igor Vaynberg wrote:
>>>
>>>>
>>>> i mean generally, for methods, fields, and func args :) most of this
>>>> stuff can stay final, but people dont bother doing it because its
>>>> extra typing.
>>>>
>>>> -igor
>>>>
>>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>>> <ja...@carmanconsulting.com> wrote:
>>>>
>>>>
>>>>>
>>>>> You mean like C++?
>>>>>
>>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg
>>>>> <ig...@gmail.com>
>>>>> wrote:
>>>>>
>>>>>
>>>>>>
>>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>>
>>>>>> -igor
>>>>>>
>>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>>> <ma...@gmail.com> wrote:
>>>>>>
>>>>>>
>>>>>>>
>>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>>
>>>>>>> Martijn
>>>>>>>
>>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca>
>>>>>>> wrote:
>>>>>>>
>>>>>>>
>>>>>>>>
>>>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>>>> debated.
>>>>>>>> To use your example Swing allows the user to override quite a bit,
>>>>>>>> and
>>>>>>>> it
>>>>>>>> doesn't make any (or very few) assumptions on what should and should
>>>>>>>> not be
>>>>>>>> done.
>>>>>>>>
>>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>>> manipulating
>>>>>>>> them how I see fit. If I cause a bug that I have to deal with, thats
>>>>>>>> *my*
>>>>>>>> problem to resolve.
>>>>>>>>
>>>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>>>> anti-pattern.
>>>>>>>>
>>>>>>>> - Brill Pappin
>>>>>>>>
>>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>>
>>>>>>>>> Brill,
>>>>>>>>>
>>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>>> categories:
>>>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>>>> same
>>>>>>>>> goes
>>>>>>>>> for methods. Swing is full of examples of what goes wrong when
>>>>>>>>> people
>>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>>> subclassing in
>>>>>>>>> mind.
>>>>>>>>>
>>>>>>>>> Gili
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> Brill Pappin wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> on removing the finals
>>>>>>>>>>
>>>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>>>> Wicket
>>>>>>>>>> so far.
>>>>>>>>>> Although I understand that there may be a reason for them, they
>>>>>>>>>> are
>>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>>> "protect
>>>>>>>>>> users from themselves".
>>>>>>>>>>
>>>>>>>>>> - Brill Pappin
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>>>> Wicket
>>>>>>>>>>> using
>>>>>>>>>>> Callable<T>?
>>>>>>>>>>>
>>>>>>>>>>> Currently it is quite common for developers to subclass a
>>>>>>>>>>> component
>>>>>>>>>>> in order
>>>>>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>>>>>> instead
>>>>>>>>>>> the component classes become final and properties may only be set
>>>>>>>>>>> using
>>>>>>>>>>> setter methods. The setter methods would take Callable<T> instead
>>>>>>>>>>> of
>>>>>>>>>>> T, so
>>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>>
>>>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>>>> factory
>>>>>>>>>>> methods to the Wicket components which would make them much
>>>>>>>>>>> easier
>>>>>>>>>>> to use in
>>>>>>>>>>> their Generic form. You could then introduce various helper
>>>>>>>>>>> classes
>>>>>>>>>>> to
>>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>>> --
>>>>>>>>>>> View this message in context:
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Become a Wicket expert, learn from the best:
>>>>>>> http://wicketinaction.com
>>>>>>> Apache Wicket 1.3.3 is released
>>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by James Carman <ja...@carmanconsulting.com>.
On Fri, Jun 13, 2008 at 7:02 PM, Matthijs Wensveen <m....@func.nl> wrote:

> It's good to know that when you reach the same conclusion it is a deliberate
> one.
> BTW, interfaces are useful for this, but not a necessity. Or am I the only
> one thinking that (I seem to be... hmm...). More interfaces mean even more
> scrolling through the I's in the javadoc, nooooo, lol.

Interfaces aren't required to create decorators.  Commons proxy (via
Javassist and CGLIB) can create decorators for bean classes or
interfaces.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Eelco Hillenius wrote:
>> It's good to know that when you reach the same conclusion it is a deliberate
>> one.
>> BTW, interfaces are useful for this, but not a necessity. Or am I the only
>> one thinking that
>>     
>
> No, I agree with you mostly. However, I was trying (back then) to
> define separate dimensions of components (the fact that they can be
> rendered is one, and for form components for instance, the fact that
> they can validate is another). If you have a bunch of useful
> distinctions like that, you can just decorate them for specific
> purposes. Maybe.
>   

Yeah. Some problem domains are better suited for this kind of 
interfacing than others. In one project we work on we have interfaces 
like PropertyHolder and TemplateHolder, but other projects keep to a 
stricter OO hierarchy with only one or two interfaces at the base (or top?)

I can see merit in interfaces like IRenderable and IValidatable. An 
interface for lifecycle could be useful too. One problem could be that 
when only Component (or somesuch) implements all the useful interfaces, 
people are never going to implement one of the interfaces themselves. An 
interesting framework could be Qi4J, to be able to independently 
implement the interfaces. They gave a presentation at the wicket meetup 
in amsterdam (I wasn't there, but heard about it and looked it up).

>   
>> (I seem to be... hmm...). More interfaces mean even more
>> scrolling through the I's in the javadoc, nooooo, lol.
>>     
>
> Indeed, it gets ugly pretty fast. Mixins and interfaces with
> implementations like scala has would be wonderful here, but alas,
> we'll have to work with Java.
>   

Java is not so bad. We'll just have to wait until someone writes a 
java2scala conversion app :)
> Eelco
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Eelco Hillenius <ee...@gmail.com>.
> It's good to know that when you reach the same conclusion it is a deliberate
> one.
> BTW, interfaces are useful for this, but not a necessity. Or am I the only
> one thinking that

No, I agree with you mostly. However, I was trying (back then) to
define separate dimensions of components (the fact that they can be
rendered is one, and for form components for instance, the fact that
they can validate is another). If you have a bunch of useful
distinctions like that, you can just decorate them for specific
purposes. Maybe.

> (I seem to be... hmm...). More interfaces mean even more
> scrolling through the I's in the javadoc, nooooo, lol.

Indeed, it gets ugly pretty fast. Mixins and interfaces with
implementations like scala has would be wonderful here, but alas,
we'll have to work with Java.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Eelco Hillenius wrote:
>> True, it's been weighing the disadvantages vs the advantages, and so
>> far, ensuring that we wouldn't paint ourselves in the corner too
>> quickly won over flexibility.
>>     
>
> To make this 'painless' though, we'd probably need a whole bunch of
> interfaces. We've looked into moving to a more interface based
> approach in the past for Wicket, but we concluded that it just got too
> crazy, increasing the complexity of the API considerably, and had all
> the disadvantages of interfaces over abstract classes (no guaranteed
> behavior, everything has to be public and abstract). We might just
> come to that same conclusion again.

It's good to know that when you reach the same conclusion it is a 
deliberate one.
BTW, interfaces are useful for this, but not a necessity. Or am I the 
only one thinking that (I seem to be... hmm...). More interfaces mean 
even more scrolling through the I's in the javadoc, nooooo, lol.

Matthijs


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Eelco Hillenius <ee...@gmail.com>.
> True, it's been weighing the disadvantages vs the advantages, and so
> far, ensuring that we wouldn't paint ourselves in the corner too
> quickly won over flexibility.

To make this 'painless' though, we'd probably need a whole bunch of
interfaces. We've looked into moving to a more interface based
approach in the past for Wicket, but we concluded that it just got too
crazy, increasing the complexity of the API considerably, and had all
the disadvantages of interfaces over abstract classes (no guaranteed
behavior, everything has to be public and abstract). We might just
come to that same conclusion again.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Eelco Hillenius <ee...@gmail.com>.
...
> this into consideration with the next major API

... revision (1.5)

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Eelco Hillenius <ee...@gmail.com>.
On Thu, Jun 12, 2008 at 2:06 PM, Matthijs Wensveen <m....@func.nl> wrote:
> Some useful design patterns like Decorator don't work with final methods.
> Wicket components sometimes have overridable factory methods for child
> components. The decorator pattern could be very useful here, because you'd
> be able to decorate the original component with some extra functionality
> (Link.onClick for example). Unfortunately this doesn't work because some
> methods are final.

True, it's been weighing the disadvantages vs the advantages, and so
far, ensuring that we wouldn't paint ourselves in the corner too
quickly won over flexibility. I think it would be a good idea to take
this into consideration with the next major API.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Why would the decorator design pattern only work with interfaces? Maybe 
we're talking about two different this here? (I'm talking about this 
one: http://en.wikipedia.org/wiki/Decorator_pattern)

I can see why behaviors were introduced. A simple example: a factory 
method creates a link. In my subclass I want the same link with the same 
onClick behavior but I also want "hello" to be outputted to System.out. 
How would I go about doing this with a Behavior? I couldn't figure it 
out... (which isn't saying it's impossible).

Matthijs

igor.vaynberg@gmail.com wrote:
> decorators only work with interfaces, component class is not. This is
> part of the reason why we have behaviors
>
> -igor
>
> On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
>   
>> Some useful design patterns like Decorator don't work with final
>> methods. Wicket components sometimes have overridable factory methods
>> for child components. The decorator pattern could be very useful here,
>> because you'd be able to decorate the original component with some extra
>> functionality (Link.onClick for example). Unfortunately this doesn't
>> work because some methods are final.
>>
>> Matthijs
>>
>> Igor Vaynberg wrote:
>>     
>>> i mean generally, for methods, fields, and func args :) most of this
>>> stuff can stay final, but people dont bother doing it because its
>>> extra typing.
>>>
>>> -igor
>>>
>>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>>> <ja...@carmanconsulting.com> wrote:
>>>
>>>       
>>>> You mean like C++?
>>>>
>>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg <ig...@gmail.com>
>>>> wrote:
>>>>
>>>>         
>>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>>
>>>>> -igor
>>>>>
>>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>>> <ma...@gmail.com> wrote:
>>>>>
>>>>>           
>>>>>> Without the use of final wicket would not have made it this far.
>>>>>>
>>>>>> Martijn
>>>>>>
>>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>>>>>>
>>>>>>             
>>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>>> debated.
>>>>>>> To use your example Swing allows the user to override quite a bit, and
>>>>>>> it
>>>>>>> doesn't make any (or very few) assumptions on what should and should
>>>>>>> not be
>>>>>>> done.
>>>>>>>
>>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>>> manipulating
>>>>>>> them how I see fit. If I cause a bug that I have to deal with, thats
>>>>>>> *my*
>>>>>>> problem to resolve.
>>>>>>>
>>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>>> anti-pattern.
>>>>>>>
>>>>>>> - Brill Pappin
>>>>>>>
>>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>>>> Brill,
>>>>>>>>
>>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>>> categories:
>>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>>> same
>>>>>>>> goes
>>>>>>>> for methods. Swing is full of examples of what goes wrong when people
>>>>>>>> override methods in classes that haven't been designed with
>>>>>>>> subclassing in
>>>>>>>> mind.
>>>>>>>>
>>>>>>>> Gili
>>>>>>>>
>>>>>>>>
>>>>>>>> Brill Pappin wrote:
>>>>>>>>
>>>>>>>>                 
>>>>>>>>> on removing the finals
>>>>>>>>>
>>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>>> Wicket
>>>>>>>>> so far.
>>>>>>>>> Although I understand that there may be a reason for them, they are
>>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>>> "protect
>>>>>>>>> users from themselves".
>>>>>>>>>
>>>>>>>>> - Brill Pappin
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>>> Wicket
>>>>>>>>>> using
>>>>>>>>>> Callable<T>?
>>>>>>>>>>
>>>>>>>>>> Currently it is quite common for developers to subclass a component
>>>>>>>>>> in order
>>>>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>>>>> instead
>>>>>>>>>> the component classes become final and properties may only be set
>>>>>>>>>> using
>>>>>>>>>> setter methods. The setter methods would take Callable<T> instead
>>>>>>>>>> of
>>>>>>>>>> T, so
>>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>>
>>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>>> factory
>>>>>>>>>> methods to the Wicket components which would make them much easier
>>>>>>>>>> to use in
>>>>>>>>>> their Generic form. You could then introduce various helper classes
>>>>>>>>>> to
>>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>>> --
>>>>>>>>>> View this message in context:
>>>>>>>>>>
>>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>                     
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>
>>>>>>>>>                   
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> --
>>>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>>>> Apache Wicket 1.3.3 is released
>>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>>           
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by ig...@gmail.com.
decorators only work with interfaces, component class is not. This is
part of the reason why we have behaviors

-igor

On 6/12/08, Matthijs Wensveen <m....@func.nl> wrote:
> Some useful design patterns like Decorator don't work with final
> methods. Wicket components sometimes have overridable factory methods
> for child components. The decorator pattern could be very useful here,
> because you'd be able to decorate the original component with some extra
> functionality (Link.onClick for example). Unfortunately this doesn't
> work because some methods are final.
>
> Matthijs
>
> Igor Vaynberg wrote:
>> i mean generally, for methods, fields, and func args :) most of this
>> stuff can stay final, but people dont bother doing it because its
>> extra typing.
>>
>> -igor
>>
>> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
>> <ja...@carmanconsulting.com> wrote:
>>
>>> You mean like C++?
>>>
>>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg <ig...@gmail.com>
>>> wrote:
>>>
>>>> indeed. i wouldnt mind if final was the default in java :)
>>>>
>>>> -igor
>>>>
>>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>>> <ma...@gmail.com> wrote:
>>>>
>>>>> Without the use of final wicket would not have made it this far.
>>>>>
>>>>> Martijn
>>>>>
>>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>>>>>
>>>>>> I understand the reasoning, however I think "best practice" can be
>>>>>> debated.
>>>>>> To use your example Swing allows the user to override quite a bit, and
>>>>>> it
>>>>>> doesn't make any (or very few) assumptions on what should and should
>>>>>> not be
>>>>>> done.
>>>>>>
>>>>>> I don't like API's that assume I'm an idiot and prevent me from
>>>>>> manipulating
>>>>>> them how I see fit. If I cause a bug that I have to deal with, thats
>>>>>> *my*
>>>>>> problem to resolve.
>>>>>>
>>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>>> anti-pattern.
>>>>>>
>>>>>> - Brill Pappin
>>>>>>
>>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>>
>>>>>>
>>>>>>> Brill,
>>>>>>>
>>>>>>> This is actually an API "best practice". Classes fall into two
>>>>>>> categories:
>>>>>>> ones designed for subclassing, and ones designed to be final. The
>>>>>>> same
>>>>>>> goes
>>>>>>> for methods. Swing is full of examples of what goes wrong when people
>>>>>>> override methods in classes that haven't been designed with
>>>>>>> subclassing in
>>>>>>> mind.
>>>>>>>
>>>>>>> Gili
>>>>>>>
>>>>>>>
>>>>>>> Brill Pappin wrote:
>>>>>>>
>>>>>>>> on removing the finals
>>>>>>>>
>>>>>>>> The final members are the worst thing I've had to deal with in
>>>>>>>> Wicket
>>>>>>>> so far.
>>>>>>>> Although I understand that there may be a reason for them, they are
>>>>>>>> more a hinderance than anything else and seem to be trying to
>>>>>>>> "protect
>>>>>>>> users from themselves".
>>>>>>>>
>>>>>>>> - Brill Pappin
>>>>>>>>
>>>>>>>>
>>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>>
>>>>>>>>
>>>>>>>>> Have you considered moving from subclassing to composition in
>>>>>>>>> Wicket
>>>>>>>>> using
>>>>>>>>> Callable<T>?
>>>>>>>>>
>>>>>>>>> Currently it is quite common for developers to subclass a component
>>>>>>>>> in order
>>>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>>>> instead
>>>>>>>>> the component classes become final and properties may only be set
>>>>>>>>> using
>>>>>>>>> setter methods. The setter methods would take Callable<T> instead
>>>>>>>>> of
>>>>>>>>> T, so
>>>>>>>>> for example setVisible(boolean) would become
>>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>>
>>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>>> factory
>>>>>>>>> methods to the Wicket components which would make them much easier
>>>>>>>>> to use in
>>>>>>>>> their Generic form. You could then introduce various helper classes
>>>>>>>>> to
>>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>>> Callable.valueOf(true) would
>>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>>
>>>>>>>>>
>>>>>>>>> ---------------------------------------------------------------------
>>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>>
>>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>>> Apache Wicket 1.3.3 is released
>>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matthijs Wensveen <m....@func.nl>.
Some useful design patterns like Decorator don't work with final 
methods. Wicket components sometimes have overridable factory methods 
for child components. The decorator pattern could be very useful here, 
because you'd be able to decorate the original component with some extra 
functionality (Link.onClick for example). Unfortunately this doesn't 
work because some methods are final.

Matthijs

Igor Vaynberg wrote:
> i mean generally, for methods, fields, and func args :) most of this
> stuff can stay final, but people dont bother doing it because its
> extra typing.
>
> -igor
>
> On Thu, Jun 12, 2008 at 8:38 AM, James Carman
> <ja...@carmanconsulting.com> wrote:
>   
>> You mean like C++?
>>
>> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg <ig...@gmail.com> wrote:
>>     
>>> indeed. i wouldnt mind if final was the default in java :)
>>>
>>> -igor
>>>
>>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>>> <ma...@gmail.com> wrote:
>>>       
>>>> Without the use of final wicket would not have made it this far.
>>>>
>>>> Martijn
>>>>
>>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>>>>         
>>>>> I understand the reasoning, however I think "best practice" can be debated.
>>>>> To use your example Swing allows the user to override quite a bit, and it
>>>>> doesn't make any (or very few) assumptions on what should and should not be
>>>>> done.
>>>>>
>>>>> I don't like API's that assume I'm an idiot and prevent me from manipulating
>>>>> them how I see fit. If I cause a bug that I have to deal with, thats *my*
>>>>> problem to resolve.
>>>>>
>>>>> In my book (and I'm not the only one) excessive use of final is an
>>>>> anti-pattern.
>>>>>
>>>>> - Brill Pappin
>>>>>
>>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>>
>>>>>           
>>>>>> Brill,
>>>>>>
>>>>>> This is actually an API "best practice". Classes fall into two categories:
>>>>>> ones designed for subclassing, and ones designed to be final. The same
>>>>>> goes
>>>>>> for methods. Swing is full of examples of what goes wrong when people
>>>>>> override methods in classes that haven't been designed with subclassing in
>>>>>> mind.
>>>>>>
>>>>>> Gili
>>>>>>
>>>>>>
>>>>>> Brill Pappin wrote:
>>>>>>             
>>>>>>> on removing the finals
>>>>>>>
>>>>>>> The final members are the worst thing I've had to deal with in Wicket
>>>>>>> so far.
>>>>>>> Although I understand that there may be a reason for them, they are
>>>>>>> more a hinderance than anything else and seem to be trying to "protect
>>>>>>> users from themselves".
>>>>>>>
>>>>>>> - Brill Pappin
>>>>>>>
>>>>>>>
>>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>>
>>>>>>>               
>>>>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>>>>> using
>>>>>>>> Callable<T>?
>>>>>>>>
>>>>>>>> Currently it is quite common for developers to subclass a component
>>>>>>>> in order
>>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>>> instead
>>>>>>>> the component classes become final and properties may only be set
>>>>>>>> using
>>>>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>>>>> T, so
>>>>>>>> for example setVisible(boolean) would become
>>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>>
>>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>>> factory
>>>>>>>> methods to the Wicket components which would make them much easier
>>>>>>>> to use in
>>>>>>>> their Generic form. You could then introduce various helper classes to
>>>>>>>> create Callable<T> for constant values, such as
>>>>>>>> Callable.valueOf(true) would
>>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>>> --
>>>>>>>> View this message in context:
>>>>>>>>
>>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>>
>>>>>>>>
>>>>>>>> ---------------------------------------------------------------------
>>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>>
>>>>>>>>                 
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>               
>>>>>> --
>>>>>> View this message in context:
>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>             
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>           
>>>>
>>>> --
>>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>>> Apache Wicket 1.3.3 is released
>>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>         
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>     
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
i mean generally, for methods, fields, and func args :) most of this
stuff can stay final, but people dont bother doing it because its
extra typing.

-igor

On Thu, Jun 12, 2008 at 8:38 AM, James Carman
<ja...@carmanconsulting.com> wrote:
> You mean like C++?
>
> On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg <ig...@gmail.com> wrote:
>> indeed. i wouldnt mind if final was the default in java :)
>>
>> -igor
>>
>> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
>> <ma...@gmail.com> wrote:
>>> Without the use of final wicket would not have made it this far.
>>>
>>> Martijn
>>>
>>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>>>> I understand the reasoning, however I think "best practice" can be debated.
>>>> To use your example Swing allows the user to override quite a bit, and it
>>>> doesn't make any (or very few) assumptions on what should and should not be
>>>> done.
>>>>
>>>> I don't like API's that assume I'm an idiot and prevent me from manipulating
>>>> them how I see fit. If I cause a bug that I have to deal with, thats *my*
>>>> problem to resolve.
>>>>
>>>> In my book (and I'm not the only one) excessive use of final is an
>>>> anti-pattern.
>>>>
>>>> - Brill Pappin
>>>>
>>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>>
>>>>>
>>>>> Brill,
>>>>>
>>>>> This is actually an API "best practice". Classes fall into two categories:
>>>>> ones designed for subclassing, and ones designed to be final. The same
>>>>> goes
>>>>> for methods. Swing is full of examples of what goes wrong when people
>>>>> override methods in classes that haven't been designed with subclassing in
>>>>> mind.
>>>>>
>>>>> Gili
>>>>>
>>>>>
>>>>> Brill Pappin wrote:
>>>>>>
>>>>>> on removing the finals
>>>>>>
>>>>>> The final members are the worst thing I've had to deal with in Wicket
>>>>>> so far.
>>>>>> Although I understand that there may be a reason for them, they are
>>>>>> more a hinderance than anything else and seem to be trying to "protect
>>>>>> users from themselves".
>>>>>>
>>>>>> - Brill Pappin
>>>>>>
>>>>>>
>>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>>>> using
>>>>>>> Callable<T>?
>>>>>>>
>>>>>>> Currently it is quite common for developers to subclass a component
>>>>>>> in order
>>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>>> instead
>>>>>>> the component classes become final and properties may only be set
>>>>>>> using
>>>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>>>> T, so
>>>>>>> for example setVisible(boolean) would become
>>>>>>> setVisible(Callable<Boolean>)
>>>>>>>
>>>>>>> The benefit of this approach is that you could introduce static
>>>>>>> factory
>>>>>>> methods to the Wicket components which would make them much easier
>>>>>>> to use in
>>>>>>> their Generic form. You could then introduce various helper classes to
>>>>>>> create Callable<T> for constant values, such as
>>>>>>> Callable.valueOf(true) would
>>>>>>> return a Callable<Boolean> that always returns true.
>>>>>>> --
>>>>>>> View this message in context:
>>>>>>>
>>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>>
>>>>>>>
>>>>>>> ---------------------------------------------------------------------
>>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> --
>>>>> View this message in context:
>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>
>>>
>>>
>>> --
>>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>>> Apache Wicket 1.3.3 is released
>>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by James Carman <ja...@carmanconsulting.com>.
You mean like C++?

On Thu, Jun 12, 2008 at 11:35 AM, Igor Vaynberg <ig...@gmail.com> wrote:
> indeed. i wouldnt mind if final was the default in java :)
>
> -igor
>
> On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
> <ma...@gmail.com> wrote:
>> Without the use of final wicket would not have made it this far.
>>
>> Martijn
>>
>> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>>> I understand the reasoning, however I think "best practice" can be debated.
>>> To use your example Swing allows the user to override quite a bit, and it
>>> doesn't make any (or very few) assumptions on what should and should not be
>>> done.
>>>
>>> I don't like API's that assume I'm an idiot and prevent me from manipulating
>>> them how I see fit. If I cause a bug that I have to deal with, thats *my*
>>> problem to resolve.
>>>
>>> In my book (and I'm not the only one) excessive use of final is an
>>> anti-pattern.
>>>
>>> - Brill Pappin
>>>
>>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>>
>>>>
>>>> Brill,
>>>>
>>>> This is actually an API "best practice". Classes fall into two categories:
>>>> ones designed for subclassing, and ones designed to be final. The same
>>>> goes
>>>> for methods. Swing is full of examples of what goes wrong when people
>>>> override methods in classes that haven't been designed with subclassing in
>>>> mind.
>>>>
>>>> Gili
>>>>
>>>>
>>>> Brill Pappin wrote:
>>>>>
>>>>> on removing the finals
>>>>>
>>>>> The final members are the worst thing I've had to deal with in Wicket
>>>>> so far.
>>>>> Although I understand that there may be a reason for them, they are
>>>>> more a hinderance than anything else and seem to be trying to "protect
>>>>> users from themselves".
>>>>>
>>>>> - Brill Pappin
>>>>>
>>>>>
>>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>>> using
>>>>>> Callable<T>?
>>>>>>
>>>>>> Currently it is quite common for developers to subclass a component
>>>>>> in order
>>>>>> to override isVisible() and other properties. I am proposing that
>>>>>> instead
>>>>>> the component classes become final and properties may only be set
>>>>>> using
>>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>>> T, so
>>>>>> for example setVisible(boolean) would become
>>>>>> setVisible(Callable<Boolean>)
>>>>>>
>>>>>> The benefit of this approach is that you could introduce static
>>>>>> factory
>>>>>> methods to the Wicket components which would make them much easier
>>>>>> to use in
>>>>>> their Generic form. You could then introduce various helper classes to
>>>>>> create Callable<T> for constant values, such as
>>>>>> Callable.valueOf(true) would
>>>>>> return a Callable<Boolean> that always returns true.
>>>>>> --
>>>>>> View this message in context:
>>>>>>
>>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>>
>>>>>>
>>>>>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>>
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>>
>>>>>
>>>>
>>>> --
>>>> View this message in context:
>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>
>>
>>
>> --
>> Become a Wicket expert, learn from the best: http://wicketinaction.com
>> Apache Wicket 1.3.3 is released
>> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
indeed. i wouldnt mind if final was the default in java :)

-igor

On Thu, Jun 12, 2008 at 8:18 AM, Martijn Dashorst
<ma...@gmail.com> wrote:
> Without the use of final wicket would not have made it this far.
>
> Martijn
>
> On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
>> I understand the reasoning, however I think "best practice" can be debated.
>> To use your example Swing allows the user to override quite a bit, and it
>> doesn't make any (or very few) assumptions on what should and should not be
>> done.
>>
>> I don't like API's that assume I'm an idiot and prevent me from manipulating
>> them how I see fit. If I cause a bug that I have to deal with, thats *my*
>> problem to resolve.
>>
>> In my book (and I'm not the only one) excessive use of final is an
>> anti-pattern.
>>
>> - Brill Pappin
>>
>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>
>>>
>>> Brill,
>>>
>>> This is actually an API "best practice". Classes fall into two categories:
>>> ones designed for subclassing, and ones designed to be final. The same
>>> goes
>>> for methods. Swing is full of examples of what goes wrong when people
>>> override methods in classes that haven't been designed with subclassing in
>>> mind.
>>>
>>> Gili
>>>
>>>
>>> Brill Pappin wrote:
>>>>
>>>> on removing the finals
>>>>
>>>> The final members are the worst thing I've had to deal with in Wicket
>>>> so far.
>>>> Although I understand that there may be a reason for them, they are
>>>> more a hinderance than anything else and seem to be trying to "protect
>>>> users from themselves".
>>>>
>>>> - Brill Pappin
>>>>
>>>>
>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>
>>>>>
>>>>>
>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>> using
>>>>> Callable<T>?
>>>>>
>>>>> Currently it is quite common for developers to subclass a component
>>>>> in order
>>>>> to override isVisible() and other properties. I am proposing that
>>>>> instead
>>>>> the component classes become final and properties may only be set
>>>>> using
>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>> T, so
>>>>> for example setVisible(boolean) would become
>>>>> setVisible(Callable<Boolean>)
>>>>>
>>>>> The benefit of this approach is that you could introduce static
>>>>> factory
>>>>> methods to the Wicket components which would make them much easier
>>>>> to use in
>>>>> their Generic form. You could then introduce various helper classes to
>>>>> create Callable<T> for constant values, such as
>>>>> Callable.valueOf(true) would
>>>>> return a Callable<Boolean> that always returns true.
>>>>> --
>>>>> View this message in context:
>>>>>
>>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>
>
>
> --
> Become a Wicket expert, learn from the best: http://wicketinaction.com
> Apache Wicket 1.3.3 is released
> Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Martijn Dashorst <ma...@gmail.com>.
Without the use of final wicket would not have made it this far.

Martijn

On Thu, Jun 12, 2008 at 5:08 PM, Brill Pappin <br...@pappin.ca> wrote:
> I understand the reasoning, however I think "best practice" can be debated.
> To use your example Swing allows the user to override quite a bit, and it
> doesn't make any (or very few) assumptions on what should and should not be
> done.
>
> I don't like API's that assume I'm an idiot and prevent me from manipulating
> them how I see fit. If I cause a bug that I have to deal with, thats *my*
> problem to resolve.
>
> In my book (and I'm not the only one) excessive use of final is an
> anti-pattern.
>
> - Brill Pappin
>
> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>
>>
>> Brill,
>>
>> This is actually an API "best practice". Classes fall into two categories:
>> ones designed for subclassing, and ones designed to be final. The same
>> goes
>> for methods. Swing is full of examples of what goes wrong when people
>> override methods in classes that haven't been designed with subclassing in
>> mind.
>>
>> Gili
>>
>>
>> Brill Pappin wrote:
>>>
>>> on removing the finals
>>>
>>> The final members are the worst thing I've had to deal with in Wicket
>>> so far.
>>> Although I understand that there may be a reason for them, they are
>>> more a hinderance than anything else and seem to be trying to "protect
>>> users from themselves".
>>>
>>> - Brill Pappin
>>>
>>>
>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>
>>>>
>>>>
>>>> Have you considered moving from subclassing to composition in Wicket
>>>> using
>>>> Callable<T>?
>>>>
>>>> Currently it is quite common for developers to subclass a component
>>>> in order
>>>> to override isVisible() and other properties. I am proposing that
>>>> instead
>>>> the component classes become final and properties may only be set
>>>> using
>>>> setter methods. The setter methods would take Callable<T> instead of
>>>> T, so
>>>> for example setVisible(boolean) would become
>>>> setVisible(Callable<Boolean>)
>>>>
>>>> The benefit of this approach is that you could introduce static
>>>> factory
>>>> methods to the Wicket components which would make them much easier
>>>> to use in
>>>> their Generic form. You could then introduce various helper classes to
>>>> create Callable<T> for constant values, such as
>>>> Callable.valueOf(true) would
>>>> return a Callable<Boolean> that always returns true.
>>>> --
>>>> View this message in context:
>>>>
>>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> --
>> View this message in context:
>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>



-- 
Become a Wicket expert, learn from the best: http://wicketinaction.com
Apache Wicket 1.3.3 is released
Get it now: http://www.apache.org/dyn/closer.cgi/wicket/1.3.3

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Making Component easier to Generify

Posted by "Zappaterrini, Larry" <La...@fnis.com>.
Could I dig this one back up then ;)

http://www.nabble.com/Creating-Custom-Form-Components-td16159841.html#a1
6159841

Basically my request was to remove final from
FormComponent.add(IValidator...) to aid in creating custom form
component subclasses based on precedent with Component.add(IBehavior...)

-----Original Message-----
From: Eelco Hillenius [mailto:eelco.hillenius@gmail.com] 
Sent: Thursday, June 12, 2008 12:51 PM
To: users@wicket.apache.org
Subject: Re: Making Component easier to Generify

> However, I am *in no way asking* the developers to reverse the "final"
> policy.

We actually relaxed that way more as we felt more confident about
Wicket's API and as motivated requests came in. Personally, I think
using final or not should be a deliberate choice (not automatic). If
you never use it, you can arrive to that evolutionary dead-end pretty
quickly (or indeed will have to break clients all the time), but if
you over-use it, your framework will lack flexibility. Anyway, IF you
stumble upon a final in a place where you'd like to see it go, you can
always send a motivated request for that. We've typically been willing
to remove finals when a good motivation was given.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

______________

The information contained in this message is proprietary and/or confidential. If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, 
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, 
please be aware that any message addressed to our domain is subject to archiving and review by 
persons other than the intended recipient. Thank you.
_____________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Eelco Hillenius <ee...@gmail.com>.
> However, I am *in no way asking* the developers to reverse the "final"
> policy.

We actually relaxed that way more as we felt more confident about
Wicket's API and as motivated requests came in. Personally, I think
using final or not should be a deliberate choice (not automatic). If
you never use it, you can arrive to that evolutionary dead-end pretty
quickly (or indeed will have to break clients all the time), but if
you over-use it, your framework will lack flexibility. Anyway, IF you
stumble upon a final in a place where you'd like to see it go, you can
always send a motivated request for that. We've typically been willing
to remove finals when a good motivation was given.

Eelco

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Igor Vaynberg <ig...@gmail.com>.
On Thu, Jun 12, 2008 at 9:00 AM, Brill Pappin <br...@pappin.ca> wrote:
> That is the most compelling argument I have ever heard (maintainability
> going forward).
> saying "i like this by default" as most have done is no argument at all :)

i suppose whenever you write any method that is consumed by hundreds
of other developers you put a lot of thought and analysis into all the
usecases for which those hundreds of developers will override this
method. you think of all the corner cases, and all the things that can
go wrong. you do all this by default right? no, you dont? then it is
much better to make the method final by default, and once you have
done all of the above and made sure that it will all work then remove
the final.

-igor

>
> However I disagree "best" is final by default... it should be the other way
> around, where things are only marked final if there is a good and immediate
> reason to do so.
>
> Although the debate is long and about as convoluted as the debate of
> hungarian notation was, personal experience suggests that everything final
> causes more problems than it's worth (I consider the Quartz API to be poor
> for that reason also).
>
> However, I am *in no way asking* the developers to reverse the "final"
> policy. its working, and working fairly well. I think I may have started a
> thread here that is less than productive and unless others feel that there
> needs to be a debate on the issue, I'll let it drop.
>
> - Brill Pappin
>
> On 12-Jun-08, at 11:50 AM, Zappaterrini, Larry wrote:
>
>> It is not about assuming anyone is an idiot. It is about preserving
>> maintainability and allowing an API to evolve without breaking client
>> code. The best approach is to mark members as final unless there is a
>> compelling reason not to. Final is a safeguard for APIs to know what
>> behavior is guaranteed to persist as development and evolution of the
>> API is carried out. Occasionally a user can come up with a good argument
>> for removing the final restriction and makes their case, affecting a
>> change.
>>
>> It is very easy to create an evolutionary dead end for an API by
>> allowing everything to be overridden. So either deprecate and start over
>> or risk breaking client code and have your users hate you for it :)
>>
>> -----Original Message-----
>> From: Brill Pappin [mailto:brill@pappin.ca]
>> Sent: Thursday, June 12, 2008 11:09 AM
>> To: users@wicket.apache.org
>> Subject: Re: Making Component easier to Generify
>>
>> I understand the reasoning, however I think "best practice" can be
>> debated.
>> To use your example Swing allows the user to override quite a bit, and
>> it doesn't make any (or very few) assumptions on what should and
>> should not be done.
>>
>> I don't like API's that assume I'm an idiot and prevent me from
>> manipulating them how I see fit. If I cause a bug that I have to deal
>> with, thats *my* problem to resolve.
>>
>> In my book (and I'm not the only one) excessive use of final is an
>> anti-pattern.
>>
>> - Brill Pappin
>>
>> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>>
>>>
>>> Brill,
>>>
>>> This is actually an API "best practice". Classes fall into two
>>> categories:
>>> ones designed for subclassing, and ones designed to be final. The
>>> same goes
>>> for methods. Swing is full of examples of what goes wrong when people
>>> override methods in classes that haven't been designed with
>>> subclassing in
>>> mind.
>>>
>>> Gili
>>>
>>>
>>> Brill Pappin wrote:
>>>>
>>>> on removing the finals
>>>>
>>>> The final members are the worst thing I've had to deal with in Wicket
>>>> so far.
>>>> Although I understand that there may be a reason for them, they are
>>>> more a hinderance than anything else and seem to be trying to
>>>> "protect
>>>> users from themselves".
>>>>
>>>> - Brill Pappin
>>>>
>>>>
>>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>>
>>>>>
>>>>>
>>>>> Have you considered moving from subclassing to composition in Wicket
>>>>> using
>>>>> Callable<T>?
>>>>>
>>>>> Currently it is quite common for developers to subclass a component
>>>>> in order
>>>>> to override isVisible() and other properties. I am proposing that
>>>>> instead
>>>>> the component classes become final and properties may only be set
>>>>> using
>>>>> setter methods. The setter methods would take Callable<T> instead of
>>>>> T, so
>>>>> for example setVisible(boolean) would become
>>>>> setVisible(Callable<Boolean>)
>>>>>
>>>>> The benefit of this approach is that you could introduce static
>>>>> factory
>>>>> methods to the Wicket components which would make them much easier
>>>>> to use in
>>>>> their Generic form. You could then introduce various helper
>>>>> classes to
>>>>> create Callable<T> for constant values, such as
>>>>> Callable.valueOf(true) would
>>>>> return a Callable<Boolean> that always returns true.
>>>>> --
>>>>> View this message in context:
>>>>>
>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-yo
>> ur-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>>>
>>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>>
>> ---------------------------------------------------------------------
>>>>>
>>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>>
>>>>
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>
>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-yo
>> ur-take-on-generics-with-Wicket-tp17589984p17800710.html
>>>
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>> ______________
>>
>> The information contained in this message is proprietary and/or
>> confidential. If you are not the
>> intended recipient, please: (i) delete the message and all copies; (ii) do
>> not disclose,
>> distribute or use the message in any manner; and (iii) notify the sender
>> immediately. In addition,
>> please be aware that any message addressed to our domain is subject to
>> archiving and review by
>> persons other than the intended recipient. Thank you.
>> _____________
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Brill Pappin <br...@pappin.ca>.
That is the most compelling argument I have ever heard  
(maintainability going forward).
saying "i like this by default" as most have done is no argument at  
all :)

However I disagree "best" is final by default... it should be the  
other way around, where things are only marked final if there is a  
good and immediate reason to do so.

Although the debate is long and about as convoluted as the debate of  
hungarian notation was, personal experience suggests that everything  
final causes more problems than it's worth (I consider the Quartz API  
to be poor for that reason also).

However, I am *in no way asking* the developers to reverse the "final"  
policy. its working, and working fairly well. I think I may have  
started a thread here that is less than productive and unless others  
feel that there needs to be a debate on the issue, I'll let it drop.

- Brill Pappin

On 12-Jun-08, at 11:50 AM, Zappaterrini, Larry wrote:

> It is not about assuming anyone is an idiot. It is about preserving
> maintainability and allowing an API to evolve without breaking client
> code. The best approach is to mark members as final unless there is a
> compelling reason not to. Final is a safeguard for APIs to know what
> behavior is guaranteed to persist as development and evolution of the
> API is carried out. Occasionally a user can come up with a good  
> argument
> for removing the final restriction and makes their case, affecting a
> change.
>
> It is very easy to create an evolutionary dead end for an API by
> allowing everything to be overridden. So either deprecate and start  
> over
> or risk breaking client code and have your users hate you for it :)
>
> -----Original Message-----
> From: Brill Pappin [mailto:brill@pappin.ca]
> Sent: Thursday, June 12, 2008 11:09 AM
> To: users@wicket.apache.org
> Subject: Re: Making Component easier to Generify
>
> I understand the reasoning, however I think "best practice" can be
> debated.
> To use your example Swing allows the user to override quite a bit, and
> it doesn't make any (or very few) assumptions on what should and
> should not be done.
>
> I don't like API's that assume I'm an idiot and prevent me from
> manipulating them how I see fit. If I cause a bug that I have to deal
> with, thats *my* problem to resolve.
>
> In my book (and I'm not the only one) excessive use of final is an
> anti-pattern.
>
> - Brill Pappin
>
> On 12-Jun-08, at 10:01 AM, cowwoc wrote:
>
>>
>> Brill,
>>
>> This is actually an API "best practice". Classes fall into two
>> categories:
>> ones designed for subclassing, and ones designed to be final. The
>> same goes
>> for methods. Swing is full of examples of what goes wrong when people
>> override methods in classes that haven't been designed with
>> subclassing in
>> mind.
>>
>> Gili
>>
>>
>> Brill Pappin wrote:
>>>
>>> on removing the finals
>>>
>>> The final members are the worst thing I've had to deal with in  
>>> Wicket
>>> so far.
>>> Although I understand that there may be a reason for them, they are
>>> more a hinderance than anything else and seem to be trying to
>>> "protect
>>> users from themselves".
>>>
>>> - Brill Pappin
>>>
>>>
>>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>>
>>>>
>>>>
>>>> Have you considered moving from subclassing to composition in  
>>>> Wicket
>>>> using
>>>> Callable<T>?
>>>>
>>>> Currently it is quite common for developers to subclass a component
>>>> in order
>>>> to override isVisible() and other properties. I am proposing that
>>>> instead
>>>> the component classes become final and properties may only be set
>>>> using
>>>> setter methods. The setter methods would take Callable<T> instead  
>>>> of
>>>> T, so
>>>> for example setVisible(boolean) would become
>>>> setVisible(Callable<Boolean>)
>>>>
>>>> The benefit of this approach is that you could introduce static
>>>> factory
>>>> methods to the Wicket components which would make them much easier
>>>> to use in
>>>> their Generic form. You could then introduce various helper
>>>> classes to
>>>> create Callable<T> for constant values, such as
>>>> Callable.valueOf(true) would
>>>> return a Callable<Boolean> that always returns true.
>>>> -- 
>>>> View this message in context:
>>>>
> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-yo
> ur-take-on-generics-with-Wicket-tp17589984p17792488.html
>>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>>
>>>>
>>>>
> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>>
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-yo
> ur-take-on-generics-with-Wicket-tp17589984p17800710.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
> ______________
>
> The information contained in this message is proprietary and/or  
> confidential. If you are not the
> intended recipient, please: (i) delete the message and all copies;  
> (ii) do not disclose,
> distribute or use the message in any manner; and (iii) notify the  
> sender immediately. In addition,
> please be aware that any message addressed to our domain is subject  
> to archiving and review by
> persons other than the intended recipient. Thank you.
> _____________
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


RE: Making Component easier to Generify

Posted by "Zappaterrini, Larry" <La...@fnis.com>.
It is not about assuming anyone is an idiot. It is about preserving
maintainability and allowing an API to evolve without breaking client
code. The best approach is to mark members as final unless there is a
compelling reason not to. Final is a safeguard for APIs to know what
behavior is guaranteed to persist as development and evolution of the
API is carried out. Occasionally a user can come up with a good argument
for removing the final restriction and makes their case, affecting a
change.

It is very easy to create an evolutionary dead end for an API by
allowing everything to be overridden. So either deprecate and start over
or risk breaking client code and have your users hate you for it :)

-----Original Message-----
From: Brill Pappin [mailto:brill@pappin.ca] 
Sent: Thursday, June 12, 2008 11:09 AM
To: users@wicket.apache.org
Subject: Re: Making Component easier to Generify

I understand the reasoning, however I think "best practice" can be  
debated.
To use your example Swing allows the user to override quite a bit, and  
it doesn't make any (or very few) assumptions on what should and  
should not be done.

I don't like API's that assume I'm an idiot and prevent me from  
manipulating them how I see fit. If I cause a bug that I have to deal  
with, thats *my* problem to resolve.

In my book (and I'm not the only one) excessive use of final is an  
anti-pattern.

- Brill Pappin

On 12-Jun-08, at 10:01 AM, cowwoc wrote:

>
> Brill,
>
> This is actually an API "best practice". Classes fall into two  
> categories:
> ones designed for subclassing, and ones designed to be final. The  
> same goes
> for methods. Swing is full of examples of what goes wrong when people
> override methods in classes that haven't been designed with  
> subclassing in
> mind.
>
> Gili
>
>
> Brill Pappin wrote:
>>
>> on removing the finals
>>
>> The final members are the worst thing I've had to deal with in Wicket
>> so far.
>> Although I understand that there may be a reason for them, they are
>> more a hinderance than anything else and seem to be trying to  
>> "protect
>> users from themselves".
>>
>> - Brill Pappin
>>
>>
>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>
>>>
>>>
>>> Have you considered moving from subclassing to composition in Wicket
>>> using
>>> Callable<T>?
>>>
>>> Currently it is quite common for developers to subclass a component
>>> in order
>>> to override isVisible() and other properties. I am proposing that
>>> instead
>>> the component classes become final and properties may only be set
>>> using
>>> setter methods. The setter methods would take Callable<T> instead of
>>> T, so
>>> for example setVisible(boolean) would become
>>> setVisible(Callable<Boolean>)
>>>
>>> The benefit of this approach is that you could introduce static
>>> factory
>>> methods to the Wicket components which would make them much easier
>>> to use in
>>> their Generic form. You could then introduce various helper  
>>> classes to
>>> create Callable<T> for constant values, such as
>>> Callable.valueOf(true) would
>>> return a Callable<Boolean> that always returns true.
>>> -- 
>>> View this message in context:
>>>
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-yo
ur-take-on-generics-with-Wicket-tp17589984p17792488.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>>
---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> -- 
> View this message in context:
http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-yo
ur-take-on-generics-with-Wicket-tp17589984p17800710.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org

______________

The information contained in this message is proprietary and/or confidential. If you are not the 
intended recipient, please: (i) delete the message and all copies; (ii) do not disclose, 
distribute or use the message in any manner; and (iii) notify the sender immediately. In addition, 
please be aware that any message addressed to our domain is subject to archiving and review by 
persons other than the intended recipient. Thank you.
_____________

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Brill Pappin <br...@pappin.ca>.
I understand the reasoning, however I think "best practice" can be  
debated.
To use your example Swing allows the user to override quite a bit, and  
it doesn't make any (or very few) assumptions on what should and  
should not be done.

I don't like API's that assume I'm an idiot and prevent me from  
manipulating them how I see fit. If I cause a bug that I have to deal  
with, thats *my* problem to resolve.

In my book (and I'm not the only one) excessive use of final is an  
anti-pattern.

- Brill Pappin

On 12-Jun-08, at 10:01 AM, cowwoc wrote:

>
> Brill,
>
> This is actually an API "best practice". Classes fall into two  
> categories:
> ones designed for subclassing, and ones designed to be final. The  
> same goes
> for methods. Swing is full of examples of what goes wrong when people
> override methods in classes that haven't been designed with  
> subclassing in
> mind.
>
> Gili
>
>
> Brill Pappin wrote:
>>
>> on removing the finals
>>
>> The final members are the worst thing I've had to deal with in Wicket
>> so far.
>> Although I understand that there may be a reason for them, they are
>> more a hinderance than anything else and seem to be trying to  
>> "protect
>> users from themselves".
>>
>> - Brill Pappin
>>
>>
>> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
>>
>>>
>>>
>>> Have you considered moving from subclassing to composition in Wicket
>>> using
>>> Callable<T>?
>>>
>>> Currently it is quite common for developers to subclass a component
>>> in order
>>> to override isVisible() and other properties. I am proposing that
>>> instead
>>> the component classes become final and properties may only be set
>>> using
>>> setter methods. The setter methods would take Callable<T> instead of
>>> T, so
>>> for example setVisible(boolean) would become
>>> setVisible(Callable<Boolean>)
>>>
>>> The benefit of this approach is that you could introduce static
>>> factory
>>> methods to the Wicket components which would make them much easier
>>> to use in
>>> their Generic form. You could then introduce various helper  
>>> classes to
>>> create Callable<T> for constant values, such as
>>> Callable.valueOf(true) would
>>> return a Callable<Boolean> that always returns true.
>>> -- 
>>> View this message in context:
>>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>>> For additional commands, e-mail: users-help@wicket.apache.org
>>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
>>
>
> -- 
> View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by cowwoc <co...@bbs.darktech.org>.
Brill,

This is actually an API "best practice". Classes fall into two categories:
ones designed for subclassing, and ones designed to be final. The same goes
for methods. Swing is full of examples of what goes wrong when people
override methods in classes that haven't been designed with subclassing in
mind.

Gili


Brill Pappin wrote:
> 
> on removing the finals
> 
> The final members are the worst thing I've had to deal with in Wicket  
> so far.
> Although I understand that there may be a reason for them, they are  
> more a hinderance than anything else and seem to be trying to "protect  
> users from themselves".
> 
> - Brill Pappin
> 
> 
> On 12-Jun-08, at 1:03 AM, cowwoc wrote:
> 
>>
>>
>> Have you considered moving from subclassing to composition in Wicket  
>> using
>> Callable<T>?
>>
>> Currently it is quite common for developers to subclass a component  
>> in order
>> to override isVisible() and other properties. I am proposing that  
>> instead
>> the component classes become final and properties may only be set  
>> using
>> setter methods. The setter methods would take Callable<T> instead of  
>> T, so
>> for example setVisible(boolean) would become  
>> setVisible(Callable<Boolean>)
>>
>> The benefit of this approach is that you could introduce static  
>> factory
>> methods to the Wicket components which would make them much easier  
>> to use in
>> their Generic form. You could then introduce various helper classes to
>> create Callable<T> for constant values, such as  
>> Callable.valueOf(true) would
>> return a Callable<Boolean> that always returns true.
>> -- 
>> View this message in context:
>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800710.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Brill Pappin <br...@pappin.ca>.
on removing the finals

The final members are the worst thing I've had to deal with in Wicket  
so far.
Although I understand that there may be a reason for them, they are  
more a hinderance than anything else and seem to be trying to "protect  
users from themselves".

- Brill Pappin


On 12-Jun-08, at 1:03 AM, cowwoc wrote:

>
>
> Have you considered moving from subclassing to composition in Wicket  
> using
> Callable<T>?
>
> Currently it is quite common for developers to subclass a component  
> in order
> to override isVisible() and other properties. I am proposing that  
> instead
> the component classes become final and properties may only be set  
> using
> setter methods. The setter methods would take Callable<T> instead of  
> T, so
> for example setVisible(boolean) would become  
> setVisible(Callable<Boolean>)
>
> The benefit of this approach is that you could introduce static  
> factory
> methods to the Wicket components which would make them much easier  
> to use in
> their Generic form. You could then introduce various helper classes to
> create Callable<T> for constant values, such as  
> Callable.valueOf(true) would
> return a Callable<Boolean> that always returns true.
> -- 
> View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by cowwoc <co...@bbs.darktech.org>.

You could reduce the verbosity by combining all your dynamic content
(anything you would normally add when subclassing a component) into a
separate class. For example:

class Images
{
  Callable<Boolean> isVisible()
  {
    ...
  }
  Callable<Integer> getItemsPerPage()
  {
    ...
   }
}

main()
{
  DataView<Image> images = DataView.create(); // factory method
  Images imageState = new Images();
  images.setItemsPerPage(imageState.getItemsPerPage());
  images.setVisible(imageState.isVisible());
  ...
}

Gili



Matej Knopp-2 wrote:
> 
> Apart from the fact that this would be even more verbose than current
> generics approach this would probably also radically increase
> component memory footprint.
> 
> -Matej
> 
> On Thu, Jun 12, 2008 at 7:03 AM, cowwoc <co...@bbs.darktech.org> wrote:
>>
>>
>> Have you considered moving from subclassing to composition in Wicket
>> using
>> Callable<T>?
>>
>> Currently it is quite common for developers to subclass a component in
>> order
>> to override isVisible() and other properties. I am proposing that instead
>> the component classes become final and properties may only be set using
>> setter methods. The setter methods would take Callable<T> instead of T,
>> so
>> for example setVisible(boolean) would become
>> setVisible(Callable<Boolean>)
>>
>> The benefit of this approach is that you could introduce static factory
>> methods to the Wicket components which would make them much easier to use
>> in
>> their Generic form. You could then introduce various helper classes to
>> create Callable<T> for constant values, such as Callable.valueOf(true)
>> would
>> return a Callable<Boolean> that always returns true.
>> --
>> View this message in context:
>> http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
>> Sent from the Wicket - User mailing list archive at Nabble.com.
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
>> For additional commands, e-mail: users-help@wicket.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17800015.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Making Component easier to Generify

Posted by Matej Knopp <ma...@gmail.com>.
Apart from the fact that this would be even more verbose than current
generics approach this would probably also radically increase
component memory footprint.

-Matej

On Thu, Jun 12, 2008 at 7:03 AM, cowwoc <co...@bbs.darktech.org> wrote:
>
>
> Have you considered moving from subclassing to composition in Wicket using
> Callable<T>?
>
> Currently it is quite common for developers to subclass a component in order
> to override isVisible() and other properties. I am proposing that instead
> the component classes become final and properties may only be set using
> setter methods. The setter methods would take Callable<T> instead of T, so
> for example setVisible(boolean) would become setVisible(Callable<Boolean>)
>
> The benefit of this approach is that you could introduce static factory
> methods to the Wicket components which would make them much easier to use in
> their Generic form. You could then introduce various helper classes to
> create Callable<T> for constant values, such as Callable.valueOf(true) would
> return a Callable<Boolean> that always returns true.
> --
> View this message in context: http://www.nabble.com/users%2C-please-give-us-your-opinion%3A-what-is-your-take-on-generics-with-Wicket-tp17589984p17792488.html
> Sent from the Wicket - User mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org