Component-Based Software Engineering CSM-15 Paul Krause.

35
Component-Based Component-Based Software Software Engineering Engineering CSM-15 CSM-15 Paul Krause Paul Krause

Transcript of Component-Based Software Engineering CSM-15 Paul Krause.

Page 1: Component-Based Software Engineering CSM-15 Paul Krause.

Component-Based Component-Based Software EngineeringSoftware Engineering

CSM-15CSM-15

Paul KrausePaul Krause

Page 2: Component-Based Software Engineering CSM-15 Paul Krause.

Health Warning!Health Warning!

To work well, a Seminar-Based module To work well, a Seminar-Based module needs needs youryour input! input!

I have plenty of material I can provide, but I have plenty of material I can provide, but you must also tell me what you wantyou must also tell me what you want within reason within reason

Let’s now quickly look at the Let’s now quickly look at the recommended books …recommended books …

Page 3: Component-Based Software Engineering CSM-15 Paul Krause.

Focus on components for the Focus on components for the InternetInternet

Service-Oriented Computing: Semantics, Processes, Agents

Authors: Singh and Huhns

Publisher: Wiley

Page 4: Component-Based Software Engineering CSM-15 Paul Krause.

For the Practical StuffFor the Practical Stuff

Page 5: Component-Based Software Engineering CSM-15 Paul Krause.

Lecture 1 - OverviewLecture 1 - Overview

ContentsContents Software EngineeringSoftware Engineering Components as architectureComponents as architecture What is a software component?What is a software component? InterfacesInterfaces Software as a “metaproduct”Software as a “metaproduct”

Page 6: Component-Based Software Engineering CSM-15 Paul Krause.

Why Software Engineering?Why Software Engineering?

The difference between writing a program The difference between writing a program and engineering a software systemand engineering a software system

is like the difference between building a is like the difference between building a patio table and building a bridgepatio table and building a bridge

You can patch up one until it worksYou can patch up one until it works You need careful analysis and design to You need careful analysis and design to

succeed with the othersucceed with the other Good Software Engineering practice is Good Software Engineering practice is

essential for Software Componentsessential for Software Components

Page 7: Component-Based Software Engineering CSM-15 Paul Krause.

EngineeringEngineering

The The professionprofession in which in which

a knowledge of the a knowledge of the mathematicalmathematical and and natural sciencesnatural sciences gained by study, experience and practicegained by study, experience and practice

is applied with is applied with judgementjudgement

to develop ways to to develop ways to utiliseutilise, economically, the , economically, the materials and materials and forces of nature for the benefit of mankindforces of nature for the benefit of mankind

Accreditation board for Engineering and Technology, 1996Accreditation board for Engineering and Technology, 1996

Page 8: Component-Based Software Engineering CSM-15 Paul Krause.

Lecture 1 - OverviewLecture 1 - Overview

ContentsContents Software EngineeringSoftware Engineering Components as architectureComponents as architecture What is a software component?What is a software component? InterfacesInterfaces Software as a “metaproduct”Software as a “metaproduct”

Page 9: Component-Based Software Engineering CSM-15 Paul Krause.

Software Components mean?Software Components mean?

The main driver behind software The main driver behind software components is components is reuse.reuse.

That means we must That means we must modularisemodularise applications if they are to have potentially applications if they are to have potentially reusable parts.reusable parts.

The expectation is that if the parts (often The expectation is that if the parts (often collections of classes) can be reused then collections of classes) can be reused then costs will be reduced (in the long run…).costs will be reduced (in the long run…).

Page 10: Component-Based Software Engineering CSM-15 Paul Krause.

So what’s new?So what’s new?

Modularisation of software is Modularisation of software is notnot new. new. What we want of a component is thatWhat we want of a component is that

It may be used by other program elements It may be used by other program elements ((clientsclients) ) • (encapsulation and low coupling – good strategies (encapsulation and low coupling – good strategies

for any modular design)for any modular design) The clients and their authors do not need to The clients and their authors do not need to

be known to the component’s authorsbe known to the component’s authors• This is a little bit new, and only works if all the This is a little bit new, and only works if all the

respective authors work to a common standardrespective authors work to a common standard

Page 11: Component-Based Software Engineering CSM-15 Paul Krause.

An Example ComponentAn Example Component

A Windows A Windows executableexecutable

Can be dynamically Can be dynamically linked to any linked to any Windows applicationWindows application

Can be composed Can be composed with other COM with other COM objectsobjects

account

COM Object

Computation interface

Identification interface

getName( ) setName( )

Asset interface

Page 12: Component-Based Software Engineering CSM-15 Paul Krause.

Do we get anything for free?Do we get anything for free?

