Hi everyone, I was wondering if someone could help me figure out when to use javabeans. In my application, I've made a bean that lets you connect to a database. I'm going to make another one that handles connection pooling. Does that sound ok? OK, the other thin is that i want to make an object that will store details of an order (for example). Would this be a good bean? Would I then put it in the session or is there a better strategy Basically, the thing I dont get is what the difference between a plain java bean and a plain class is? They both look roughly the same. So other thant the get/set conventions and the fact that beans can be placed in a visual builder, whats the big deal? Kindest thanks Simon
Basically, the thing I dont get is what the difference between a plain java bean and a plain class is? They both look roughly the same. So other thant the get/set conventions and the fact that beans can be placed in a visual builder, whats the big deal? The main purpose of beans is to build reusable components and to have a standardized way for containers to interact with them thru introspection. Beans can interact with one another by firing property changes, thus providing a means of mediating state among several different beans. The idea is to be able to take some existing beans, put them together in various ways and produce a type of modular software.
Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius - and a lot of courage - to move in the opposite direction. - Ernst F. Schumacher
of course what Michael pointed is correct but according to me, until u stop fight w/ uself about distinguishing b/w a bean and a simple class expecting miraculous differences then u will find urself in "unsatisfying" state as me. bean is just a convention ppl follow which makes the simple class more useful because if we say something is a bean the third party can assume certain things about the class (even the JVM) and those components becomes easy to fit in different places still being very customizable. well, just my 2 cents. regards maulin