Every software developer knows that it is easier to write ten 100 line programs than to write a single 1,000 line program. Furthermore, any software development manager knows it is easier to manage the development of ten 100 line programs than a single 1,000 line program. Of course the problem is that most stand-alone software programs being written today require much more than 100 or even 1,000 lines of code to implement their required functionality. Breaking a monolithic 1,000 line program into ten 100 line programs, however, can be a slow, expensive task. If fact, if you were to try and break a typical 1,000 line C or FORTRAN program into ten parts , each part would end up being significantly larger than 100 lines. The extra code would be required to coordinate sharing of control and data between the different programs. Component-based software development attempts to address this problem by taking the reverse approach. Rather than build large monolithic applications, developers build a portable, reusable code base of small components .
A component is simply a reusable software object packaged in some sort binary, class, library, or similar form. Components are then combined, along with new code, to create a new application. Usually, components are used in some sort of component framework, such as ActiveX or JavaBeans, which specifies the interfaces each component should include to allow builder tools to access and modify the component in a standard way.
There are many business advantages to be gained by using a component-based software development methodology. First, because you can start with a library of pre-built components, it becomes simpler and quicker to attack new market opportunities. In large development organizations, components will bring new opportunities for joint development, as components facilitate the sharing and reuse of code. Components also create an opportunity for developers to sell smaller packages of software, or component libraries.
If you are going to facilitate the building of large programs out of small components, you need a framework to work in. A component framework provides a standard way of defining and manipulating components as well as standard ways of communicating between components when they are combined together. There are two popular component frameworks in use today, JavaBeans and ActiveX. We start this chapter by discussing the history of components that led to these two models. The JavaBeans component model is then used to further illustrate the concepts of component-based software development.