Of course not!Of course not! Components may be classes (or Components may be classes (or

collections of classes), but they must collections of classes), but they must satisfy satisfy additionaladditional guidelines: guidelines: So we really do understand what is provided So we really do understand what is provided

and what is required at their interfacesand what is required at their interfaces So that we know the framework or So that we know the framework or

architecture in which they are to be usedarchitecture in which they are to be used

Page 13: Component-Based Software Engineering CSM-15 Paul Krause.

Components as architectureComponents as architecture

Could view “independent components” as a category of Could view “independent components” as a category of software architecturessoftware architectures

Pipes and filtersPipes and filters• UnixUnix

Parallel communicating processesParallel communicating processes• Java threadsJava threads

Client-serverClient-server• World-wide web;World-wide web;

• CORBA – a middle layer that provides a common data busCORBA – a middle layer that provides a common data bus Event systemsEvent systems

• Java event model and Java BeansJava event model and Java Beans

Page 14: Component-Based Software Engineering CSM-15 Paul Krause.

Lecture 1 - OverviewLecture 1 - Overview

ContentsContents Software EngineeringSoftware Engineering Components as architectureComponents as architecture What is a software component?What is a software component? InterfacesInterfaces Software as a “metaproduct”Software as a “metaproduct”

Page 15: Component-Based Software Engineering CSM-15 Paul Krause.

What is a Software What is a Software Component?Component?

““Components are units of deployment”Components are units of deployment”- Clemens SzyperskiClemens Szyperski

Page 16: Component-Based Software Engineering CSM-15 Paul Krause.

Drivers for CBDDrivers for CBD

The development of the WWW and The development of the WWW and InternetInternet Systems of loosely coordinated servicesSystems of loosely coordinated services

Object-oriented design techniques and Object-oriented design techniques and languageslanguages

Move from Mainframe to client-server Move from Mainframe to client-server based computingbased computing

Rapid pace of technological changeRapid pace of technological change Economic necessity of maximising reuseEconomic necessity of maximising reuse

Page 17: Component-Based Software Engineering CSM-15 Paul Krause.

Are Components New?Are Components New?

SubroutinesSubroutines Turing, 1949, Turing, 1949, Checking a Large RoutineChecking a Large Routine

Structured ProgrammingStructured Programming Dijkstra, 1968Dijkstra, 1968

LibrariesLibraries NAG, 1971NAG, 1971

Information HidingInformation Hiding Parnas, 1972Parnas, 1972

Page 18: Component-Based Software Engineering CSM-15 Paul Krause.

Software ComponentsSoftware Components

Components are for compositionComponents are for composition (In principle) already existing “things” can (In principle) already existing “things” can

be be reusedreused by rearranging them to make a by rearranging them to make a new compositenew composite

So components are about reuseSo components are about reuse This drives many of the engineering This drives many of the engineering

requirements for software componentsrequirements for software components

Page 19: Component-Based Software Engineering CSM-15 Paul Krause.

What is a component (2)?What is a component (2)?

A component makes its services available A component makes its services available through interfacesthrough interfaces

And interfaces are of certain types or And interfaces are of certain types or categoriescategories

Page 20: Component-Based Software Engineering CSM-15 Paul Krause.

Revised DefinitionRevised Definition

A software component is a unit of A software component is a unit of composition with contractually specified composition with contractually specified interfaces and explicit context interfaces and explicit context dependencies only.dependencies only.

A software component can be deployed A software component can be deployed independently and is subject to independently and is subject to composition by third parties.composition by third parties.

1996 European Conference on Object-Oriented 1996 European Conference on Object-Oriented ProgrammingProgramming

Page 21: Component-Based Software Engineering CSM-15 Paul Krause.

Lecture 1 - OverviewLecture 1 - Overview

ContentsContents Software EngineeringSoftware Engineering Components as architectureComponents as architecture What is a software component?What is a software component? InterfacesInterfaces Software as a “metaproduct”Software as a “metaproduct”

Page 22: Component-Based Software Engineering CSM-15 Paul Krause.

Connector DesignConnector Design

:Button:Button

:Button:Button

:Motor:Motor :Meter:Meter

pressed

pressed

start

stop

speed

value

Page 23: Component-Based Software Engineering CSM-15 Paul Krause.

Connector DesignConnector Design

:Button:Button

:Button:Button

:Motor:Motor

:Meter:Meter

pressed

pressed

start

stopspeed

value

:OR:OR:Threshold:Threshold

a

b

a b

a > b

a < b

:Multiplier:Multiplier

:Selector{1, 10, 100}

:Selector{1, 10, 100}

a b

a x b

5:int5:int

a

b

Page 24: Component-Based Software Engineering CSM-15 Paul Krause.

Lessons from electronics kitLessons from electronics kit

