Programming Tutorials

Reusable component

By: aathishankaran in Java Beans Tutorials on 2007-02-12  

Reusable components are simply pre-built pieces of programming code designed to perform a specific function. While designing an application in a visual environment, controls can be quickly dropped into the design, and modified to fit the task at hand. Most of the controls you'll find are designed to handle such tasks as pushbuttons, menus, text labels, and so forth. As a developer, you only need to write code to "glue" them into your application, and develop the interactions between controls.

Recently, programmers have been searching for some way to create and reuse components in the Java language. Java holds great promise, but the early releases lacked any method for creating reusable controls, and thus caused extended development times for applications. Sun Microsystems, the creators of the Java language, have at last recognized this need, and have released the Java Beans Component Architecture. Java Beans are, quite simply, reusable controls written in Java, for Java application development.

Beans are "capsules" of code, each designed for a specific purpose. The advantage of Java Beans over standard programming controls is that Beans are independent. They are not specific to operating systems or development environments. A Bean created in one development environment can be easily copied and modified by another. This allows Java Beans greater flexibility in enterprise computing, as components are easily shared between developers.

Java Beans are best put to use by visual developers. In a visual design environment, an application interface is developed on a "form" or client window. A toolbox contains all the controls (Beans), which are dropped onto the form through simple drag and drop procedures. As the controls are dropped onto the form, the development environment grinds out the necessary code, when the interface is finished, the developer can set about creating the actual interactions between controls and the application as a whole. An exciting concept behind Beans springs from the fact that an application created in Java can be used as a Bean, which can be used to build other applications. As you can imagine, this circle of application to Bean and back can make developing large-scale applications much easier.

Some may wonder why anyone would use a Bean over a Java Class file. The strongest argument for a Bean over a Class is that Beans support introspection. That is, they allow the development environment to analyze the Bean, determine its properties and methods, and manipulate the Bean at design time instead of at run time.

Add Comment

* Required information


No comments yet. Be the first!

Most Viewed Articles (in Java Beans )

Latest Articles (in Java Beans)