I'll chime in again.  I really like generics.   When I first upgraded to 1.4,
I did a bit of grumbling, but I came to realize some great benefits,
especially with components.  I'd hate to lose that (almost as much as I'd
hate to go through my whole code base and remove that work).

I did a couple of things that made things easier.  First, all my pages
subclassed from a common ancestor which I just changed to 'extends
WebPage<Void>'.  Second, I created some utility classes such as

   VoidContainer extends WebMarkupContainer<Void>
   StringLabel extends Label<String>

and so on.  I don't feel that having to create these utility classes is a
hassle or is a mark against the API.  Rather, it helps me understand how and
where I use certain types of components.  It also helps with refactoring.  

There is one place that it is ugly, but it is an edge case in a logout link. 
I just used @SuppressWarnings to deal with it.

            @SuppressWarnings({"unchecked"})
            @Override
            public void onClick()
            {
                getSession().invalidate();
                // need to use "class" so page is created new
                setResponsePage((Class&lt;? extends Page&lt;?>>)
getPage().getClass()));
            }

The bottom line was that the work didn't take that long and in the end I
feel my code is more readable and type-safe.

-Doug


Jeremy Thomerson-5 wrote:
> 
> I haven't said anything up to this point, but we really don't seem to be
> getting anywhere with what is turning into a religious war.  I, for one,
> have already started using 1.4, and love the generics, despite the extra
> verbosity.  It gives me extra type safety and code self-documentation.  I
> would be very against having the framework do a cast as has been suggested
> on here, because that is a hack, and not useful for anything - I lose the
> value of generics because the compiler is no longer checking my type
> safety
> throughout the application.  If I came to a framework without previous
> experience with it, and discovered that ugly hack, I would be worried
> about
> the quality of all of the code.
> 
> I think that we should:
>  - continue with 1.4-M2
>  - create a wiki page where we can get one master list of  things we like
> and don't like
>  - see what we can do to address those
> 
> We're really not getting anywhere with this conversation until we have a
> finite list, and some options for each con on the list.  Then we can
> either
> choose the best options or say "forget it".
> 
> -- 
> Jeremy Thomerson
> http://www.wickettraining.com
> 
> On Thu, May 22, 2008 at 6:23 AM, Jan Kriesten <[EMAIL PROTECTED]>
> wrote:
> 
>>
>> hi sebastiaan,
>>
>>  I'm very much against using generics to do something other from what
>>> generics where meant to do (i.e., type safety).
>>>
>>
>> i'm all in when you're talking about type safety. having compile-time
>> checks on the types is a time-saver during development.
>>
>> with wicket generics it's just that the time-saver get's in it's own way,
>> i.e. bringing in so much boilerplate, that coding is getting harder to do
>> right (besides from source readability).
>>
>>
>> regards, --- jan.
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: [EMAIL PROTECTED]
>> For additional commands, e-mail: [EMAIL PROTECTED]
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/%28Class%3C--extends-Page%3C-%3E%3E%29--casting-troubles-tp17355847p17406422.html
Sent from the Wicket - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to