Download presentation
Presentation is loading. Please wait.
1
Enhancements Enabling Flexible Feature and Implementation Selection John Hunt and Murali Sitaraman Reusable Software Research Group Department of Computer Science Clemson University, USA This research is funded in part by the U. S. National Science Foundation under grant CCR-0113181.
2
Overview Problem Description Problem Description Client Perspective Client Perspective A Standard Java Solution A Standard Java Solution Related Work Related Work Conclusions Conclusions
3
Problem Description
4
Component Design We need to separate component interfaces from implementation Separates what from how – information hiding Separates what from how – information hiding Different implementations allow performance trade-offs, particularly between time and space Different implementations allow performance trade-offs, particularly between time and space Consequence: Each component will have multiple implementations
5
Need for Feature Addition Interfaces can not be exhaustive Interfaces can not be exhaustive -- Knowledge of a clients needs is never complete Interfaces should not be exhaustive Interfaces should not be exhaustive -- Avoid large / complex / bloated components Consequence: Clients must be able to choose between features Consequence: Feature addition is unavoidable
6
Scaling Dilemma IV-A Feature 1 IV-EIV-DIV-C IV-B Feature 2 Booch: 26 to 30 variations per concept Biggerstaff (ICSR 3) -- Economic Argument (cost exceeds reuse value)
7
Solution Criteria Must be able to compose features independently Must be able to compose features independently A Feature must work with all implementation variations A Feature must work with all implementation variations Layers of Abstraction Consequence: Features must be dependent only on base interfaces
8
Client Perspective
9
Composition Steps Select a base abstraction Select a base abstraction Select a base implementation Select a base implementation Select a feature(s) to “enhance” the base Select a feature(s) to “enhance” the base Select a feature(s) implementation Select a feature(s) implementation
10
E1V1 E1 1 E2V2 E3V1 1 E3 E3V2 E2 E2V2 E2V1 E E2V3 2V3 IV-D IV-A IV-C IV-B I1 Feature and Implementation Selection
11
Array_Realiz List_Realiz Recursive_Reversal Reversal_Capability Iterative_Reversal _Reversal Search_Capability Linear_Search Stack_Template Example Stack Feature Selection
12
realized by Array_Realiz Stack Composition - RESOLVE Facility Int_Stack is Stack_Template(Integer, size) enhanced by Reversal_Capability realized by Recursive_Reversal ; ; enhanced by Search_Capability realized by Linear_Search; Array_Realiz List_Realiz Recursive_Reversal Reversal_Capability Iterative_Reversal _Reversal Search_Capability Linear_Search Stack_Template
13
new Array_Realiz(size); Stack Composition - Java Stack_Template myStack = Array_Realiz List_Realiz Recursive_Reversal Reversal_Capability Iterative_Reversal _Reversal Search_Capability Linear_Search Stack_Template Recursive_Reversal.addEnhancement( new Array_Realiz(size) ); Linear_Search.addEnhancement( Recursive_Reversal.addEnhancement( new Array_Realiz(size) ) );
14
Standard Java Solution
15
Single Inheritance Single Inheritance No compiler modifications No compiler modifications No tools No tools
16
E3 + E2 + I1E3V2 + E2V1 + IV-C E2 + I1E2V1 + IV-C I1 IV-C How to Implement?
17
Combine Techniques Implementation Layers use decorator pattern - GOF Implementation Layers use decorator pattern - GOF Interface Layers use dynamic proxy - Java 1.3 feature Interface Layers use dynamic proxy - Java 1.3 feature Layering must be synchronized Layering must be synchronized
18
Decorator Pattern Chain of objects each holding part of implementation Chain of objects each holding part of implementation A call is passed along until it reaches the object that implements it A call is passed along until it reaches the object that implements it E3V2 E2V1 IV3 Probelms Can not update interface Can not update interface Interface is fixed Interface is fixed
19
Proxy Acts as a stand-in for another object Acts as a stand-in for another object Normally provides the same interface as the implementing object Normally provides the same interface as the implementing object Proxy Implementation
20
Sun’s Dynamic Proxy Takes an ARRAY of interfaces Takes an ARRAY of interfaces -- Builds a new interface that combines existing interfaces Foo f = (Foo) Proxy.newProxyInstance(Foo.class.getClassLoader(), new Class[] { Foo.class }, handler); Takes a SINGLE implementing object Takes a SINGLE implementing object -- Single object must implement all interfaces
21
Enhancement Example E3V2 Proxy E2 I1 Proxy E3 E2 I1 E2V1IV-C
22
Advantages Succeeds in meeting LOA criteria Succeeds in meeting LOA criteria Features are independently composed Features are independently composed Features work with all implementation variations Features work with all implementation variations Most extra code needed for composition confined to common code Most extra code needed for composition confined to common code Base interface & implementation untouched Base interface & implementation untouched
23
Results File changes To add a feature EnhancementMonolithic 1 implementation 227 4 implementations 5105 Call time in seconds EnhancementMonolithic 1 call (empty body) 0.00002240.0000002 Maintenance Component with 26 implementation variations Performance
24
Related Work There are many existing LOA approaches: Multiple inheritance – mixins Multiple inheritance – mixins Compiler modifications, Compiler modifications, research languages – multiJava Generative approaches – FOP Generative approaches – FOP Other Other overlaying dynamic libraries
25
Conclusions An LOA approach is essential to feature selection and component scalability An LOA approach is essential to feature selection and component scalability We provide an LOA using standard Java We provide an LOA using standard Java This is harder then it should be. We believe it is important to extend standard languages to provide RESOLVE like solutions This is harder then it should be. We believe it is important to extend standard languages to provide RESOLVE like solutions
26
Questions? More RESOLVE Information: www.cs.clemson.edu/~resolve RESOLVE to Java Translator: www.cs.clemson.edu/~resolve/translator
27
Mac Swing Motif Win32 Example Window Feature Selection Swing Mac Motif Win32 Window Swing Mac Motif Win32 Scroller Border
28
Common enhancement > Enhancement Implementation > Dynamic Proxy 1..10..M Base Interface Enhancement Interface Enhancements in Java
29
Decorator Pattern Allows feature implementation to be added incrementally Allows feature implementation to be added incrementally Advantages Problems Can not update interface Can not update interface Interface is fixed Interface is fixed
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.