JSF : Component Binding Vs find component in the tree
Joined: Dec 01, 2009
what is better approach, component Binding or finding component in the component tree.
I am bit confused. Some where it is mentioned that component binding is more effecient as because, we dont need to find any component in the tree.
But I got some information from some JSF expert they dont recomend to have compoent binding as because the life cycle of managed bean and component tree is diffrent. that means if we used a component binding inside a manged bean, garbage collection of the component will depends on the managebean , as because component is referenced inside the managed bean , managed bean is having longer life than component inside a tree.
Joined: Jan 24, 2009
You start to think about optimization before your project has problems with it.
Although I prefer value binding I have code contexts that also use component binding. Use it if you need it or your design is more understandable with it. The quality in design, code readability and maintainability are more important in the long run.
The hardware will become cheaper during your project. So speed, memory usages and the like problems you may expect at the beginning of a project become less important with the better hardware quality at the end of your project ;-). A bad design will cost you more in the long run.
I've seen component binding and listeners overused. I certainly wouldn't use them purely for efficiency's sake, since if there's that big a performance problem, I might end up re-engineering the offending part of the app to use non-JSF techniques and bypass the overhead that comes from setting up and tearing down a FacesContext and its friends.
The major selling point of JSF to me is that it allows creating webapps out of simple, reusable components in a fairly straightforward way. To employ complex or even convoluted specialized JSF features in those components would be defeating fully half the purpose. So I bind to values, do injections, and avoid listeners except when there's a good reason to do otherwise.
Customer surveys are for companies who didn't pay proper attention to begin with.