<<

TDDD05 Component-Based Software Recommended Reading DF14900 Software Engineering CUGS

„ Szyperski: Component Software – Beyond Object-Oriented nd Component-based Software Programming, 2 edition. Addison-Wesley, 2002.

„ Douglas McIlroy. Mass-produced software components. http://cm.bell-labs.com/cm/cs/who/doug/components.txt Introduction and overview in: P. Naur and B. Randell, "Software Engineering, Report on a Christoph Kessler 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. . Kessler, IDA, Linköpings universitet. 1.2 TDDD05 / DF14900

Motivation for Component Based Mass-produced Software Components Development

„ Managing system complexity: „ Garmisch 1968, NATO conference on software engineering Divide-and-conquer (Alexander the Great)

„ McIlroy: „ Well known in other disciplines

„ Mechanical engineering (e.g., German DIN 2221; IEEE standards) „ Every ripe industry is based on components, since these „ Electrical engineering allow to manage large systems „ Architecture „ „ Computer architecture Components should be produced in masses and composed to systems afterwards

„ Outsourcing to component producers

„ Goal: Reuse of partial solutions

„ Easy configurability of the systems

„ Variants, versions, product families

C. Kessler, IDA, Linköpings universitet. 1.3 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.4 TDDD05 / DF14900

Mass-produced Software Components Mass-produced Software Components

