JavaBeans take the component concept of object oriented
programming to the next level. A JavaBean system allows one to build
a program completely from a drag-and-drop menu without writing any
code directly.
JavaBeans are in fact just Java objects but ones
that obey a set of design rules that allow visual application
builders to interogate them to determine their properties and
to modify them.
JavaBeans take advantage of
- Design patterns - such as factory methods and accessing properties
with well defined "getter" and "setter"
methods:
...
private int A, B;
public void getA(){ return A;}
public void getB(){ return B;}
public int setA(int a){ A = a;}
public int setB(int b){ B = b;}
- Reflection - allows the classes to be interogated to find
their fields, methods, etc.
- Object serialization
- objects can be taken apart and saved to files and then rebuilt
later just as they were.
- Scalability - beans can be constructed out of other simpler
beans, e.g. a bean can be as simple as a AWT label or as elaborate
as a spreadsheet.
JavaBeans are beyond the range of this course. See
the following sites for more information:
References & Web
Resources