I don't think models have to be implementation details. Sometimes that
makes sense, and in that case I usually like to embed the model class
in the component itself. But lots of other times, you can make the
model so that it can easily be reused by other components, possibly at
the same time. This is especially true for master detail relations
etc, something you can perfectly model with interdependent models.

One of the main reasons for us wanting to apply generics in Wicket 2.0
is to have strongly typed models. In Wicket 2.0, components can force
that they only accept models of a certain type (e.g. IModel<Person>)
so that you can have the same type of strong typing you have when
passing pojos, but still hiding where the pojo comes from (or when).
So in Wicket 2.0 a development approach where you pass models a lot
makes even more sense.

That's just my 2c of course :)


> Currently I use models to hold, attach & detach my persistent objects.
> About using IModels in constructors, I've mostly do it to be able to
> unit test my pages easier. But inside my application code, I prefer
> other components *not* to see or be aware of each other's internal
> models. That said, I prefer 'new PersonProfilePage("id",person)' instead
> of 'new PersonProfilePage("id",profileModel)'. I would like to hear
> comments on this, since I'm not sure everybody agrees.

Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
Wicket-user mailing list

Reply via email to