This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
In what way is a Java Bean advantageous. Apart from the demarcation that it is a component, does it have any other special features. I wish to know one more thing. A java Bean is a typical class. Won't it have the same too many object instatiation as a typical class. What are its major advantages as far as the threading issues are concerned. Regds Shiva
A java bean is a simple data structure which is responsible for carring data and not complex logic. You should determine the rules for getting and setting attibutes but nothing beyond this. Coding this way, the final result will show lots of classes with the responsibility well distributed. Each class has its own role in the system and data structure is the java bean responsibility. It's like a style of coding. There are some advantages using these beans, like the built-in facilities in the servlet engine. Think of the use of the tag jsp:useBean, for instance. It is really useful.
Joined: Jun 10, 2001
How about the object creation issues. Aren't they created as a simple java class does. That could be heavy if the hits are more compared to a servlet. shiva
Oh yes, there can be serious bottlenecks if javabean is not coded correctly and scope is not setup appropriatly. You can store ton of info in the instance variables and instantiate for every request. It can even bring the server down. Ideally Java bean should not be more than a value object with getters/setters with all business logic delegated to a helper class/ejb.