What I don't like about IPageFactory is that it has two methods
instead of just one (the one with class and page parameters). That
page parameter may be null - part of the contract, thus fine. And
constructors with the page parameter should allways precede the
default constructor, even if the page parameters argument is null.
Only when there is no pageparameters constructor should the default
constructor be called. Wouldn't this be a much clearer contract?
Eelco
On 1/14/06, Igor Vaynberg <[EMAIL PROTECTED]> wrote:
> hey guys, while helping pepone pepone on the user list ive come across a
> bug. most of the time when we instantiate a page we do it using a wrong call
> to the pagefactory. most of the time we use newPage(class, PageParams) even
> though page params are empty and so the newPage(Class) should be used
> instead which invokes the default constructor.
>
> i went through all the places i could find and basically did this
> if (pageparams.size()==0) { page=newPage(class); } else {
> page=newPage(class, pageparams); }
>
> and then a lot of tests broke because they depend on wicket calling the
> wrong constructor! so i had to go and fix all those. i would say 90% of all
> test pages were expecting to be instantiated with the wrong constructor,
> probably because they were copied and pasted most of the time.
>
> while doing all this and discussing it with eelco we agreed that it might be
> better to change ipagefactory to only have one constructor: (class,
> pageparams) and allow pagaparams to be null. the rule would be simple: if
> page params==null||pageparams.size()==0 use the default
> constructor, otherwise use the pageparams one.
>
>
> what do you think?
>
> -Igor
>
>
>
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
Wicket-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-develop