DF14900 Component-Based Software Introduction and Overview

advertisement

DF14900

Component-Based Software

Introduction and Overview

Peter Bunus

Department of Computer and Information Science

Linköping University, Sweden peter.bunus@liu.se

!

Component-Based Development

What Is this all about?

In this course you will learn to develop building blocks

“ components ” that you or someone else can assemble or reassemble into different applications

2

Identify the Components

Look at the Amazon main webpage and quickly identify some elements that you consider to be software components.

3

!

Clemens Szyperski: Component Software –

Beyond Object-Oriented Programming .

Second Edition, Addison-Wesley – Second Edition

Literature

4

Component and Composition Systems Overview

5

Motivation for Software Components

!

Managing system complexity: Divide-and-conquer (Alexander the

Great)

!

Well known in other disciplines

•   Mechanical engineering (e.g., German DIN 2221; IEEE standards)

•   Electrical engineering

•   Architecture

•   Computer architecture

6

Mass Produced Software Components

!

Outsourcing to component produces

!

Reuse of partial solutions

!

Easy configurability of the systems

•   Variants, versions, product families

!

Every ripe industry is based on components, since these allow to manage large systems

!

Components should be produces in masses and composed to systems afterwards

Mass Produced Software Components by M.D McIlroy

"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.

7

Mass Produced Software Components

In the phrase “ mass production techniques ”, my emphasis is on “ techniques ” and not on mass production plain. Of course, mass production, in the sense of limitless replication of a prototype, is trivial for software

M.D McIlroy

But certain ideas from industrial technique I claim are relevant.

- The idea of subassemblies carries over directly and is well exploited.

- The idea of interchangeable parts corresponds roughly to our term “modularity”, and is fitfully respected.

- The idea of machine tools has an analogue in assembly programs and compilers

Yet this fragile analogy is belied when we seek for analogues of other tangible symbols of mass production.

- There do not exist manufacturers of standard parts, much less catalogues of standard parts.

- One may not order parts to individual specifications of size, ruggedness, speed, capacity, precision or character set . 8

What Is a Component - Definitions

!

“ 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.

!

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.

Heineman / Councill [Ch.1]:

9

Are Objects Components

!

Object Properties

•   An object is a unit of instantiation.

•   It has a unique identity.

•   It may have state, and this can be (externally) observed

•   It encapsulates its state and behavior.

!

Components

•   Components are rather prototypes / blueprints / plansfrom which (stateful) objects can be instantiated

–   e.g., a function definition, type definition, class or set of classes

•   No (externally observable) state

•   Unit of independent deployment

•   Unit of third-party composition

10

Component System (Component Platforms)

!

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

!

A component system has

Component Model for description of components

Composition Technique for compositions of components

11

Software Composition Systems

!

A Software Composition System has

Component Model for description of components

Composition

Language for programming-in-thelarge and architecture

Composition Technique for compositions of components

12

Issues in Component/Composition Systems

!

Component Model

•   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?

!

Composition Technique

•   How are components glued together, composed, merged, applied?

•   Composition time (Compile- / Link- / Deployment- / Connection- / Run-time ...)

!

Composition Language

•   How are compositions of large systems described and managed?

13

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

!

Procedural systems

!

Modular systems

!

Object-oriented technology

!

Component-based programming with COTS (Components-off-the-shelf) systems

•   CORBA, EJB, DCOM, COM+, .NET

!

Software architecture description languages

BlackBox Composition

14

Blackbox Composition

Components

Connectors

Composition recipe

Component-based applications

Amazon shall use SOA

SOA: SW architecture where all components are designed to be services !

1.

  All teams will henceforth expose their data and functionality through service interfaces "

2.

  Teams must communicate with each other through these interfaces "

3.

  There will be no other form of interprocess communication allowed: no direct linking, no direct reads of another team's data store, no shared-memory model, no back-doors whatsoever. The only communication allowed is via service interface calls over the network. "

Taken from: CS 169 Software Engineering: Armando Fox, David Patterson, and Koushik Sen !

16

Amazon shall use SOA

4.

  It doesn't matter what [API protocol] technology you use. "

5.

  Service interfaces, without exception, must be designed from the ground up to be externalizable. That is to say, the team must plan and design to be able to expose the interface to developers in the outside world. No exceptions. "

6.

  Anyone who doesn't do this will be fired. "

7.

  Thank you; have a nice day!

“ "

Taken from: CS 169 Software Engineering: Armando Fox, David Patterson, and Koushik Sen !

17

Bookstore: SOA

!

Internal subsystems can share data directly !

!

Review access user profile !

!

All subsystems inside single API

( “ Bookstore ” ) !

reviews users

Review

Subsystem

User Profile

Service orders

Buying

Subsystem

Bookstore Service

(Figure 1.2, Engineering Long

Lasting Software by Armando Fox and David Patterson, Alpha edition,

2012.)

Taken from: CS 169 Software Engineering: Armando Fox, David Patterson, and Koushik Sen !

18

•   Subsystems independent, as if in separate datacenters !

–   Review Service access

User Service API !

