enhancements enabling flexible feature and implementation selection john hunt and murali sitaraman...

29
Enhancements Enhancements Enabling Flexible Feature and Implementation Enabling Flexible Feature and Implementation Selection Selection John Hunt and Murali Sitaraman John Hunt and Murali Sitaraman Reusable Software Research Group Reusable Software Research Group Department of Computer Science Department of Computer Science Clemson University, USA Clemson University, USA This research is funded in part by the U. S. National Science Foundation under grant CCR-0113181.

Post on 20-Dec-2015

214 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

EnhancementsEnhancementsEnabling Flexible Feature and Implementation Enabling Flexible Feature and Implementation

Selection Selection

John Hunt and Murali SitaramanJohn Hunt and Murali SitaramanReusable Software Research GroupReusable Software Research Group

Department of Computer ScienceDepartment of Computer Science

Clemson University, USAClemson University, USA

This research is funded in part by the U. S. National Science Foundation under grant CCR-0113181.

Page 2: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

OverviewOverview Problem DescriptionProblem Description Client PerspectiveClient Perspective A Standard Java SolutionA Standard Java Solution Related WorkRelated Work ConclusionsConclusions

Page 3: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Problem DescriptionProblem Description

Page 4: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Component DesignComponent DesignWe need to separate component interfaces We need to separate component interfaces

from implementationfrom implementation Separates what from how – information Separates what from how – information

hidinghiding Different implementations allow Different implementations allow

performance trade-offs, particularly performance trade-offs, particularly between time and spacebetween time and spaceConsequence:

Each component will have multiple implementations

Page 5: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Need for Feature AdditionNeed for Feature Addition

Interfaces can not be exhaustiveInterfaces can not be exhaustive-- Knowledge of a clients needs is never complete-- Knowledge of a clients needs is never complete

Interfaces should not be exhaustiveInterfaces should not be exhaustive-- Avoid large / complex / bloated -- Avoid large / complex / bloated componentscomponentsConsequence: Clients must be able to choose between features

Consequence: Feature addition is unavoidable

Page 6: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Scaling DilemmaScaling DilemmaIV-A

Feature 1

IV-EIV-DIV-CIV-B

Feature 2

Booch: 26 to 30 variations per conceptBiggerstaff (ICSR 3)-- Economic Argument (cost exceeds reuse value)

Page 7: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Solution CriteriaSolution Criteria

Must be able to compose features independentlyMust be able to compose features independently A Feature must work with all implementation A Feature must work with all implementation

variationsvariations

Layers of AbstractionLayers of Abstraction

Consequence:Features must be dependent only on base interfaces

Page 8: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Client PerspectiveClient Perspective

Page 9: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Composition StepsComposition Steps

Select a base abstractionSelect a base abstraction Select a base implementationSelect a base implementation Select a feature(s) to “enhance” the Select a feature(s) to “enhance” the

basebase Select a feature(s) implementationSelect a feature(s) implementation

Page 10: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

E1V1E1V1

E11

E2V2

E3V11

E3

E3V2

E2 E2V2

E2V1

E E2V32V3

IV-D

IV-A

IV-C

IV-B

I1

Feature and Implementation SelectionFeature and Implementation Selection

Page 11: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Array_Realiz

List_Realiz

Recursive_Reversal

Reversal_Capability

Iterative_Reversal_Reversal

Search_CapabilityLinear_Search

Stack_Template

Example Stack Feature SelectionExample Stack Feature Selection

Page 12: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

realized by Array_Realizrealized by Array_Realiz

Stack Composition - Stack Composition - RESOLVERESOLVE

Facility Int_Stack is Stack_Template(Integer, size)Facility Int_Stack is Stack_Template(Integer, size)

enhanced by Reversal_Capabilityenhanced by Reversal_Capabilityrealized by Recursive_Reversalrealized by Recursive_Reversal

;;

;;enhanced by Search_Capabilityenhanced by Search_Capability

realized by Linear_Search;realized by Linear_Search;

Array_Realiz

List_Realiz

Recursive_Reversal

Reversal_Capability

Iterative_Reversal_Reversal

Search_CapabilityLinear_Search

Stack_Template

Page 13: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

new Array_Realiz(size);

Stack Composition - JavaStack Composition - Java

Stack_Template myStack =

Array_Realiz

List_Realiz

Recursive_Reversal

Reversal_Capability

Iterative_Reversal_Reversal

Search_CapabilityLinear_Search

Stack_Template

Recursive_Reversal.addEnhancement(new Array_Realiz(size)

);

