Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman...
-
date post
20-Dec-2015 -
Category
Documents
-
view
216 -
download
1
Transcript of Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman...
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.
OverviewOverview Problem DescriptionProblem Description Client PerspectiveClient Perspective A Standard Java SolutionA Standard Java Solution Related WorkRelated Work ConclusionsConclusions
Problem DescriptionProblem Description
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
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
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)
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
Client PerspectiveClient Perspective
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
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
Array_Realiz
List_Realiz
Recursive_Reversal
Reversal_Capability
Iterative_Reversal_Reversal
Search_CapabilityLinear_Search
Stack_Template
Example Stack Feature SelectionExample Stack Feature Selection
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
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)
));
Standard Java SolutionStandard Java Solution
Standard Java SolutionStandard Java Solution
Single InheritanceSingle Inheritance No compiler modificationsNo compiler modifications No toolsNo tools
E3 + E2 + I1 E3V2 + E2V1 + IV-CE2 + I1 E2V1 + IV-CI1 IV-C
How to Implement?How to Implement?
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
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
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
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
Enhancement ExampleEnhancement Example
E3V2 Proxy
E2
I1
Proxy
E3
E2
I1
E2V1IV-C
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
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
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
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
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
Mac
Swing
Motif
Win32
Example Window Feature SelectionExample Window Feature Selection
Swing
Mac
Motif
Win32
Window
Swing
Mac
Motif
Win32Scroller
Border
Common enhancement
<< abstract >>
EnhancementImplementatio
n
<<Delegates>>Dynamic
Proxy
1..1 0..M
Base Interface Enhancement Interface
Enhancements in JavaEnhancements in Java
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