•   Can recombine to make new service ( “ Favorite Books ” ) !

Taken from: CS 169 Software Engineering: Armando Fox, David Patterson, and Koushik Sen !

users

Social

Network

Service

Bookstore: SOA

credit card processing user reviews editor reviews

Review

Service users

User Profile

Service orders

Buying

Service

Bookstore Service

Favorite Books

Service

(Figure 1.3, Engineering Long

Lasting Software by Armando Fox and David Patterson, Alpha edition,

2012.)

19

Examples – Procedural Systems

!

Fortran, Algol, Pascal, C, ...

!

The procedure is the component

!

The activation record the instantiation

!

Component model is supported by almost all processors directly

•   JumpSubroutine instruction

•   Return instruction

Caller

(code) 

Callee

(code) 

Linker 

Caller-

AR call

Callee-

AR

Caller AR addr.

Return address

Caller-

AR ret

Caller-

AR

Run time

20

Procedures as a Composition System

Component Model 

Content: binary code with symbols

Binding points: linker symbols procedures (with parameters) and global variables

Composition Technique 

Connection by linking object files

Program transformation on object files

Composition time: link-time, static

Composition Language 

21

UNIX Filters and Pipes

What this UNIX command does?

$ cat apple.txt

$ cat apple.txti

Ipad iphone macbook

$ cat apple.txt | wc at this first shell prompt, we show the contents of the file apple.txt on the screen

$ cat apple.txt | wc

4 6 7 the standard output of the command to the left of the pipe gets sent as standard input of the command to the right of the pipe.

We use the cat command to display the contents of the apple.txt file, but I sent the display not to the screen, but through a pipe to the wc (word count) command. The wc command then does its job and counts the lines, words, and characters of what it got as input

22

Unix Filters and Pipes (McIllroy)

!

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 stderr stdin

Filter stdout stdin

Filter pipe

23

Unix Filters and Pipes as Composition System

Component Model 

Content: unknown (due to parsing), externally bytes

Binding points: stdin/out ports

Secrets: distribution, parallelism

Composition Technique 

Adaptation: filter around other components

Filter languages such as sed, awk, perl

Binding time: static

Composition Language 

C, shell, tcl/tk, python …

Build management language makefile

Version management with sccs rcs cvs

Object-Oriented Systems

!

Components: classes

•   Objects are instances of classes (modules) with unique identity

•   Objects have runtime state

•   Late binding of calls by search/dispatch at runtime

Caller 

Object  dispatch 

Callee 

Callee 

Callee 

25

Object-Orientation as Composition System

Component Model 

Content: binary files, objects

(code and data)

Binding points: static (monomorphic) and polymorphic (dynamically dispatched) calls

Composition Technique 

Adaptation by inheritance or delegation

Extensibility by subclassing

Composition Language 

Commercial Component Systems

!

CORBA / COM / .NET / EJB

•   Although different on the first sight, turn out to be rather similar

Caller 

Object

(Client) 

Callee

(Server) 

Mediator 

Software bus

27

CORBA

n   n   n  

Language independent, location/distribution transparent interface definition language IDL source code or binary

Client

Java

Stub

Client

C

Stub

Interface specification

(in IDL) generate

Server

C++

Skeleton

Object adapter

Object Request Broker (ORB), Trader, Services

n   n  

Microsoft’s model is similar to CORBA. Proprietary

(D)COM is a binary standard

(D)COM, ActiveX

Client

VBasic

COM stub

Client

C++

COM stub

Server

C++

COM skeleton

Server

C++

IDL skeleton

Object adapter

Monikers, Registry

Java Beans

n   n  

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

Server

C++

IDL skeleton

Object adapter

Event InfoBus, RMI

n   n   n   n  

Language independent, distribution transparent

NO interface definition language IDL (at least for C#) source code or bytecode MSIL

Common Language Runtime CLR

Client

Java

.net-CLR

Client

C#

.net-CLR

Server

C++

.net-CLR

DOT-NET

CLR

CORBA/DCOM/JavaBeans/...:

Components Off-The-Shelf (COTS)

Component Model 

Content: binary components

Binding points are standardized

Described by IDL, set/get properties,

Standard interfaces (IUnknown...)

Secrets: distribution, language

Composition Technique 

Adaptation for distributed systems

(marshalling) and mixed-language systems

(IDL)

Dynamic call in CORBA

VisualBasic for COM

Composition Language 

Web Services

n   n  

Binding procedure is interpreted, not compiled

More flexible: n   n  

When interface changes, no recompilation and rebinding

Ubiquitous http protocol – independent of a specific ORB

SOAP  interpretation 

Caller 

Object 

Mediator 

Callee 

(Server) 

Web Services as Composition System

Component Model 

Content: not important

Binding points are described by XML

Binding procedure is interpretation of SOAP

Secrets: distribution, implementation language

Composition Technique 

Adaptation for distributed systems

(marshalling) and mixed-language systems

Glue: WSDL, SOAP, HTTP

Dynamic discovery/binding with UDDI

Composition Language 

BPEL

Web Services Business Process

Execution Language

Download