Web Development with JavaServer Pages

Скачать в pdf «Web Development with JavaServer Pages»

7.1.1    Component architectures


Components are self-contained, reusable software elements that encapsulate application behavior or data into a discrete package. You can think of components as black box devices that perform specific operations without revealing the details of what’s going on under the hood. Because they abstract their behavior from their implementation, they shield their user from messy details—providing added functionality without increased complexity. Components are stand-alone and not bound tightly to any single application or use. This allows them to be used as building blocks for multiple, potentially unrelated projects. These two principles, abstraction and reusability, are the cornerstones of component-centric design. Figure 7.1 illustrates how a collection of independent software components is assembled to form a complete solution.


Think of components as reusable software elements that we can glue together to construct our applications. A good component model allows us to eliminate or greatly reduce the amount of glue code necessary to build our applications. Component architectures work by employing an interface that allows our components to work together in a more integrated fashion. It is this commonality that binds components together and allows them to be used by development tools that understand the interface to further simplify development.

7.1.2 Benefits of a component architecture


Let’s look at an example of component-centric design that’s more concrete. When an architect designs a new home he or she relies on components to save time, reduce complexity, and cut costs. Rather than design every wall unit, window frame, and electrical system from scratch he or she uses existing components to simplify the task. Architects don’t design a custom air-conditioning system; they select an existing unit that will fit their requirements from the many models available on the market. There’s a good chance that the architect doesn’t have the skills or resources to design an air-conditioning system anyway. And conversely the designer of the air-conditioning system probably couldn’t build a house. Because of this component-based approach the architect and contractor can concentrate on building what they know best—houses, and the air-conditioning company can build air-conditioners. Component architectures allow us to hide a component’s complexity behind an interface that allows it to interact with its environment or other components. It isn’t necessary to know the details of how a component works in order to access its functionality.

Скачать в pdf «Web Development with JavaServer Pages»