Re: Constructor of Component not DRY?

2007-08-24 Thread Johan Maasing
I't really does not matter much but I'm with Eelco and Johan on this. I prefer not to allow null values in the constructor. At least not if there is a constructor with fewer parameters that can be used instead. So I prefer to chain towards the simpler constructor if possible. On 8/24/07, Martin

Constructor of Component not DRY?

2007-08-23 Thread Martin Funk
Hi, doing a little code reading and trying to understand what I read, I came across org.apache.wicket.Component 's constructors. To my eyes the two constructors look very much alike and I wonder why they were not chained like this: public Component(final String id) {

Re: Constructor of Component not DRY?

2007-08-23 Thread Johan Compagner
i think that is grown this way, previously the model constructor did some more i believe Also i don't like this(id,null) because thats just horrible, If you call the constructor with the model then the model shouldn't be null. a nicer way could be public Component(final String id, IModel

Re: Constructor of Component not DRY?

2007-08-23 Thread Eelco Hillenius
hmmm... that would go against my taste of chaining from the constructor with the least parameters to the constructor with the most parameters. I'd just tend to chose the constructor with the most complex signature as the default constructor, doing the 'real' construction part of the object

Re: Constructor of Component not DRY?

2007-08-23 Thread Igor Vaynberg
just add a private component init(String, IModel) which can assume null arguments do the null checks in the constructor and forward to that method -igor On 8/23/07, Eelco Hillenius [EMAIL PROTECTED] wrote: hmmm... that would go against my taste of chaining from the constructor with the