Component-based software engineering
Introduction
Component-based software engineering (CBSE) is an approach to software development
that relies on the reuse of entities called ‘software components’.
It emerged from the failure of object-oriented development to support effective reuse.
Single object classes are too detailed and specific.
Components are more abstract than object classes and can be considered to be stand-
alone service providers. They can exist as stand-alone entities.
The essentials of component-based software engineering are:
1. Independent components that are completely specified by their interfaces. There
should be a clear separation between the component interface and its implementation.
2. Component standards that facilitate the integration of components. These standards
are embodied in a component model.
3. Middleware that provides software support for component integration and
interoperability.
4. A development process that is geared to component-based software engineering.
CBSE and design principles
Apart from the benefits of reuse, CBSE is based on sound software engineering design
principles:
- Components are independent so do not interfere with each other;
- Component implementations are hidden;
- Communication is through well-defined interfaces;
- Component platforms are shared and reduce development costs.
Component standards
Standards need to be established so that components can communicate with each other
and inter-operate.
Unfortunately, several competing component standards were established:
- Sun’s Enterprise Java Beans
- Microsoft’s COM and .NET
- CORBA’s CCM
In practice, these multiple standards have hindered the uptake of CBSE. It is impossible
for components developed using different approaches to work together.
CBSE problems
- Component trustworthiness - how can a component with no available source code
be trusted?
- Component certification - who will certify the quality of components?
- Emergent property prediction - how can the emergent properties of component
compositions be predicted?
- Requirements trade-offs - how do we do trade-off analysis between the features of
one component and another?
COMP 312 : CBSE Page 1
Components and component models
Components provide a service without regard to where the component is executing or its
programming language.
A component is an independent executable entity that can be made up of one or more
executable objects;
The component interface is published and all interactions are through the published
interface;
Definition
Heineman
“A software element that conforms to a standard component model and can be
independently deployed and composed without modification according to a composition
standard.”
Szyperski
“A software component is a unit of composition with contractually-specified interfaces
and explicit context dependencies only. A software component can be deployed
independently and is subject to composition by third parties.”
Components characteristics
Component Description
Characteristic
Standardized Component standardization means that a component used in
a
CBSE process has to conform to a standard component
model. This model may define component interfaces,
component metadata, documentation, composition, and
deployment.
Independent A component should be independent—it should be possible
to compose and deploy it without having to use other
specific components. In situations where the component
needs externally provided services, these should be explicitly
set out in a ‘requires’ interface specification.
Composable For a component to be composable, all external interactions
must take place through publicly defined interfaces. In
addition, it must
provide external access to information about itself, such as
its methods and attributes.
Deployable To be deployable, a component has to be self-contained. It
must be
able to operate as a stand-alone entity on a component
platform
that provides an implementation of the component model
Documented Components have to be fully documented so that potential
users
can decide whether or not the components meet their needs.
COMP 312 : CBSE Page 2
The
syntax and, ideally, the semantics of all component
interfaces
should be specified.
Component as a service provider emphasizes two critical characteristics of a
reusable component:
1. The component is an independent executable entity that is defined by its interfaces.
You don’t need any knowledge of its source code to use it. It can either be referenced as
an external service or included directly in a program.
2. The services offered by a component are made available through an interface and all
interactions are through that interface. The component interface is expressed in terms of
parameterized operations and its internal state is never exposed.
Components have two related interfaces: These interfaces reflect the services that
the component provides and the services that the component requires to operate
correctly:
1. The ‘provides’ interface defines the services provided by the component. This
interface, essentially, is the component API. It defines the methods that can be
called by a user of the component
2. The ‘requires’ interface specifies what services must be provided by other
components in the system if a component is to operate correctly. This does not
compromise the independence or deployability of a component because the
'requires' interface does not define how these services should be provided.
Components are accessed using remote procedure calls (RPCs). Each component has a
unique identifier (usually a URL) and can be referenced from any networked computer.
Therefore it can be called in a similar way as a procedure or method running on a local
computer.
Component model
Component model is a definition of standards for component implementation,
documentation and deployment.
Examples of component models:
EJB model (Enterprise Java Beans)
COM+ model (.NET model),
COMP 312 : CBSE Page 3
CORBA Component Model.
The component model specifies how interfaces should be defined and the elements that
should be included in an interface definition.
Elements of a component model:
Interfaces
Components are defined by specifying their interfaces. The component model specifies
how the interfaces should be defined and the elements, such as operation names,
parameters and exceptions, which should be included in the interface definition.
Usage
In order for components to be distributed and accessed remotely, they need to have a
unique name or handle associated with them. This has to be globally unique.
Deployment
The component model includes a specification of how components should be packaged
for deployment as independent, executable entities.
CBSE processes
CBSE processes are software processes that support component-based software
engineering. They take into account the possibilities of reuse and the different process
activities involved in developing and using reusable components. There are two types of
CBSE processes:
COMP 312 : CBSE Page 4
CBSE for reuse is concerned with developing components or services that will be
reused in other applications. It usually involves generalizing existing components.
CBSE with reuse is the process of developing new applications using existing
components and services.
CBSE for reuse focuses on component and service development. Components
developed for a specific application usually have to be generalised to make them
reusable. A component is most likely to be reusable if it associated with a stable domain
abstraction (business object). For example, in a hospital stable domain abstractions are
associated with the fundamental purpose - nurses, patients, treatments, etc.
Component reusability:
Should reflect stable domain abstractions;
Should hide state representation;
Should be as independent as possible;
Should publish exceptions through the component interface.
There is a trade-off between reusability and usability. The more general the
interface, the greater the reusability but it is then more complex and hence less usable.
To make an existing component reusable:
Remove application-specific methods.
Change names to make them general.
Add methods to broaden coverage.
Make exception handling consistent.
Add a configuration interface for component adaptation.
Integrate required components to reduce dependencies.
Existing legacy systems that fulfill a useful business function can be re-packaged as
components for reuse. This involves writing a wrapper component that implements
provides and requires interfaces then accesses the legacy system. Although costly, this
can be much less expensive than rewriting the legacy system.
The development cost of reusable components may be higher than the cost of specific
equivalents. This extra reusability enhancement cost should be an organization rather
than a project cost. Generic components may be less space-efficient and may have
longer execution times than their specific equivalents.
Component management involves deciding how to classify the component so that it
can be discovered, making the component available either in a repository or as a
service, maintaining information about the use of the component and keeping track of
different component versions. A company with a reuse program may carry out some
form of component certification before the component is made available for reuse.
Certification means that someone apart from the developer checks the quality of the
component.
COMP 312 : CBSE Page 5
CBSE with reuse process has to find and integrate reusable components. When reusing
components, it is essential to make trade-offs between ideal requirements and the
services actually provided by available components. This involves:
Developing outline requirements;
Searching for components then modifying requirements according to available
functionality;
Searching again to find if there are better components that meet the revised
requirements;
Composing components to create the system.
Component composition
Component composition is the process of assembling components to create a system.
Composition involves integrating components with each other and with the component
infrastructure. Normally you have to write 'glue code' to integrate components.
Three types of component composition:
Sequential composition where the composed components are executed in sequence.
This involves composing the provides interfaces of each component.
Hierarchical composition where one component calls on the services of another. The
provides interface of one component is composed with the requires interface of another.
Additive composition where the interfaces of two components are put together to
create a new component. Provides and requires interfaces of integrated component is a
combination of interfaces of constituent components.
When components are developed independently for reuse, their interfaces are often
incompatible. Three types of incompatibility can occur:
Parameter incompatibility where operations have the same name but are of
different types.
Operation incompatibility where the names of operations in the composed
interfaces are different.
Operation incompleteness where the provides interface of one component is a
subset of the requires interface of another.
COMP 312 : CBSE Page 6
When composing components, you may find conflicts between functional and non-
functional requirements, and conflicts between the need for rapid delivery and system
evolution. You need to make decisions such as:
- What composition of components is effective for delivering the functional
requirements?
- What composition of components allows for future change?
- What will be the emergent properties of the composed system?
COMP 312 : CBSE Page 7