Linear_Search.addEnhancement(

Recursive_Reversal.addEnhancement(new Array_Realiz(size)

));

Page 14: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Standard Java SolutionStandard Java Solution

Page 15: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Standard Java SolutionStandard Java Solution

Single InheritanceSingle Inheritance No compiler modificationsNo compiler modifications No toolsNo tools

Page 16: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

E3 + E2 + I1 E3V2 + E2V1 + IV-CE2 + I1 E2V1 + IV-CI1 IV-C

How to Implement?How to Implement?

Page 17: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Combine TechniquesCombine Techniques

Implementation Layers use decorator Implementation Layers use decorator pattern pattern - GOF- GOF

Interface Layers use dynamic proxy Interface Layers use dynamic proxy - Java 1.3 feature- Java 1.3 feature

Layering must be synchronizedLayering must be synchronized

Page 18: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Decorator PatternDecorator Pattern Chain of objects each holding part of Chain of objects each holding part of

implementationimplementation A call is passed along until it reaches the A call is passed along until it reaches the

object that implements itobject that implements itE3V2

E2V1IV3

ProbelmsProbelms Can not update interfaceCan not update interface Interface is fixedInterface is fixed

Page 19: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

ProxyProxy Acts as a stand-in for another objectActs as a stand-in for another object Normally provides the same interface Normally provides the same interface

as the implementing objectas the implementing object

ProxyImplementation

Page 20: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Sun’s Dynamic ProxySun’s Dynamic Proxy

Takes an ARRAY of interfaces Takes an ARRAY of interfaces -- -- Builds a new interface that combines existing interfacesBuilds a new interface that combines existing interfaces

Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(),

new Class[] { Foo.class },

handler);

Takes a SINGLE implementing objectTakes a SINGLE implementing object-- Single object must implement all interfaces-- Single object must implement all interfaces

Page 21: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Enhancement ExampleEnhancement Example

E3V2 Proxy

E2

I1

Proxy

E3

E2

I1

E2V1IV-C

Page 22: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

AdvantagesAdvantages

Succeeds in meeting LOA criteriaSucceeds in meeting LOA criteria Features are independently composedFeatures are independently composed Features work with all implementation Features work with all implementation

variationsvariations Most extra code needed for Most extra code needed for

composition confined to common composition confined to common codecode

Base interface & implementation Base interface & implementation untoucheduntouched

Page 23: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

ResultsResults

File changesFile changes

To add a featureTo add a featureEnhancemeEnhancementnt

MonolithicMonolithic

1 implementation1 implementation 22 27274 4 implementationsimplementations

55 105105

Call time in Call time in secondsseconds

EnhancemeEnhancementnt

MonolithicMonolithic

1 call (empty 1 call (empty body)body)

0.0000220.0000224 4

0.0000000.0000002 2

MaintenanceMaintenanceComponent with 26 implementation variationsComponent with 26 implementation variations

PerformancePerformance

Page 24: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Related WorkRelated Work

There are many existing LOA approaches:There are many existing LOA approaches: Multiple inheritance – mixinsMultiple inheritance – mixins Compiler modifications, Compiler modifications,

research languages – multiJavaresearch languages – multiJava Generative approaches – FOPGenerative approaches – FOP OtherOther

overlaying dynamic librariesoverlaying dynamic libraries

Page 25: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

ConclusionsConclusions

An LOA approach is essential to feature An LOA approach is essential to feature selection and component scalabilityselection and component scalability

We provide an LOA using standard JavaWe provide an LOA using standard Java This is harder then it should be. We This is harder then it should be. We

believe it is important to extend believe it is important to extend standard languages to provide standard languages to provide RESOLVE like solutionsRESOLVE like solutions

Page 26: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Questions?Questions?

More RESOLVE Information:More RESOLVE Information:www.cs.clemson.edu/~resolve

RESOLVE to Java Translator:RESOLVE to Java Translator:www.cs.clemson.edu/~resolve/

translator

Page 27: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Mac

Swing

Motif

Win32

Example Window Feature SelectionExample Window Feature Selection

Swing

Mac

Motif

Win32

Window

Swing

Mac

Motif

Win32Scroller

Border

Page 28: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Common enhancement

<< abstract >>

EnhancementImplementatio

n

<<Delegates>>Dynamic

Proxy

1..1 0..M

Base Interface Enhancement Interface

Enhancements in JavaEnhancements in Java

Page 29: Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer

Decorator PatternDecorator Pattern

Allows feature implementation to be Allows feature implementation to be added incrementallyadded incrementally

Advantages

Problems Can not update interfaceCan not update interface Interface is fixed Interface is fixed