Component-based Software Recommended Reading

advertisement
Recommended Reading
TDDD05 Component-Based Software
DF14900 Software Engineering CUGS
„
Component-based Software
„
Introduction and overview
Christoph Kessler
Szyperski: Component Software – Beyond Object-Oriented
Programming, 2nd edition. Addison-Wesley, 2002.
Douglas McIlroy. Mass-produced software components.
http://cm.bell-labs.com/cm/cs/who/doug/components.txt
in:
P. Naur and B. Randell, "Software Engineering, Report on a
conference sponsored by the NATO Science Committee,
Garmisch, Germany, 7th to 11th October 1968", Scientific
Affairs Division, NATO, Brussels, 1969, 138-155.
Christoph Kessler, IDA,
Linköpings universitet, 2010.
C. Kessler, IDA, Linköpings universitet.
Motivation for Component Based
Development
„
„
Well known in other disciplines
„
Mechanical engineering (e.g., German DIN 2221; IEEE standards)
„
Electrical engineering
„
Architecture
„
Computer architecture
Outsourcing to component producers
„
Goal: Reuse of partial solutions
„
Easy configurability of the systems
„
TDDD05 / DF14900
Mass-produced Software Components
Managing system complexity:
Divide-and-conquer (Alexander the Great)
„
1.2
„
Garmisch 1968, NATO conference on software engineering
„
McIlroy:
„
„
Every ripe industry is based on components, since these
allow to manage large systems
Components should be produced in masses and composed
to systems afterwards
Variants, versions, product families
C. Kessler, IDA, Linköpings universitet.
1.3
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
Mass-produced Software Components
InInthe
thephrase
phrase`mass
`massproduction
productiontechniques
techniques,','my
myemphasis
emphasisisison
on
`techniques
andnot
noton
onmass
massproduction
productionplain.
plain.
`techniques' 'and
Of
Ofcourse,
course,mass
massproduction,
production,ininthe
thesense
senseofoflimitless
limitlessreplication
replication
ofofaaprototype,
prototype,isistrivial
trivialfor
forsoftware.
software.
But
Butcertain
certainideas
ideasfrom
fromindustrial
industrialtechnique
techniqueI Iclaim
claimare
arerelevant.
relevant.
- -The
Theidea
ideaofofsubassemblies
subassembliescarries
carriesover
overdirectly
directlyand
andisiswell
wellexploited.
exploited.
- -The
idea
of
interchangeable
parts
corresponds
roughly
The idea of interchangeable parts corresponds roughlytotoour
ourterm
term
`modularity,'
and
is
fitfully
respected.
`modularity,' and is fitfully respected.
- -The
Theidea
ideaofofmachine
machinetools
toolshas
hasan
ananalogue
analogueininassembly
assemblyprograms
programs
and
andcompilers.
compilers.
1.4
TDDD05 / DF14900
Mass-produced Software Components
„
Later McIlroy was with Bell Labs ...
„
„
„
... and invented pipes, diff, join, echo (UNIX).
Pipes are still today the most employed component
system!
Where are we today?
Yet
Yetthis
thisfragile
fragileanalogy
analogyisisbelied
beliedwhen
whenwe
weseek
seek
for
foranalogues
analoguesofofother
othertangible
tangiblesymbols
symbolsofofmass
massproduction.
production.
- - There
Theredo
donot
notexist
existmanufacturers
manufacturersofofstandard
standardparts,
parts,
much
less
catalogues
of
standard
parts.
much less catalogues of standard parts.
- - One
Onemay
maynot
notorder
orderparts
partstotoindividual
individualspecifications
specificationsofofsize,
size,
ruggedness,
ruggedness,speed,
speed,capacity,
capacity,precision
precisionororcharacter
characterset.
set.
C. Kessler, IDA, Linköpings universitet.
1.5
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.6
TDDD05 / DF14900
Real Component Systems
„
Definition of “Component”
Lego
“A software component is a unit of composition
with contractually specified interfaces and
explicit context dependencies only.
„
Square stones
„
Building plans
„
IC‘s
„
Hardware bus
„
How do they differ from software?
A software component
can be deployed independently and
is subject to composition by third parties.”
- C. Szyperski, ECOOP Workshop WCOP 1997.
C. Kessler, IDA, Linköpings universitet.
1.7
TDDD05 / DF14900
“A reusable software component is a
logically cohesive, loosely coupled
module that denotes a single
abstraction”
- Grady Booch
„
A component model defines specific interaction and
composition standards.
“A software component is a static abstraction with plugs.”
- Nierstrasz/Dami
Composition is the combination of two or more software
components yielding a new component behavior at a different
level of abstraction ... [which is] determined by the components
being combined and the way how they are combined.”
Sametinger:
“Reusable software components are self-contained,
clearly identifyable pieces that describe and/or perform
specific functions, have clear interfaces,
appropriate documentation, and a defined reuse status.”
TDDD05 / DF14900
Heineman / Councill [Ch.1]:
“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.
MetaGroup (OpenDoc):
“Software components are defined as prefabricated,
pretested, self-contained, reusable software modules
bundles of data and procedures - that perform specific
functions.”
1.9
1.10
C. Kessler, IDA, Linköpings universitet.
TDDD05 / DF14900
Are Objects Components??
Component as unit of composition
Szyperski [CS 4.1]:
U. Assmann (2003):
„
TDDD05 / DF14900
More Definitions of “Component” (cont.)
More Definitions of “Component”
C. Kessler, IDA, Linköpings universitet.
1.8
C. Kessler, IDA, Linköpings universitet.
A component is a container with
No!
„
An object is a unit of instantiation.
„
It has a unique identity.
„
variation points
„
It may have state, and this can be (externally) observed
„
extension points
„
It encapsulates its state and behavior.
„
that are adapted during composition
„
A component is a reusable unit for composition
„
A component underlies a component model
Components are rather prototypes / blueprints / plans
from which (stateful) objects can be instantiated
„
„
„
No (externally observable) state
„
Unit of independent deployment
„
Unit of third-party composition
abstraction level
„
composition time (static or runtime?)
C. Kessler, IDA, Linköpings universitet.
1.11
TDDD05 / DF14900
e.g., a function definition, type definition, class or set of classes
„
Only one copy required per context (e.g., process)
C. Kessler, IDA, Linköpings universitet.
1.12
TDDD05 / DF14900
Component Systems
Software Composition Systems
(Component Platforms)
„
„
We call a technology in which component-based systems can
be produced a component system or component platform.
„
A composition system has
A component system has
Component Model
Component Model
Composition Technique
Composition
Composition
Language
Language
for
forcompositions
compositionsofof
components
components
for
fordescription
descriptionofof
components
components
C. Kessler, IDA, Linköpings universitet.
for
forprogramming-in-theprogramming-in-thelarge
large
and
andarchitecture
architecture
TDDD05 / DF14900
1.13
Issues in Component/Composition Systems
„
„
„
How do components look like?
„
Secrets? (Location, lifetime, language, platform, …)?
„
Binding points, binding time?
„
Interfaces, contracts, substitutability?
„
Parameterizability? Adaptability? Extensibility?
„
Standardization of execution environment, services?
The Ladder of Component and
Composition Systems
Aspect Systems
View Systems
Software Composition Systems
Aspect Separation
Composition
Operators
Composition
Language
Architecture Systems
Web Services
How are components glued together, composed, merged, applied?
Composition time
(Compile- / Link- / Deployment- / Connection- / Run-time ...)
„
How are compositions of large systems described and managed?
TDDD05 / DF14900
1.15
The Essence of the 60s-90s:
LEGO Software
„
Procedural systems
„
Modular systems
„
Object-oriented technology
UNICON, BPEL
Uniformly Interoperable SOAP,
WSDL
Standard Components
Standard Components
.NET CORBA
Beans EJB
Object-Oriented Systems
Objects as
Run-Time Components
C++
Modular Systems
Modules as CompileTime Components
Modula
C. Kessler, IDA, Linköpings universitet.
1.16
Java
Ada-85
TDDD05 / DF14900
Blackbox Composition
Components
Component-based programming
with COTS (Components-off-the-shelf) systems
„
COMPOST
Architecture as Aspect Darwin, CoSy,
Classical
Component Systems
Composition Language
C. Kessler, IDA, Linköpings universitet.
„
TDDD05 / DF14900
1.14
Aspect-J
Composition Technique
„
„
C. Kessler, IDA, Linköpings universitet.
Component Model
„
„
Composition Technique
Connectors
Component-based
applications
CORBA, EJB, DCOM, COM+, .NET
Software architecture description languages
Blackbox composition
C. Kessler, IDA, Linköpings universitet.
1.17
TDDD05 / DF14900
Composition
recipe
C. Kessler, IDA, Linköpings universitet.
1.18
TDDD05 / DF14900
Procedures as Composition System
Procedural Systems
„
„
„
Caller
(code)
Fortran, Algol, Pascal, C, ...
The procedure is the
component
Component Model
Linker
Callee
(code)
The activation record the
instantiation
Composition Technique
Content: binary code with symbols
Connection by linking object files
Binding points: linker symbols
Program transformation on object files
procedures (with parameters) and
global variables
Composition time: link-time, static
Run-time stack contents
„
Component model is supported
by almost all processors
directly
„
JumpSubroutine instruction
„
Return instruction
CalleeAR
Caller AR addr.
Return address
call
Composition Language
ret
Run time
1.19
C. Kessler, IDA, Linköpings universitet.
CallerAR
CallerAR
CallerAR
TDDD05 / DF14900
A Linker is a Composition Operator
That Composes Modules
Modules
Module
„
„
„
TDDD05 / DF14900
1.20
C. Kessler, IDA, Linköpings universitet.
Implementation of a module
hidden behind a functional
interface
Provided
Linker
Static binding of functional
interfaces to each other
Required
Module
Concept has penetrated
almost all programming
languages (Modula, Ada,
Java, C++, Standard ML, C#)
Linker
Bound procedure
symbols (labels),
no glue code
TDDD05 / DF14900
1.21
C. Kessler, IDA, Linköpings universitet.
TDDD05 / DF14900
1.22
C. Kessler, IDA, Linköpings universitet.
UNIX Filters and Pipes
[McIlroy]
Modules as Composition System
„
Component Model
Content: groups of procedures
Binding points: linker symbols
procedures (with parameters)
and global variables
Composition Technique
UNIX shells style still offers the most used component
paradigm:
„
Communication with byte streams via standard I/O ports
„
Parsing and linearizing the objects
„
Extremely flexible, simple
Connection by linking object files
Program transformation on object files
Composition time: link-time, static
stderr
stdin
Filter
stdout
stdin
Filter
Composition Language
C. Kessler, IDA, Linköpings universitet.
1.23
pipe
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.24
TDDD05 / DF14900
Unix Filters and Pipes
as Composition System
Object-Oriented Systems
„
Component Model
Composition Technique
Content: unknown (due to parsing),
externally bytes
Adaptation: filter around other components
Binding points: stdin/out ports
Binding time: static
Components: classes
„
Filter languages such as sed, awk, perl
Secrets: distribution, parallelism
Objects are instances of classes (modules)
with unique identity
„
Objects have runtime state
„
Late binding of calls by search/dispatch at runtime
C, shell, tcl/tk, python…
Callee
Build management language makefile
Caller
Object
Version management with sccs rcs cvs
Callee
Composition Language
Callee
dispatch
TDDD05 / DF14900
1.25
C. Kessler, IDA, Linköpings universitet.
Object-Orientation
as Composition System
Component Model
Content: binary files, objects
(code and data)
TDDD05 / DF14900
1.26
C. Kessler, IDA, Linköpings universitet.
Commercial Component Systems
Composition Technique
„
CORBA / COM / .NET / EJB
„
Although different on the first sight, turn out to be rather similar
Adaptation by inheritance or delegation
Caller
Object
(Client)
Extensibility by subclassing
Binding points: static (monomorphic)
and polymorphic (dynamically
dispatched) calls
Callee
(Server)
Mediator
Composition Language
TDDD05 / DF14900
1.27
C. Kessler, IDA, Linköpings universitet.
Software bus
(D)COM, ActiveX
CORBA
„
„
„
Language independent, location/distribution transparent
interface definition language IDL
source code or binary
Client
Java
Client
C
Interface
specification
(in IDL)
Server
C++
„
Microsoft’s model is similar to CORBA. Proprietary
„
(D)COM is a binary standard
Client
VBasic
Client
C++
Server
C++
Server
C++
COM stub
COM stub
COM
skeleton
IDL
skeleton
generate
Stub
Stub
Skeleton
Object adapter
Object adapter
Object Request Broker (ORB), Trader, Services
C. Kessler, IDA, Linköpings universitet.
TDDD05 / DF14900
1.28
C. Kessler, IDA, Linköpings universitet.
1.29
Monikers, Registry
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.30
TDDD05 / DF14900
Java Beans
„
„
DOT-NET
Java only: source code / bytecode-based
Event-based, transparent distribution by remote method
invocation (RMI – includes Java Object Serialization)
Bean
Java
Bean
Java
Bean
Java
„
Language independent, distribution transparent
„
NO interface definition language IDL (at least for C#)
„
source code or bytecode MSIL
„
Common Language Runtime CLR
Server
C++
IDL
skeleton
Client
Java
Client
C#
Server
C++
.net-CLR
.net-CLR
.net-CLR
Object adapter
Event InfoBus, RMI
CLR
TDDD05 / DF14900
1.31
C. Kessler, IDA, Linköpings universitet.
CORBA/DCOM/JavaBeans/...:
Components Off-The-Shelf (COTS)
Component Model
Content: binary components
Web Services
Composition Technique
„
Binding procedure is interpreted, not compiled
„
More flexible:
Adaptation for distributed systems
(marshalling) and mixed-language systems
(IDL)
Binding points are standardized
Described by IDL,
set/get properties,
Standard interfaces (IUnknown...)
TDDD05 / DF14900
1.32
C. Kessler, IDA, Linköpings universitet.
„
When interface changes, no recompilation and rebinding
„
Ubiquitous http protocol – independent of a specific ORB
Dynamic call in CORBA
SOAP
interpretatio
n
Secrets: distribution, language
VisualBasic for COM
Caller
Object
Callee
(Server)
Composition Language
Mediator
TDDD05 / DF14900
1.33
C. Kessler, IDA, Linköpings universitet.
C. Kessler, IDA, Linköpings universitet.
Component Model in
Software Architecture Systems
Web Services as Composition System
„
Component Model
Composition Technique
Content: not important
Adaptation for distributed systems
(marshalling) and mixed-language systems
Binding points are described by XML
Binding procedure is interpretation of SOAP
Secrets: distribution, implementation language
TDDD05 / DF14900
1.34
Ports abstract interface points
(as in Linda)
„
in(data), out(data)
„
Components may be nested
Interface
Port
Role
Glue: WSDL, SOAP, HTTP
Dynamic discovery/binding with UDDI
„
Connectors are special
communication components
„
BPEL
„
Abstract from technology
(e.g. component system)
Specify connectivity
(topology,
system architecture)
Connector
Composition Language
C. Kessler, IDA, Linköpings universitet.
1.35
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.36
TDDD05 / DF14900
Software Architecture Systems
Architecture / Communication can be
varied independently of components
Unicon, ACME, Darwin, …
„
Port 1
feature an Architecture Description Language (ADL)
„
Component
Port
Split an application into two concerns:
„
Component
Port
Port 2
Application-specific part
(encapsulated in components)
„
Component
Architecture and communication
(in connectors defined in architecture description,
written in ADL)
„
„
Æ Better reuse since both dimensions can be varied
independently
„
C. Kessler, IDA, Linköpings universitet.
1.37
TDDD05 / DF14900
Reuse of components and architectures is fundamentally
improved
High-level system analysis, verification, testing
TDDD05 / DF14900
1.38
C. Kessler, IDA, Linköpings universitet.
Software Architecture Systems
as Composition Systems
ACME Studio
Component Model
Composition Technique
Source or binary components
Adaptation and glue code by connectors
Binding points: ports
Scaling by exchange of connectors
Architectural language (ADL)
Composition Language
C. Kessler, IDA, Linköpings universitet.
1.39
TDDD05 / DF14900
The Essence of Blackbox Composition
Components
C. Kessler, IDA, Linköpings universitet.
The Ladder of Component and
Composition Systems
Aspect Systems
View Systems
Aspect Separation
Composition
Operators
Aspect-J
Connectors
Component-based
applications
Architecture Systems
Composition recipe
Web Services
„
Blackbox composition supports variability and adaptation
„
but not extensibility
C. Kessler, IDA, Linköpings universitet.
1.41
TDDD05 / DF14900
TDDD05 / DF14900
1.40
Composition Filters
Hyperslices
Software Composition Systems
Composition
Language
COMPOST
Architecture as Aspect Darwin, CoSy,
UNICON, BPEL
Uniformly Interoperable SOAP,
WSDL
Standard Components
Classical
Component Systems
Standard Components
.NET CORBA
Beans EJB
Object-Oriented Systems
Objects as
Run-Time Components
C++
Modular Systems
Modules as CompileTime Components
Modula
C. Kessler, IDA, Linköpings universitet.
1.42
Java
Ada-85
TDDD05 / DF14900
TDDD05 Component-Based Software
Aspects in Architecture
DF14900 Software Engineering CUGS
Media plan
Structure
Graybox Component Models
Component integration
- Aspect oriented programming
Water pipe plan
Light plan
- View-based composition
Integrated
house
Christoph Kessler, IDA,
Linköpings universitet, 2010.
Aspects in Software
Aspect Systems
„
Debugging
aspect
Persistence
aspect
Algorithm
Weaver-Tool
„
Aspect languages
„
Every aspect in a separate language
„
Domain specific
„
Weaver must be built (is a compiler, much effort)
Script-based Weavers
„
„
Debugging aspect
Persistence aspect
Debugging aspect
Debugging aspect
TDDD05 / DF14900
This introduces the aspect into the core
Aspects are crosscutting
Component Model
Aspect
Core
„
Distributor
TDDD05 / DF14900
1.46
C. Kessler, IDA, Linköpings universitet.
Aspect Systems
as Composition Systems
Aspect Weavers Distribute Advice
Components over Core Components
„
The weaver interprets a specific script or aspect
program
Persistence
aspect
1.45
C. Kessler, IDA, Linköpings universitet.
TDDD05 / DF14900
1.44
C. Kessler, IDA, Linköpings universitet.
Hence, aspect functionality
must be distributed over the
core
Core- and aspect components
Aspects are relative and
crosscutting
Composition Technique
Adaptation and glue code by weaving
Weaving is distribution of code snippets
Bindung points: join points
Weaving language
e.g. Aspect-J
Composition Language
C. Kessler, IDA, Linköpings universitet.
1.47
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.48
TDDD05 / DF14900
Composition Systems
Composition Systems
with composition operators and expressions
with composition operators and expressions
„
Hyperspace Programming [Ossher et al., IBM]
„
Piccola [Nierstrasz, et.al., Berne]
„
Metaclass composition [Forman/Danforth, Cointe]
„
Invasive software composition [Aßmann 2003]
„
Formal calculi
„
Lambda-N calculus [Dami]
„
Pi-L calculus [Lumpe]
Composition Technique
Component Model
Composition Operators
Composition
Expressions
Composition Language
TDDD05 / DF14900
1.49
C. Kessler, IDA, Linköpings universitet.
Library
Client
■
Invasive
Composition
Blackbox
Composition
Library
Client
TDDD05 / DF14900
1.50
Composers can be used for inheritance
Invasive Composition of Components
Client
C. Kessler, IDA, Linköpings universitet.
A mixin is a class (i.e., a set of
features) by which a superclass
can be extended to derive a
subclass. The mixin class itself is
final, i.e., cannot be subclassed.
inherit
Library
Extension can be used for
inheritance (mixins)
■
Mixin-based inheritance:
■
■
Invasive Connection
Blackbox connection with glue code
TDDD05 / DF14900
1.51
C. Kessler, IDA, Linköpings universitet.
Composers Generalize
Aspect Weavers in AOP
„
Aspect
C. Kessler, IDA, Linköpings universitet.
„
Distributor
„
TDDD05 / DF14900
1.52
Composition Languages
Complex composers
distribute aspect fragments
over core fragments
„
„
Core
copy first superclass
extend with fragments of
second superclass (mixin)
Distributors extend the core
Distributors are more
complex operators, defined
from basic ones
„
„
Composition languages
describe the structure and build process of the system in-thelarge (“programming in the large”)
Composition programs combine the basic composition
operations of the composition language
Composition languages can look quite different
„
Imperative: e.g. Java+library (in COMPOST)
„
Declarative: e.g. ADL, Aspect-J, Makefiles, C++ templates
Enables us to describe large systems
Composition program size
System size
C. Kessler, IDA, Linköpings universitet.
1.53
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.54
1
10
TDDD05 / DF14900
Conclusions for Composition Systems
„
Components have a composition interface
„
Composition interface is different from functional interface
„
„
Marks possible places for code injection in components
The composition is running usually before the execution
of the system
„
„
Invasive Software Composition
as Composition System
Usually, at/before compile time or deployment time
Component model
Composition technique
Source or binary components
Controlled by composition programs
Greybox components
Library of composition operators
(basic and compound operators)
Composition interfaces
with declared an implicit hooks
System composition becomes a new step in system build
System composition (System generation)
In COMPOST:
Standard Language (Java) +
metaprogramming library
System compilation
System deployment
Composition language
System execution
C. Kessler, IDA, Linköpings universitet.
1.55
TDDD05 / DF14900
Summary:
Component-based Systems
„
... are produced by component systems or composition systems
„
... support a component model
„
Blackbox composition supports variability and adaptation
„
Greybox composition also supports extensibility
C. Kessler, IDA, Linköpings universitet.
1.57
TDDD05 / DF14900
C. Kessler, IDA, Linköpings universitet.
1.56
TDDD05 / DF14900
Download