Lecture05 01 Components
Lecture05 01 Components
屈建勤, 蔡浩
Components
Many software managers envy hardware engineers
because of the ease in which they can construct
products from pre-existing components
For example, electronic systems are built by plugging
together chips, boards or boxes that are widely interoperable
A well-chosen set of components can have many possible
configurations, resulting in end products that can be made
quickly and reliably
Over the last few years, the same thing has begun to
happen in software: word processors can talk to
spreadsheets, and graphs to databases, etc.
Standards such as COM and CORBA permit components to
be `plugged together' in different languages and platforms
Component based development
Component based development (CBD) is a buzz
word for the new millennium. However, how do
components differ from modules and objects?
Some basic definitions:
Component based development: An approach to
software development in which all artefacts can be
built by assembling, adapting and "wiring" together
existing components in a variety of configurations
Component: A coherent package of software
artefacts that can be independently developed and
delivered as a unit and that can be composed with
other components to build something larger
Examples
All the following conform to the above definitions:
Using some user interface widgets, such a list boxes,
and connecting them to appropriate data sources
Using a collection class in Java
Using an off the shelf calendar package, word
processor and spreadsheet in an assemblage of
several components and writing scripts to link them
together
Using a class framework, such as Java's Swing
components, to build the user interfaces for many
applications
Using predefined language constructs, e.g. for (...) {...}
Implementation Components
Although components can be artefacts at any level of
abstraction, it is most common to think of them at the
software level.
In this case, a component is viewed as:
a coherent package of software implementation that:
can be independently developed and delivered (even sold!)
has explicit and well-specified interfaces for the services it
provides
has explicit and well-specified interfaces for services it expects
from others
can be composed with other components, perhaps customizing
some of their properties, without modifying the components
Component Interfaces
o1 o2
S (o1) S (o2)
IDL IDL
stub skeleton
1 1..*
1
Kernel
1..* Resource
Bootstrap Loads
maxUsers : int
SystemProcessGroup UserProcessGroup 1 1 loadModule(m: Module)() 1 Controls Allocation of
unloadModule(m: Module)()
1 1
1
Controls, Allocates
Resources to CPU
Module I/O Device Memory
0..* kernelMode : Boolean
programCounter : long size : int
GeneralProcess
processID : int loadContext (pc : processContext)()
priority : int TemporaryMemory
programCounter : long Owns PermanentMemory
freeSpace : long
creationTime : long creationDate : date
usedSpace : long
CPUTimeUsed : long 1 1..*
IOTimeUsed : long
registerList : RegisterList 1 I/O Module
1
0..*
0..*
SystemProcess UserProcess
1
1..*
Note: I/O is given as an example. Kernel
I/O Policy 1 1..* I/O Mechanism will also include Scheduler Module,
Process Communication Module etc.
Uses to action Policy