„ Later McIlroy was with Bell Labs ... InIn the the phrase phrase ` mass`mass production production techniques techniques,',' my my emphasis emphasis is is on on `techniques' and not on mass production plain. `techniques' and not on mass production plain. „ ... and invented pipes, diff, join, echo (UNIX). OfOf course, course, mass mass production, production, in in the the sense sense of of limitless limitless replication replication ofof a a prototype, prototype, is is trivial trivial for for software. software. „ Pipes are still today the most employed component system! ButBut certain certain ideas ideas from from industrial industrial technique technique I Iclaim claim are are relevant. relevant. -- The The idea idea of of subassemblies subassemblies carries carries over over directly directly and and is is well well exploited. exploited. - The idea of interchangeable parts corresponds roughly to our term - The idea of interchangeable parts corresponds roughly to our term „ Where are we today? `modularity,'`modularity,' and and is is fitfully fitfully respected. respected. -- The The idea idea of of machine machine tools tools has has an an analogue analogue in in assembly assembly programs programs andand compilers. compilers.

YetYet this this fragile fragile analogy analogy is is belied belied when when we we seek seek forfor analogues analogues of of other other tangible tangible symbols symbols of of mass mass production. production. -- There There do do not not exist exist manufacturers manufacturers of of standard standard parts, parts, muchmuch less less catalogues catalogues of of standard standard parts. parts. -- One One may may not not order order parts parts to to individual individual specifications specifications of of size, size, ruggedness,ruggedness, speed, speed, capacity, capacity, precision precision or or character character set. 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 „ Square stones explicit context dependencies only. A software component „ Building plans can be deployed independently and is subject to composition by third parties.” „ IC‘s - C. Szyperski, ECOOP Workshop WCOP 1997.

„ Hardware bus

„ How do they differ from software?

C. Kessler, IDA, Linköpings universitet. 1.7 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.8 TDDD05 / DF14900

More Definitions of “Component” (cont.) More Definitions of “Component” “A reusable software component is a

logically cohesive, loosely coupled „ Heineman / Councill [Ch.1]: module that denotes a single abstraction” “A software component is a software element MetaGroup (OpenDoc): -Grady Booch that conforms to a component model “Software components are defined as prefabricated, and can be independently deployed and composed pretested, self-contained, reusable software modules without modification according to a composition standard. bundles of data and procedures - that perform specific functions.” A component model defines specific interaction and “A software component is a static abstraction with plugs.” composition standards. -Nierstrasz/Dami Sametinger: Composition is the combination of two or more software “Reusable software components are self-contained, components yielding a new component behavior at a different clearly identifyable pieces that describe and/or perform level of abstraction ... [which is] determined by the components specific functions, have clear interfaces, being combined and the way how they are combined.” appropriate documentation, and a defined reuse status.”

C. Kessler, IDA, Linköpings universitet. 1.9 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.10 TDDD05 / DF14900

Are Objects Components?? Component as unit of composition Szyperski [CS 4.1]: No! U. Assmann (2003): „ An object is a unit of instantiation.

„ A component is a container with „ 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 Components are rather prototypes / blueprints / plans from which (stateful) objects can be instantiated „ A component is a reusable unit for composition „ e.g., a function definition, type definition, class or set of classes

„ A component underlies a component model „ No (externally observable) state

„ Only one copy required per context (e.g., process) „ abstraction level

„ Unit of independent deployment „ composition time (static or runtime?)

„ Unit of third-party composition C. Kessler, IDA, Linköpings universitet. 1.11 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.12 TDDD05 / DF14900 Component Systems (Component Platforms) Software Composition Systems

„ A composition system has „ We call a technology in which component-based systems can be produced a component system or component platform.

„ A component system has

Component Model Composition Technique

Component Model Composition Technique CompositionComposition for description of forfor compositions compositions of of LanguageLanguage for description of components componentscomponents components forfor programming-in-the- programming-in-the- largelarge andand architecture architecture

C. Kessler, IDA, Linköpings universitet. 1.13 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.14 TDDD05 / DF14900

Issues in Component/Composition Systems The Ladder of Component and Composition Systems „ Component Model Software Compo- „ How do components look like? Aspect Systems View Systems sition Systems „ Secrets? (Location, lifetime, language, platform, …)? Aspect Separation Composition Composition „ Binding points, binding time? Operators Language Aspect-J COMPOST „ Interfaces, contracts, substitutability? Architecture as Aspect Darwin, CoSy, „ Parameterizability? Adaptability? Extensibility? Architecture Systems UNICON, BPEL

„ Standardization of execution environment, services? Web Services Uniformly Interoperable SOAP, „ Composition Technique Standard Components WSDL

„ How are components glued together, composed, merged, applied? Classical Standard Components .NET CORBA Component Systems Beans EJB „ Composition time (Compile- / Link- / Deployment- / Connection- / Run-time ...) Objects as Object-Oriented Systems C++ Java Run-Time Components „ Composition Language

„ How are compositions of large systems described and managed? Modular Systems Modules as Compile- Modula Ada-85 Time Components C. Kessler, IDA, Linköpings universitet. 1.15 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.16 TDDD05 / DF14900

The Essence of the 60s-90s: Blackbox Composition LEGO Software

„ Procedural systems

„ Modular systems Components

„ Object-oriented technology

„ Component-based programming with COTS (Components-off-the-shelf) systems Connectors Component-based „ CORBA, EJB, DCOM, COM+, .NET applications

„ Software architecture description languages

Composition recipe Blackbox composition

C. Kessler, IDA, Linköpings universitet. 1.17 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.18 TDDD05 / DF14900 Procedural Systems Procedures as Composition System Caller „ Fortran, Algol, Pascal, C, ... (code)

„ The procedure is the Linker Component Model Composition Technique component Content: binary code with symbols Connection by linking object files Callee (code) Binding points: linker symbols on object files „ The activation record the procedures (with parameters) and Composition time: link-time, static instantiation global variables Run-time stack contents

„ Component model is supported Callee- by almost all processors AR directly Caller AR addr. Return address Caller- Caller- Caller- „ JumpSubroutine instruction AR AR AR Composition Language „ Return instruction call ret

C. Kessler, IDA, Linköpings universitet. 1.19 Run time TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.20 TDDD05 / DF14900

Modules A Linker is a Composition Operator That Composes Modules Module

„ Implementation of a module hidden behind a functional Provided interface Linker

„ Static binding of functional Required interfaces to each other Module

„ Concept has penetrated almost all programming Linker languages (Modula, Ada, Java, C++, Standard ML, C#)

Bound procedure symbols (labels), no glue code

C. Kessler, IDA, Linköpings universitet. 1.21 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.22 TDDD05 / DF14900

UNIX Filters and Pipes [McIlroy] Modules as Composition System

„ UNIX shells style still offers the most used component paradigm: Component Model Composition Technique

„ Communication with byte streams via standard I/O ports Content: groups of procedures Connection by linking object files „ and linearizing the objects Binding points: linker symbols Program transformation on object files

procedures (with parameters) Composition time: link-time, static „ Extremely flexible, simple and global variables stderr

stdin Filter stdout stdin

Filter Composition Language pipe

C. Kessler, IDA, Linköpings universitet. 1.23 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.24 TDDD05 / DF14900 Unix Filters and Pipes as Composition System Object-Oriented Systems

„ Components: classes

Component Model Composition Technique „ Objects are instances of classes (modules)

Content: unknown (due to parsing), Adaptation: filter around other components with unique identity externally bytes Filter languages such as sed, awk, „ Objects have runtime state Binding points: stdin/out ports Binding time: static Secrets: distribution, parallelism „ Late binding of calls by search/dispatch at runtime

C, shell, tcl/tk, python… Callee Build management language makefile Caller Callee Version management with sccs rcs cvs Object

Composition Language Callee dispatch C. Kessler, IDA, Linköpings universitet. 1.25 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.26 TDDD05 / DF14900

Object-Orientation Commercial Component Systems as Composition System

„ CORBA / COM / .NET / EJB

Component Model Composition Technique „ Although different on the first sight, turn out to be rather similar Content: binary files, objects (code and data) Adaptation by inheritance or delegation Binding points: static (monomorphic) Extensibility by subclassing Caller Callee and polymorphic (dynamically Object (Server) dispatched) calls (Client) Mediator

Composition Language

Software bus C. Kessler, IDA, Linköpings universitet. 1.27 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.28 TDDD05 / DF14900

()COM, ActiveX CORBA

„ Language independent, location/distribution transparent „ Microsoft’s model is similar to CORBA. Proprietary

„ interface definition language IDL

„ source code or binary „ (D)COM is a binary standard Interface specification Client Client (in IDL) Server Client Client Server Server Java C C++ VBasic C++ C++ C++ generate COM IDL Stub Stub COM stub COM stub Skeleton skeleton skeleton

Object adapter Object adapter

Object Request Broker (ORB), Trader, Services Monikers, Registry

C. Kessler, IDA, Linköpings universitet. 1.29 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.30 TDDD05 / DF14900 Java Beans DOT-NET

„ Java only: source code / bytecode-based „ Language independent, distribution transparent

„ Event-based, transparent distribution by remote method „ NO interface definition language IDL (at least for C#) invocation (RMI – includes Java Object Serialization) „ source code or bytecode MSIL

„ Common Language Runtime CLR Bean Bean Bean Server Java Java Java C++ Client Client Server Java C# C++ IDL skeleton .net-CLR .net-CLR .net-CLR Object adapter

Event InfoBus, RMI CLR

C. Kessler, IDA, Linköpings universitet. 1.31 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.32 TDDD05 / DF14900

CORBA/DCOM/JavaBeans/...: Web Services Components Off-The-Shelf (COTS)

„ Binding procedure is interpreted, not compiled

„ More flexible: Component Model Composition Technique

Content: binary components „ When interface changes, no recompilation and rebinding Adaptation for distributed systems Binding points are standardized (marshalling) and mixed-language systems „ Ubiquitous http protocol – independent of a specific ORB Described by IDL, (IDL) set/get properties, Standard interfaces (IUnknown...) Dynamic call in CORBA SOAP Secrets: distribution, language interpretatio n

VisualBasic for COM Caller Callee Object (Server) Composition Language Mediator C. Kessler, IDA, Linköpings universitet. 1.33 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.34 TDDD05 / DF14900

Component Model in Web Services as Composition System Software Architecture Systems

„ Ports abstract interface points Component Model Composition Technique (as in Linda)

Content: not important „ in(data), out(data) Adaptation for distributed systems Interface Binding points are described by XML (marshalling) and mixed-language systems „ Components may be nested Port Role Binding procedure is interpretation of SOAP Glue: WSDL, SOAP, HTTP Secrets: distribution, implementation language Dynamic discovery/binding with UDDI „ Connectors are special communication components

„ Abstract from technology (e.g. component system) BPEL „ 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 Component Port „ Split an application into two concerns: Port 2 „ Application-specific part (encapsulated in components) Component „ Architecture and communication (in connectors defined in architecture description, written in ADL)

„ Reuse of components and architectures is fundamentally Æ Better reuse since both dimensions can be varied improved independently „ High-level system analysis, verification, testing

C. Kessler, IDA, Linköpings universitet. 1.37 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.38 TDDD05 / DF14900

ACME Studio Software Architecture Systems as Composition Systems

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 C. Kessler, IDA, Linköpings universitet. 1.40 TDDD05 / DF14900

The Ladder of Component and The Essence of Blackbox Composition Composition Systems

Aspect Systems View Systems Software Compo- sition Systems Components Aspect Separation Composition Composition Operators Language Composition Filters Aspect-J COMPOST Connectors Hyperslices Component-based applications Architecture as Aspect Darwin, CoSy, Architecture Systems UNICON, BPEL Composition recipe Web Services Uniformly Interoperable SOAP, Standard Components WSDL

Classical Standard Components .NET CORBA „ Blackbox composition supports variability and adaptation Component Systems Beans EJB

„ but not extensibility Objects as Object-Oriented Systems C++ Java Run-Time Components

Modular Systems Modules as Compile- Modula Ada-85 Time Components C. Kessler, IDA, Linköpings universitet. 1.41 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.42 TDDD05 / DF14900 TDDD05 Component-Based Software DF14900 Software Engineering CUGS Aspects in Architecture

Media plan Structure Graybox Component Models

Component integration - Aspect oriented programming Light plan Water pipe plan - View-based composition Integrated house

Christoph Kessler, IDA, Linköpings universitet, 2010. C. Kessler, IDA, Linköpings universitet. 1.44 TDDD05 / DF14900

Aspects in Software Aspect Systems

„ Aspect languages Debugging aspect „ Every aspect in a separate language Persistence Algorithm aspect „ Domain specific

„ Weaver must be built (is a compiler, much effort)

Weaver-Tool „ Script-based Weavers

„ The weaver interprets a specific script or aspect program

Debugging aspect „ This introduces the aspect into the core Persistence aspect Debugging aspect Persistence Debugging aspect aspect C. Kessler, IDA, Linköpings universitet. 1.45 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.46 TDDD05 / DF14900

Aspect Weavers Distribute Advice Aspect Systems Components over Core Components as Composition Systems

„ Aspects are crosscutting Component Model Composition Technique Aspect „ Hence, aspect functionality Core- and aspect components Adaptation and glue code by weaving must be distributed over the Aspects are relative and Weaving is distribution of code snippets Core core crosscutting Distributor 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]

„ composition [Forman/Danforth, Cointe] Composition Technique Component Model „ Invasive software composition [Aßmann 2003] Composition Operators

„ Formal calculi

„ Lambda-N calculus [Dami]

„ Pi-L calculus [Lumpe] Composition Expressions

Composition Language

C. Kessler, IDA, Linköpings universitet. 1.49 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.50 TDDD05 / DF14900

Invasive Composition of Components Composers can be used for inheritance

Client Library ■ Extension can be used for inheritance (mixins)

A mixin is a class (i.e., a set of features) by which a superclass can be extended to derive a Blackbox Invasive subclass. The mixin class itself is Composition Composition inherit final, i.e., cannot be subclassed.

Client Library Client Library ■ Mixin-based inheritance:

■ copy first superclass

■ extend with fragments of second superclass (mixin) Blackbox connection with glue code Invasive Connection

C. Kessler, IDA, Linköpings universitet. 1.51 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.52 TDDD05 / DF14900

Composers Generalize Aspect Weavers in AOP Composition Languages

„ Composition languages „ Complex composers distribute aspect fragments describe the structure and build process of the system in-the- large (“programming in the large”) Aspect over core fragments

„ Composition programs combine the basic composition Core „ Distributors extend the core Distributor operations of the composition language

„ Distributors are more „ Composition languages can look quite different

complex operators, defined „ Imperative: e.g. Java+library (in COMPOST) from basic ones „ Declarative: e.g. ADL, Aspect-J, Makefiles, C++ templates

„ Enables us to describe large systems Composition program size 1 System size 10 C. Kessler, IDA, Linköpings universitet. 1.53 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.54 TDDD05 / DF14900 Invasive Software Composition Conclusions for Composition Systems as Composition System

„ Components have a composition interface Component model Composition technique „ Composition interface is different from functional interface

„ Marks possible places for code injection in components Source or binary components Controlled by composition programs

„ The composition is running usually before the execution Greybox components Library of composition operators (basic and compound operators) of the system Composition interfaces with declared an implicit hooks „ Usually, at/before or deployment time

„ System composition becomes a new step in system build System composition (System generation) In COMPOST: Standard Language (Java) + System compilation metaprogramming library

System deployment Composition language System execution C. Kessler, IDA, Linköpings universitet. 1.55 TDDD05 / DF14900 C. Kessler, IDA, Linköpings universitet. 1.56 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