Component-Based Software Engineering
Reading:
http://www.components-online.com/Component/Introduction/default.htm
Overview
What is a component?
What is a component-based system?
Is component-based software engineering unique?
Typical component technologies
Emerging technologies
Problems in CBSE
What is a component?
Again, a too-common, multiple-meaning word
Already used to talk about functions, objects, source files,
etc.
Stevens and Pooley: "A component may be a module with properties
that make it reusable and replaceable." (Ch1)
Booch: "A component is a physical and replaceable part of a
system that conforms to, and provides the realization of, a set
of interfaces." (quoted in our textbook, Ch18)
Clements Szyperski: A unit of deployment, binary, stateless, singleton
Article thread between Meyer and Szyperski:
http://www.sdmagazine.com/documents/s=752/sdm9911k/9911k.htm
http://www.sdmagazine.com/documents/s=747/sdm0002l/0002l.htm
http://www.sdmagazine.com/documents/s=746/sdm0003k/0003k.htm
http://www.sdmagazine.com/documents/s=744/sdm0005l/0005l.htm
Meyer: "Seven Criteria for Components:
(from
http://www.sdmagazine.com/documents/s=746/sdm0003k/0003k.htm
- May be used by other software elements (clients).
- May be used by clients without the intervention of the component's
developers.
- Includes a specification of all dependencies (hardware and software
platform, versions, other components).
- Includes a precise specification of the functionalities it offers.
- Is usable on the sole basis of that specification.
- Is composable with other components.
- Can be integrated into a system quickly and smoothly."
BTW, You could not go wrong reading Bertrand Meyer's Object
Oriented Software Construction. See some comments at
http://archive.eiffel.com/doc/oosc/page.html
Heineman and Council:
- "A software component is a software element that conforms
to a component model and can be independently deployed and composed
without modification according to a composition standard."
- "A component model defines specific interaction and composition
standards. A component model implementation is the dedicated set of
executable software elements required to support the execution of
components that conform to the model."
- "A software component infrastructure is a set of interacting
software components design to ensure that a software system or
subsystem constructed using those components and interfaces will
satisfy clearly-defined performance specifications."
Important aspects of a component:
- Independent deployment: e.g., executable, shared library, .class
file, jar file, perl module, plus many other mechanisms
- Having this does not necessarily mean you are doing CBSE!
- Interaction standard: well-defined mechanisms for component
interaction.
- Composition standard:
- Interfaces
- "Properties that make it reusable and replaceable": S+P go on
to say "it has high cohesion, low coupling, a well-defined interface,
and is an encapsulated abstraction of a well-understood thing."
Q: Can you have build-time components and not deployment-time
components? (The class voted about 50-50 on this one. My
(JC) preference is, in the context of CBSE, reserve the word
component for (build+deploy+run)-time entities, and not just
build-time entities.)
What is a component-based system?
A system built with components?
A set of interacting components using an infrastructure
possibly including non-component glue code, which embody the
application behavior.
Infrastructure: some underlying technological framework that
defines how components interact, and supports that interaction.
Generally called middleware.
Glue code: code that enables components with mismatched
interfaces to interoperate, and that may perform minor application
computations itself to augment or better utilize component behaviors.
Is component-based software engineering unique?
Yes: it adds new and important steps in the development process.
No: we've been doing those for years, anyways.
Maybe: these steps become the most important rather than minor steps.
Steps in CBSE:
- Look for subsets of requirements likely to be provided for by
a component.
- Look for subsets of design likely to be provided for by a
component.
- Search for components that fulfill needs.
- Select components (possibly with a small set of alternates) that
you will use.
- Sign legal agreements with component providers.
- Understand selected components in detail. (learn/discover interface)
- Possibly test components to ensure satisfactory performance.
- Build new components as needed.
- Find mismatches between components. (adaptation)
- Write glue code to patch mismatches and add features.
- Test composed system (and subsystem compositions)
- Configure deployable components and system
- Maintenance: keep up with component changes (changes may not
come on your schedule. Or be coordinated.
- Review new version of component.
- Find upgrade dependencies.
- Modify glue code if necessary.
- Test new versions in house.
- Deploy matched sets of component versions.
Typical component technologies
Often see layered technology specifications.
|
| Domain-specific interfaces |
| Interface standards |
| Interface specification |
| Interaction and Deployment |
Bottom layer is often dynamic link libraries (shared libraries)
in C/C++/compiled environments, and Java class loading in Java-based
environments. (Yes there are plenty of other environments but these
two cover ALOT!). If distributed interaction is supported then
some messaging over TCP/IP is generally the rule.
Browser Plugins -- essentially a C API? Find out at
http://devedge.netscape.com/library/manuals/2002/plugin/1.0/
Eclipse Plugins -- essentially a Java API? Find out at
http://www.eclipse.org/documentation/html/ and you can
Look here for detailed stuff
COM/DCOM: Microsoft's Component Object Model
- Specify and utilize component interfaces
- Globally unique interface identifiers
- Interfaces are immutable, thus no version problems!
- Single inheritance of interfaces
- No built-in exceptions, but functions return HRESULT
- DCOM is built on RPC
- See
http://www.cs.umd.edu/~pugh/com/
[
object,
//Use the GUID for the ILookup interface.
uuid(c4910d71-ba7d-11cd-94e8-08001701a8a3),
pointer_default(unique)
]
interface ILookup : IUnknown // ILookup interface derives from IUnknown.
{
import "unknwn.idl"; // Bring in the supplied IUnknown IDL.
// Define member function LookupByName:
HRESULT LookupByName( [in] LPTSTR lpName, [out, string] WCHAR **lplpNumber);
// Define member function LookupByNumber:
HRESULT LookupByNumber( [in] LPTSTR lpNumber, [out, string] WCHAR **
lplpName);
}
OLE, ActiveX, VBX - built on top of COM
CORBA - Common Object Request Broker Architecture. Find more at
http://www.omg.org/
- Is a specification, NOT an implementation
- Defines how to specify and support distributed objects and
their runtime communication
- ORB -- Object Request Broker -- is the central middleware
entity that supports and manages CORBA objects
- IDL - interface definition language (very C++-like)
- multiple inheritance of interfaces
- Built-in exceptions (functions return what they want)
- Objects have unique IDs, but interfaces do not
- A long example is at
http://edocs.bea.com/tuxedo/tux80/samples/basic.htm#1058603
- A short example:
#include "nawSeq.idl" // include sequence definitions
interface nawdemo {
short cur_set ( in string abbrev,
in float exchRate,
in string description);
short cur_get ( in string abbrev,
out short nbCur,
out NawStringSeq abbrevSeq,
out NawFloatSeq exchRateSeq,
out NawStringSeq descSeq);
short cur_remove ( in string abbrev );
short cur_convert ( in string source,
in string target,
in double sourceAmount,
in short precision,
out double targetAmount);
};
- Corba Component Model. Read at
http://www.omg.org/technology/documents/formal/components.htm
- CCM is meant to mirror EJB
- CCM has ports -- (facets (provided), receptacles (required),
event sources/sinks, attributes (properties))
- Each facet/receptacle is a distinct IDL interface
JavaBeans
- Introspection, customization, events, properties, persistence
- Simple Name Matching interface discovery (design patterns!),
Or a BeanInfo class
- Methods, events, properties (T getP(), setP(T))
- Assume multi-threaded access
- Bean is an object (still?)
- Event-centered architecture (e.g., addEListener(EListener E))
- Design-time vs. run-time. E.g., BeanCustomizer classes, property
sheets, etc.
Enterprise Java Beans
- Generally "business logic" types of behavior
- Run in a container (typically server-side or middle tier)
- Accessor is generally a client
- Remote interface -- through EJB container
- Local interface -- general Java API stuff
- Home interface? -- bean creation/destruction/lookup?
- Different types of beans --
- session: single-client session handler, transient
- entity: DB "interface", multiple clients, persistent, transactional.
each bean represents a data object (row in relational table)
- message-driven: implements response to a single client message;
transient, maybe transactional, container is optimized to handle many
- Method oriented rather than event oriented?
- Container handles things like transactions, security, connections,
threads, persistence, etc.
- Allows customized (but non-compliant) containers to enable
customized (but non-compliant) EJB's
Commentary on Relationship Between JavaBeans and EJB
- "They are both based on components and they are both called beans.
Beyond that they are a different kettle of fish altogether." - from JavaRanch
- Bean = client side, GUI oriented; EJB = server side, non-GUI oriented
- EJB adds transactions, persistence*, and scalability, distributedness
- EJB is a deployable component; bean is a development component
*Note: Java Beans also provide/require persistence.
A Bean Example (from java.sun.com)
Introspector doesn't depend on a bean subclassing off an abstract bean
class; bean-ness is largely a matter of either (a) following naming
conventions (such as get/set for properties) with some assumed or required
semantics, or (b) providing a supporting BeanInfo class to customize the
introspection.
try {
BeanInfo bi = Introspector.getBeanInfo(MyBean.class);
PropertyDescriptor[] pds = bi.getPropertyDescriptors();
for (int i=0; i<pds.length; i++) {
// Get property name
String propName = pds[i].getName();
}
// class, prop1, prop2, PROP3
} catch (java.beans.IntrospectionException e) {
}
public class MyBean {
// Property prop1
public String getProp1() {
return null;
}
public void setProp1(String s) {
}
// Property prop2
public int getProp2() {
return 0;
}
public void setProp2(int i) {
}
// Property PROP
public byte[] getPROP3() {
return null;
}
public void setPROP3(byte[] bytes) {
}
}
SOAP
- Simple Object Access Protocol
- XML-based request/reply messages over HTTP
- Nice things like named parameters (receiver might ignore some)
- Bad things like bandwidth waste
.NET
- Component architecture w/ SOAP as remote invocation mechanism
- CLR - Common Language Runtime
- binary specification for common property/method/field access
- includes enough to be able to inherit across language boundaries
- shared libraries (components) are versioned
- JIT compiling from intermediate language (MSIL)
- MSIL carries more type and name information -- for, e.g., dynamic
service discovery and use
- Mono - Linux .NET implementation (
http://www.go-mono.com/)
Web Services - Web component interaction and composition architecture.
Find more at http://www.w3.org/, and
a quick link to the architecture description is at
http://www.w3.org/TR/2003/WD-ws-arch-20030808/
- Standards on top of SOAP for component discovery, binding, and use
- Heavy use of XML
- WSDL - Web Services Description Language
Problems in CBSE
Naming dependence -- we're still stuck with exporting names and
using specific names
Still no semantics associated with interfaces. Not even simple
preconditions and postconditions
What about versions?
Emerging technologies
Semantic Web (
http://www.w3c.org/2001/sw/)
No real attempts to migrate ADL's to CBSE?
Component Certification (a la UL)?