Java Reference
In-Depth Information
Self-Test Exercises
3. What is the purpose of a port in the context of a socket?
4. Consider a threaded server that is expected to have up to 100 clients connected to
it at one time. Why might this server require a large amount of resources such as
memory, disk space, or processor time?
19.3
JavaBeans
Insert tab A into slot B.
Common assembly instruction
JavaBeans
JavaBeans refers to a framework that facilitates software building by connecting soft-
ware components from diverse sources. Some of the components might be standard
existing pieces of software. Some might be designed for the particular application. Typi-
cally, the various components were designed and coded by different teams. If the compo-
nents are all designed within the JavaBeans framework, that simplifies the process of
integrating the components and means that the components produced can more easily
be reused for future software projects. JavaBeans have been widely used. For example, the
AWT and Swing packages were built within the JavaBeans framework.
The Component Model
You are most likely to have heard the word “component” when shopping for a home
entertainment system. The individual pieces, such as a receiver/amplifier, DVD player,
speakers, and so forth, are called “components.” You connect the components to pro-
duce a working system, but you do not connect them in just any way. You must con-
nect them following the interface rules for each component. The speaker wire must
connect to the correct plug, and there better be a plug for it to connect to. You may
think it is obvious that a receiver/amplifier needs to have connections for speakers; it is
obvious if the receiver/amplifier design is going to be used to make many identical
units for use by many different people. However, if you were only making one
receiver/amplifier for one home entertainment system, you might just “open the box”
and connect the wire inside. Software systems, unfortunately, are often constructed
using the “open the box” approach. The component model says that components
should always have well-defined connections for other components, which in our case
will be other software components, not speakers, but the idea is the same.
The JavaBeans Model
A component model specifies how components interact with one another. In the case
of JavaBeans, the software components (classes) are required to provide at least the fol-
lowing interface services or abilities:
Search WWH ::




Custom Search