I don't think you'll find that discussion thread because that
decision was something I made before there was much if any
discussion.  The reason it's the way it currently is has to do with
two things: (1) in the code you suggested, the parent has to 
maintain a map from component name to component rather 
than just a list or array of components, and maps are less space 
efficient (which matters to scalability) and (2) without passing 
the id into the component constructor, components have no 
name of their own, which is at the very least some small violation 
of OO principles which suggest that data be as local and hidden 
as possible.  It would have been possible in the past to still keep 
a list or array of children and only assign a name to a component 
when it's added, but that would have (1) broken a lot of code for 
not much reason and (2) had a certain magical non-intuitiveness 
to a user (since they would never have explicitly named the 
component they constructed, only added it to the parent container
with the name...) leaving them to not look for getName() or to
expect that might be null unless they set it.  It could be that I
made the "wrong" decision here, but it's a bridge we crossed
years ago.

    jon


Aaron Hiniker-2 wrote:
> 
> A little off-topic, but when I first started using wicket, I always
> thought it
> would be more intuitive to do something like: 
> 
> panel.add( "myComponent", myComponent );  
> 
> Which leaves the constructors clean, and makes it very easy to
> choose/pass around components, because the markup id doesn't need to be
> known except by the parent thats actually attaching the component.  I
> can't remember why things never ended up that way... I'll have to search
> for that discussion thread. 
> 

-- 
View this message in context: 
http://www.nabble.com/IMPORTANT%3A-your-opinion-on-the-constructor-change-in-2.0-tf3358738.html#a9352056
Sent from the Wicket - User mailing list archive at Nabble.com.


-------------------------------------------------------------------------
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
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Wicket-user mailing list
Wicket-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/wicket-user

Reply via email to