Ch17 CBSE

  • Upload
    ilkom12

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

  • 8/9/2019 Ch17 CBSE

    1/55

    Chapter 17 Component-based software engineering

    Lecture 1

    1Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    2/55

    Topics covered

    Components and component models

    CBSE processes

    Component composition

    2Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    3/55

    Component-based development

    Component-based software engineering (CBSE) is anapproach to software development that relies on thereuse of entities called ‘software components’.

    t emerged from the failure of ob!ect-oriented

    development to support effective reuse. Single ob!ectclasses are too detailed and specific.

    Components are more abstract than ob!ect classes andcan be considered to be stand-alone service providers."he# can e$ist as stand-alone entities.

    3Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    4/55

    CBSE essentials

    ndependent components specified b# their interfaces.

    Component standards to facilitate component

    integration.

    %iddleware that provides support for component inter-operabilit#.

     & development process that is geared to reuse.

    4Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    5/55

    CBSE and design principles

     &part from the benefits of reuse' CBSE is based onsound software engineering design principles Components are independent so do not interfere with each

    other

    Component implementations are hidden Communication is through well-defined interfaces Component platforms are shared and reduce development

    costs.

    5Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    6/55

    Component standards

    Standards need to be established so that components

    can communicate with each other and inter-operate.

    *nfortunatel#' several competing component standards

    were established

    Sun’s Enterprise +ava Beans

    %icrosoft’s C,% and .E"

    C,B&’s CC%

    n practice' these multiple standards have hindered the

    upta/e of CBSE. t is impossible for componentsdeveloped using different approaches to wor/ together.

    6Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    7/55

    CBSE problems

    Component trustworthiness - how can a component with

    no available source code be trusted0

    Component certification - who will certif# the 1ualit# of

    components0

    Emergent propert# prediction - how can the emergent

    properties of component compositions be predicted0

    e1uirements trade-offs - how do we do trade-off

    anal#sis between the features of one component and

    another0

    7Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    8/55

    Components

    Components provide a service without regard to wherethe component is e$ecuting or its programminglanguage  & component is an independent e$ecutable entit# that can be

    made up of one or more e$ecutable ob!ects "he component interface is published and all interactions are

    through the published interface

    8Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    9/55

    Component definitions

    Councill and 2einmann

     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. S3#pers/i

     A software component is a unit of composition with contractually

    specified interfaces and explicit context dependencies only. A

    software component can be deployed independently and is

    subject to composition by third-parties.

    9Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    10/55

    Component characteristics

    Componentcharacteristic

    Description

    Standardi3ed Component standardi3ation means that a component used in a CBSEprocess has to conform to a standard component model. "his modelma# define component interfaces' component metadata'documentation' composition' and deplo#ment.

    ndependent & component should be independent4it should be possible tocompose and deplo# it without having to use other specificcomponents. n situations where the component needs e$ternall#provided services' these should be e$plicitl# set out in a ‘re1uires’

    interface specification.

    Composable 5or a component to be composable' all e$ternal interactions mustta/e place through publicl# defined interfaces. n addition' it mustprovide e$ternal access to information about itself' such as itsmethods and attributes.

    10Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    11/55

    Component characteristics

    Componentcharacteristic

    Description

    6eplo#able "o be deplo#able' a component has to be self-contained. t must be

    able to operate as a stand-alone entit# on a component platform thatprovides an implementation of the component model. "his usuall#means that the component is binar# and does not have to becompiled before it is deplo#ed. f a component is implemented as aservice' it does not have to be deplo#ed b# a user of a component.ather' it is deplo#ed b# the service provider.

    6ocumented Components have to be full# documented so that potential users candecide whether or not the components meet their needs. "he s#nta$and' ideall#' the semantics of all component interfaces should bespecified.

    11Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    12/55

    Component as a service provider 

    "he component is an independent' e$ecutable entit#. t

    does not have to be compiled before it is used with other

    components.

    "he services offered b# a component are made available

    through an interface and all component interactions ta/e

    place through that interface.

    "he component interface is e$pressed in terms of

    parameteri3ed operations and its internal state is never

    e$posed.

    12Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    13/55

    Component interfaces

    7rovides interface

    6efines the services that are provided b# the component to other

    components.

    "his interface' essentiall#' is the component &7. t defines the

    methods that can be called b# a user of the component. e1uires interface

    6efines the services that specifies what services must be made

    available for the component to e$ecute as specified.

    "his does not compromise the independence or deplo#abilit# of

    a component because the ‘re1uires’ interface does not define

    how these services should be provided.

    13Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    14/55

    Component interfaces

    Note UML notation. a!! an" so#$ets #an %t to&ether.

    14Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    15/55

    model of a data collector component

    15Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    16/55

    Component models

     & component model is a definition of standards for

    component implementation' documentation and

    deplo#ment.

    E$amples of component models

    E+B model (Enterprise +ava Beans)

    C,%8 model (.E" model)

    Corba Component %odel

    "he component model specifies how interfaces should

    be defined and the elements that should be included inan interface definition.

    16Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    17/55

    Basic elements of a component model

    17Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    18/55

    Elements of a component model

    nterfaces

    Components are defined b# specif#ing their interfaces. "he

    component model specifies how the interfaces should be defined

    and the elements' such as operation names' parameters and

    e$ceptions' which should be included in the interface definition. *sage

    n order for components to be distributed and accessed

    remotel#' the# need to have a uni1ue name or handle associated

    with them. "his has to be globall# uni1ue.

    6eplo#ment

    "he component model includes a specification of how

    components should be pac/aged for deplo#ment as

    independent' e$ecutable entities.

    18Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    19/55

    !iddleware support

    Component models are the basis for middleware thatprovides support for e$ecuting components.

    Component model implementations provide 7latform services that allow components written according to the

    model to communicate Support services that are application-independent services used

    b# different components.

    "o use services provided b# a model' components aredeplo#ed in a container. "his is a set of interfaces used

    to access the service implementations.

    19Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    20/55

    !iddleware services defined in a component

    model

    20Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    21/55

    CBSE processes

    CBSE processes are software processes that support

    component-based software engineering.

    "he# ta/e into account the possibilities of reuse and the different

    process activities involved in developing and using reusable

    components. 6evelopment for reuse

    "his process is concerned with developing components or

    services that will be reused in other applications. t usuall#

    involves generali3ing e$isting components.

    6evelopment with reuse

    "his process is the process of developing new applications using

    e$isting components and services.

    21Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    22/55

    CBSE processes

    22Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    23/55

    Supporting processes

    Component ac1uisition is the process of ac1uiring

    components for reuse or development into a reusable

    component.

    t ma# involve accessing locall#- developed components or

    services or finding these components from an e$ternal source.

    Component management is concerned with managing a

    compan#’s reusable components' ensuring that the# are

    properl# catalogued' stored and made available for

    reuse. Component certification is the process of chec/ing a

    component and certif#ing that it meets its specification.

    Chapter 17 Software reuse 23

  • 8/9/2019 Ch17 CBSE

    24/55

    "e# points

    CBSE is a reuse-based approach to defining andimplementing loosel# coupled components into s#stems.

     & component is a software unit whose functionalit# anddependencies are completel# defined b# its interfaces.

     & component model defines a set of standards thatcomponent providers and composers should follow.

    "he /e# CBSE processes are CBSE for reuse and CBSEwith reuse.

    24Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    25/55

    Chapter 17 Component-based software engineering

    Lecture $

    25Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    26/55

    CBSE for reuse

    CBSE for reuse focuses on component development.

    Components developed for a specific application usuall#

    have to be generalised to ma/e them reusable.

     & component is most li/el# to be reusable if it associatedwith a stable domain abstraction (business ob!ect).

    5or e$ample' in a hospital stable domain abstractions

    are associated with the fundamental purpose - nurses'

    patients' treatments' etc.

    26Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    27/55

    Component development for reuse

    Components for reuse ma# be speciall# constructed b#generalising e$isting components.

    Component reusabilit#

    Should reflect stable domain abstractions

    Should hide state representation Should be as independent as possible Should publish e$ceptions through the component interface.

    "here is a trade-off between reusabilit# and usabilit#

    "he more general the interface' the greater the reusabilit# but

    it is then more comple$ and hence less usable.

    27Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    28/55

    Changes for reusabilit#

    emove application-specific methods.

    Change names to ma/e them general.

     &dd methods to broaden coverage.

    %a/e e$ception handling consistent.

     &dd a configuration interface for component adaptation.

    ntegrate re1uired components to reduce dependencies.

    28Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    29/55

    E%ception handling

    Components should not handle e$ceptions themselves'

    because each application will have its own re1uirements

    for e$ception handling.

    ather' the component should define what e$ceptions can arise

    and should publish these as part of the interface.

    n practice' however' there are two problems with this

    7ublishing all e$ceptions leads to bloated interfaces that are

    harder to understand. "his ma# put off potential users of the

    component.

    "he operation of the component ma# depend on local e$ception

    handling' and changing this ma# have serious implications for

    the functionalit# of the component.

    Chapter 17 Software reuse 29

  • 8/9/2019 Ch17 CBSE

    30/55

    Legac# s#stem components

    E$isting legac# s#stems that fulfil a useful business

    function can be re-pac/aged as components for reuse.

    "his involves writing a wrapper component that

    implements provides and re1uires interfaces then

    accesses the legac# s#stem.

     &lthough costl#' this can be much less e$pensive than

    rewriting the legac# s#stem.

    30Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    31/55

    &eusable components

    "he development cost of reusable components ma# be

    higher than the cost of specific e1uivalents. "his e$tra

    reusabilit# enhancement cost should be an organi3ation

    rather than a pro!ect cost.

    9eneric components ma# be less space-efficient and

    ma# have longer e$ecution times than their specific

    e1uivalents.

    31Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    32/55

    Component management

    Component management involves deciding how to

    classif# the component so that it can be discovered'

    ma/ing the component available either in a repositor# or

    as a service' maintaining information about the use of

    the component and /eeping trac/ of different componentversions.

     & compan# with a reuse program ma# carr# out some

    form of component certification before the component is

    made available for reuse. Certification means that someone apart from the developer

    chec/s the 1ualit# of the component.

    Chapter 17 Software reuse 32

  • 8/9/2019 Ch17 CBSE

    33/55

    CBSE with reuse

    CBSE with reuse process has to find and integratereusable components.

    :hen reusing components' it is essential to ma/e trade-offs between ideal re1uirements and the services

    actuall# provided b# available components. "his involves

    6eveloping outline re1uirements Searching for components then modif#ing re1uirements

    according to available functionalit#.

    Searching again to find if there are better components that meetthe revised re1uirements.

    Composing components to create the s#stem.

    33Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    34/55

    CBSE with reuse

    34Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    35/55

    The component identification process

    35Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    36/55

    Component identification issues

    "rust. ;ou need to be able to trust the supplier of acomponent. &t best' an untrusted component ma# notoperate as advertised at worst' it can breach #oursecurit#.

    e1uirements. 6ifferent groups of components willsatisf# different re1uirements.

  • 8/9/2019 Ch17 CBSE

    37/55

    Component validation

    Component validation involves developing a set of test

    cases for a component (or' possibl#' e$tending test

    cases supplied with that component) and developing a

    test harness to run component tests.

    "he ma!or problem with component validation is that thecomponent specification ma# not be sufficientl# detailed to allow

    #ou to develop a complete set of component tests.

     &s well as testing that a component for reuse does what

    #ou re1uire' #ou ma# also have to chec/ that thecomponent does not include an# malicious code or

    functionalit# that #ou don’t need.

    Chapter 17 Software reuse 37

  • 8/9/2019 Ch17 CBSE

    38/55

    riane launcher failure ' validation failure(

    n =>>?' the =st test flight of the &riane @ roc/et ended in

    disaster when the launcher went out of control A

    seconds after ta/e off.

    "he problem was due to a reused component from a

    previous version of the launcher (the nertial avigationS#stem) that failed because assumptions made when

    that component was developed did not hold for &riane @.

    "he functionalit# that failed in this component was not

    re1uired in &riane @.

    38Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    39/55

    Component composition

    "he process of assembling components to create a

    s#stem.

    Composition involves integrating components with each

    other and with the component infrastructure.

    ormall# #ou have to write ‘glue code’ to integrate

    components.

    39Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    40/55

    T#pes of composition

    Se1uential composition where the composedcomponents are e$ecuted in se1uence. "his involvescomposing the provides interfaces of each component.

    2ierarchical composition where one component calls on

    the services of another. "he provides interface of onecomponent is composed with the re1uires interface ofanother.

     &dditive composition where the interfaces of twocomponents are put together to create a new

    component. 7rovides and re1uires interfaces ofintegrated component is a combination of interfaces ofconstituent components.

    40Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    41/55

    T#pes of component composition

    41Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    42/55

    )nterface incompatibilit#

    7arameter incompatibilit# where operations have the

    same name but are of different t#pes.

    ,peration incompatibilit# where the names of operations

    in the composed interfaces are different.

    ,peration incompleteness where the provides interface

    of one component is a subset of the re1uires interface of

    another.

    42Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    43/55

    Components with incompatible interfaces

    43Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    44/55

    daptor components

     &ddress the problem of component incompatibilit# b#

    reconciling the interfaces of the components that are

    composed.

    6ifferent t#pes of adaptor are re1uired depending on the

    t#pe of composition.

     &n address5inder and a mapper component ma# be

    composed through an adaptor that strips the postal code

    from an address and passes this to the mapper

    component.

    44Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    45/55

    Composition through an adaptor 

    "he component postCodeStripper is the adaptor that

    facilitates the se1uential composition of address5inder

    and mapper components.

    45Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    46/55

    n adaptor lin*ing a data collector and a sensor

    46Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    47/55

    +hoto librar# composition

    47Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    48/55

    )nterface semantics

    ;ou have to rel# on component documentation to decide

    if interfaces that are s#ntacticall# compatible are actuall#

    compatible.

    Consider an interface for a 7hotoibrar# component

    48Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    49/55

    +hoto Librar# documentation

    '(his )etho" a""s a photo&raph to the !i*rar+ an"asso#iates the photo&raph i"enti%er an" #ata!o&ue

    "es#riptor with the photo&raph.,

     'what happens if the photo&raph i"enti%er is a!rea"+asso#iate" with a photo&raph in the !i*rar+-,

    'is the photo&raph "es#riptor asso#iate" with the #ata!o&ue

    entr+ as we!! as the photo&raph i.e. if "e!ete thephoto&raph/ "o a!so "e!ete the #ata!o&ue infor)ation-,

    49Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    50/55

    The ,bect Constraint Language

    "he ,b!ect Constraint anguage (,C) has been

    designed to define constraints that are associated with

    *% models.

    t is based around the notion of pre and post condition

    specification D common to man# formal methods.

    50Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    51/55

    The ,CL description of the +hoto Librar#

    interface

    -- "he conte$t /e#word names the component to which the conditions appl#

    conte%t addtem

    -- "he preconditions specif# what must be true before e$ecution of addtem

    pre 7hotoibrar#.libSi3e() F

    7hotoibrar#.retrieve(pid) G null

    -- "he postconditions specif# what is true after e$ecution

    postlibSi3e () G libSi3e()Hpre 8 =

    7hotoibrar#.retrieve(pid) G p

    7hotoibrar#.catEntr#(pid) G photodesc

    conte%t delete

    pre 7hotoibrar#.retrieve(pid) I null

    post 7hotoibrar#.retrieve(pid) G null

    7hotoibrar#.catEntr#(pid) G 7hotoibrar#.catEntr#(pid)Hpre

    7hotoibrar#.libSi3e() G libSi3e()Hpre4=

    51Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    52/55

    +hoto librar# conditions

     &s specified' the ,C associated with the 7hoto ibrar#

    component states that

    "here must not be a photograph in the librar# with the same

    identifier as the photograph to be entered

    "he librar# must e$ist - assume that creating a librar# adds asingle item to it

    Each new entr# increases the si3e of the librar# b# =

    f #ou retrieve using the same identifier then #ou get bac/ the

    photo that #ou added

    f #ou loo/ up the catalogue using that identifier' then #ou getbac/ the catalogue entr# that #ou made.

    52Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    53/55

    Composition trade-offs

    :hen composing components' #ou ma# find conflicts

    between functional and non-functional re1uirements' and

    conflicts between the need for rapid deliver# and s#stem

    evolution.

    ;ou need to ma/e decisions such as :hat composition of components is effective for delivering the

    functional re1uirements0

    :hat composition of components allows for future change0

    :hat will be the emergent properties of the composed s#stem0

    53Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    54/55

    Data collection and report generation

    components

    54Chapter 17 Software reuse

  • 8/9/2019 Ch17 CBSE

    55/55

    "e# points

    6uring the CBSE process' the processes ofre1uirements engineering and s#stem design areinterleaved.

    Component composition is the process of ‘wiring’

    components together to create a s#stem.:hen composing reusable components' #ou normall#

    have to write adaptors to reconcile different componentinterfaces.

    :hen choosing compositions' #ou have to considerre1uired functionalit#' non-functional re1uirements ands#stem evolution.