1. Wicket's IOC integrations are really easy to get started with, but there
are some gotchas. Since they inject serializable proxies* *to dependencies
instead of the dependencies themselves, the dependency gets
retrieved/created from Guice/Spring each time a page is deserialized.
Therefore, it's very important that you never inject anything that's meant
to maintain state across requests. This took a while for us to learn.

2. Also related to serialization, after one year of working with Wicket I
have a new fear/respect for the "final" keyword on local variables.
Generally speaking, any non-trivial, non-Component object should not be
serialized and should therefore not be marked final and used by an anonymous
inner class. Alarm bells start going off for me when I see that a developer
has made such an object final.

3. Setting a default model on a component means it will get detached for
you. If you have a model that isn't any component's default model, you need
to detach it yourself.

Good luck with your article!

Dan

On Wed, Jul 27, 2011 at 4:30 PM, Ben Tilford <b...@tilford.info> wrote:

> 1. How "static" resources work. For a newcomer this can be
> shocking/frustrating.
> 2. Models are a context that holds a reference to a model.
>
>
> On Wed, Jul 27, 2011 at 5:21 PM, Scott Swank <scott.sw...@gmail.com>
> wrote:
>
> > Jeremy,
> >
> > I just threw together the following, which indicates that at least to
> > me Models are worth 3 of your 10 items.
> >
> > 1. Most components have a backing object of some sort. This object is
> > referenced via a Model. Significantly, the type of the component and
> > the model match (e.g. Label<Integer> has an IModel<Integer>).
> > 2. These objects live in the session and are managed in the session by
> > wicket, so that when the component goes out of scope the object is
> > removed from the session by wicket.
> > 3. Because domain objects are often too large to store in the session
> > there is a LoadableDetachableModel that is responsible for loading the
> > object whenever it is needed in a request and then flushing it at the
> > end of the request via detach().
> >
> > Cheers,
> > Scott
> >
> > On Wed, Jul 27, 2011 at 3:29 PM, Jeremy Thomerson
> > <jer...@wickettraining.com> wrote:
> > > Hello all,
> > >
> > >  I'm writing an article for a Java magazine and would like to include
> in
> > it
> > > a list of "ten things every Wicket programmer must know".  Of course, I
> > have
> > > my list, but I'd be very curious to see what you think should be on
> that
> > > list from your own experience.  Or, put another way, maybe the question
> > > would be "what I wished I knew when I started Wicket" - what tripped
> you
> > up
> > > or what made you kick yourself later?
> > >
> > >  Please reply back if you have input.  Please note that by replying,
> you
> > > are granting me full permission to use your response as part of my
> > article
> > > without any attribution or payment.  If you disagree with those terms,
> > > please respond anyway but in your response mention your own terms.
> > >
> > > Best regards,
> > >
> > > --
> > > Jeremy Thomerson
> > > http://wickettraining.com
> > > *Need a CMS for Wicket?  Use Brix! http://brixcms.org*
> > >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
> > For additional commands, e-mail: users-h...@wicket.apache.org
> >
> >
>

Reply via email to