Families of products from kits of componentsFamilies of products from kits of components Design of a component infrastructureDesign of a component infrastructure

Basic technology - e.g. do components interact via Basic technology - e.g. do components interact via procedure calls or remote method invocations?procedure calls or remote method invocations?

Component designComponent design Components must conform to the component Components must conform to the component

infrastructureinfrastructure

Product buildingProduct building

Page 25: Component-Based Software Engineering CSM-15 Paul Krause.

Infrastructure:Infrastructure:

Do pluggable connectors mean common Do pluggable connectors mean common data types across all components?data types across all components?

No!No! Local usage may not fit a common typeLocal usage may not fit a common type

Answer: EncapsulationAnswer: Encapsulation No direct access to the data of any No direct access to the data of any

component from outsidecomponent from outside All communication should be a request All communication should be a request

defined in an interfacedefined in an interface

Page 26: Component-Based Software Engineering CSM-15 Paul Krause.

Revised DefinitionRevised Definition

A software component is a unit of A software component is a unit of composition with contractually specified composition with contractually specified interfaces and explicit context interfaces and explicit context dependencies only.dependencies only.

A software component can be deployed A software component can be deployed independently and is subject to independently and is subject to composition by third parties.composition by third parties.

1996 European Conference on Object-Oriented 1996 European Conference on Object-Oriented ProgrammingProgramming

Page 27: Component-Based Software Engineering CSM-15 Paul Krause.

Independent DeploymentIndependent Deployment

EncapsulationEncapsulation Cannot be partially deployedCannot be partially deployed Must have clear specifications of what it Must have clear specifications of what it

requiresrequires, as well as what it provides, as well as what it provides Must have well-defined interfacesMust have well-defined interfaces

Page 28: Component-Based Software Engineering CSM-15 Paul Krause.

InterfacesInterfaces

Interfaces allow the clients of a component Interfaces allow the clients of a component to access the services provided by a to access the services provided by a componentcomponent

Different interfaces will normally provide Different interfaces will normally provide access to different servicesaccess to different services

Each interface specification could be Each interface specification could be viewed as a viewed as a contractcontract between the between the component and a clientcomponent and a client

Page 29: Component-Based Software Engineering CSM-15 Paul Krause.

Explicit context dependenciesExplicit context dependencies

Components must also specify their needsComponents must also specify their needs i.e. the context of composition and i.e. the context of composition and

deploymentdeployment This means bothThis means both

The component’s requires interfaces, andThe component’s requires interfaces, and The component world it is prepared forThe component world it is prepared for

• (CORBA, COM, Java…)(CORBA, COM, Java…)

Page 30: Component-Based Software Engineering CSM-15 Paul Krause.

Component SpecificationComponent Specification

Provides InterfacesProvides Interfaces The services a component can offer to a clientThe services a component can offer to a client

Requires InterfacesRequires Interfaces The services required by a component to help The services required by a component to help

it deliver its promisesit deliver its promises Context of UseContext of Use

The “world” the component lives inThe “world” the component lives in

Page 31: Component-Based Software Engineering CSM-15 Paul Krause.

Lecture 1 - OverviewLecture 1 - Overview

ContentsContents Software EngineeringSoftware Engineering Components as architectureComponents as architecture What is a software component?What is a software component? InterfacesInterfaces Software as a “metaproduct”Software as a “metaproduct”

Page 32: Component-Based Software Engineering CSM-15 Paul Krause.

Software ICs?Software ICs?

PageAcquisition

PageStore

Page 33: Component-Based Software Engineering CSM-15 Paul Krause.

The nature of softwareThe nature of software

““Delivery of software means delivering the Delivery of software means delivering the blueprints for products”blueprints for products”

Clemens SzyperskiClemens Szyperski When software is installed on a computer, When software is installed on a computer,

an instance of the product is instantiatedan instance of the product is instantiated The computer can instantiate the product The computer can instantiate the product

one or more timesone or more times Better to view software as a “metaproduct”Better to view software as a “metaproduct”

Page 34: Component-Based Software Engineering CSM-15 Paul Krause.

Plans vs. InstancesPlans vs. Instances

Plans can be parameterisedPlans can be parameterised Plans can be applied recursivelyPlans can be applied recursively Plans can be scaledPlans can be scaled Plans can be instantiated any number of Plans can be instantiated any number of

timestimes

Page 35: Component-Based Software Engineering CSM-15 Paul Krause.

SummarySummary

We have:We have: Seen some of the drivers behind the Seen some of the drivers behind the

introduction of component-based software introduction of component-based software engineeringengineering

Explored some definitions of software Explored some definitions of software componentscomponents

Identified the importance of specifying Identified the importance of specifying requires and provides interfacesrequires and provides interfaces