25
Frameworkevolution ohne Nebenwirkungen - Automatische Adaption von Clients und Dokumentation Katharina Somieski Innovationsforum, 28.11.2007, Dresden

Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Embed Size (px)

DESCRIPTION

given by Katharina Somieski and IlieSavga at Innovationsforum Dresden, 28.11.2007

Citation preview

Page 1: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Frameworkevolution ohne Nebenwirkungen -Automatische Adaption von Clients und Dokumentation

Katharina SomieskiInnovationsforum, 28.11.2007, Dresden

Page 2: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 2 of 16

Projekt „B2-PDE“

• Beteiligte:– Technische Universität Dresden (Lehrstuhl

Softwaretechnologie)– Comarch Software AG (Dresden)

• FuE-Verbundprojekt gefördert von der SAB

• Projektrahmen: ERP-System „B2“– Praktische Probleme bei neuen Versionen des B2-Frameworks :

• Plugin-Anpassung• Tutorial-Anpassung

Page 3: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Changed-Based Support forBinary Compatibility in Evolving Frameworks

M.Sc. Ilie Şavga (B2-PDE Team)Innovation Forum, 28.11.2007, Dresden

Software Technology Group, Department of Computer Science, Technische Universität Dresden

Page 4: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 4 of 16

Software Frameworks

Plugin Version 1

customer.getDiscount();

Customer

getName() getDiscount()

Framework Version 1

A software framework is a software component that embodies a skeleton solution for a family of related software products and is instantiated by modules containing custom code (plugins).

Johnson and Foote 1998

Page 5: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 5 of 16

Framework Change Breaking a Plugin

Framework Version 2

Plugin Version 1

customer.getDiscount();

Customer

getName() getDiscount()

Customer

getName()

VipCustomer

getDiscount()

Framework Version 1

ExtractSubclass

Page 6: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 6 of 16

Motivation and Goal

We want to automatically preserve binary compatibility of framework and its plugins—the latter must link and run with new framework releases withoutrecompiling.

Using change history automatically retain binary compatibility toreduce the costs and improve the quality of framework upgrade.

Forman et al., 1995

Page 7: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 7 of 16

Change-Driven Adaptation

ExtractSubclass Framework Version 2

Plugin Version 1

customer.getDiscount();

Adapter (wrapper) design pattern

Adapter Version 1-to-2

Customer

getName() getDiscount()

Customer

getName()

VipCustomer

getDiscount()

generategenerate

delegate

delegate

GoF 1995;

Page 8: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 8 of 16

Adaptation Layer for Binary Compatibility

time

Change Specification

Change Specification

GeneratorGenerator F2

P1 P2

AL1delegate

generate

input

Page 9: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 9 of 16

Adaptation Layers for Binary Compatibility

time

Change Specification

Change Specification

GeneratorGenerator

P1 P2

AL1

delegate

generate

input

F3

AL2delegate

generate

P3

Page 10: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 10 of 16

Two Adaptation Tools of B2-PDE

• Differ in how the change information is specified

effectiveness

automation

ADE:change mapping

ComeBack!:refactoring-based

B2-PDE Development

Page 11: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 11 of 16

Framework Refactoring Breaking a Plugin

Framework Version 2

Plugin Version 1

customer.getDiscount();

Customer

getName() getDiscount()

Customer

getName()

VipCustomer

getDiscount()

Framework Version 1

ExtractSubclass

Opdyke 1992; Roberts 1999; Fowler 1999

Refactoring is a behavior-preservingsource transformation.

Refactoring operations comprise >80%of application-breaking API changes.

Dig and Johnson 2005

Page 12: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 12 of 16

The ComeBack! Tool

ComeBack! homepage: http://comeback.sf.net

Framework Binaries

Framework Binaries

Adapter Layer

Adapter Layer

Framework Fact Base

Framework Fact Base

PrologEnginePrologEngine

Adapter Fact BaseAdapter

Fact Base

Refactoring History

Refactoring History

Comeback Library

Comeback Library

ComeBack!

parsing

pretty printing

Page 13: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 13 of 16

Refactoring-Based Adaptation

time

Refactoring History

Refactoring History

GeneratorGenerator F3

P3P1 P2

AL1 AL2delegate

delegate

generategenerate

input

Page 14: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 14 of 16

ADE: Adapter Development Environment

F3F1

Heuristic EngineHeuristic Engine

Change MappingChange Mapping

input input

output

amend and complete

developersdevelopers

Page 15: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 15 of 16

Change-Based Adaptation in ADE

time

Change MappingChange Mapping

GeneratorGenerator F3

P3P1 P2

AL1 AL2delegate

delegate

generategenerate

input

Page 16: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 16 of 16

Adaptation in B2-PDE: Benefits

• Framework developers• no update patches• empowered framework maintenance

• Third-party companies• no manual plugin adaptation

• End Users• „silent“ plugin adaptation

For allTreated as a specification, change history fosters the automaticpreservation of binary compatibility reducing the costs and increasing the quality of framework upgrade.

Page 17: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Backup

Page 18: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 18 of 16

References

R. Johnson and B. Foote. Designing reusable classes. Journal of Object-Oriented Programming, 1(2):22–35, June 1988.W. F. Opdyke. Refactoring Object-Oriented Frameworks. PhD thesis, Urbana-Champaign, IL, USA, 1992.D. B. Roberts. Practical analysis for refactoring. PhD thesis, University of Illinois at Urbana-Champaign, Urbana, Illinois, 1999.M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999.D. Dig and R. Johnson. The role of refactorings in API evolution. In ICSM ’05: Proceedings of the 21st IEEE International Conference on Software

Maintenance (ICSM’05), pages 389–398, Washington, DC, USA, 2005. IEEE Computer Society.GoF: E. Gamma, R. Helm, R. Johnson, and J. Vlisside. Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, Reading,

Massachusetts, 1995. S. Becker, A. Brogi, I. Gorton, S. Overhage, A. Romanovsky, and M. Tivoli. Towards an engineering approach to component adaptation. In R. H.

Reussner, J. A. Stafford, and C. A. Szyperski, editors, Architecting Systems with Trustworthy Components, volume 3938 of Lecture Notes in Computer Science, pages 193–215. Springer, 2004.

J. A. Stafford, and C. A. Szyperski, editors, Architecting Systems with Trustworthy Components, volume 3938 of Lecture Notes in Computer Science, pages 193–215. Springer, 2004.

CORBA homepage. http://www.corba.orgMicrosoft COM homepage. http://www.microsoft.com/Com/default.mspx.J. Camara, C. Canal, J. Cubo, and J. Murillo. An aspectoriented adaptation framework for dynamic component evolution. In 3rd ECOOP Workshop on

Reflection, AOP and Meta-Data for Software Evolution, pages 59–71, 2006.I. R. Forman, M. H. Conner, S. H. Danforth, and L. K. Raper. Release-to-release binary compatibility in SOM. In OOPSLA ’95: Proceedings of the tenth

annual conference on Objectoriented programming systems, languages, and applications, pages 426–438, New York, NY, USA, 1995. ACM Press.

S. Malabarba, R. Pandey, J. Gragg, E. Barr, and J. F. Barnes. Runtime support for type-safe dynamic java classes. In ECOOP ’00: Proceedings of the 14th European Conference on Object-Oriented Programming, pages 337–361, London, UK, 2000. Springer-Verlag.

I.Balaban, F. Tip, and R. Fuhrer. Refactoring support for class library migration. In OOPSLA ’05: Proceedings of the 20th annual ACM SIGPLAN conference on Object oriented programming, systems, languages, and applications, pages 265–279, New York, NY, USA, 2005. ACM Press.

K. Chow and D. Notkin. Semi-automatic update of applications in response to library changes. In ICSM ’96: Proceedings of the 1996 International Conference on Software Maintenance, page 359, Washington, DC, USA, 1996. IEEE Computer Society.

J. Henkel and A. Diwan. Catchup!: capturing and replaying refactorings to support API evolution. In ICSE ’05: Proceedings of the 27th international conference on Software engineering, pages 274–283, New York, NY, USA, 2005. ACM Press.

R. Keller and U. Hoelzle. Binary component adaptation. Lecture Notes in Computer Science, 1445:307–318, 1998.S. Roock and A. Havenstein. Refactoring tags for automatic refactoring of framework dependent applications. In XP’02: Proceedings of Extreme

Programming Conference, pages 182–185, 2002.

Page 19: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 19 of 16

Comebacks

A comeback is a refactoring transforming adapters to compensate for a framework refactoring.

Refactoring

AddClass(class,superclass, subclasses)

Comeback

CbAddClass(class,superclass,subclasses):– RemoveClass (class)

PushDownMethod(class,subclass,method)

ExtractSubclass(class,subclass,methods)

CbPushDownMethod(class,subclass,method):

– AddMethod(class,Method(subclass,method))– RemoveMethod(subclass,method)

CbExtractSubclass(class,subclass,methods):

– forall m in methods: CbPushDownMethod(class,subclass,m)

– CbAddClass(subclass,class,Subclasses(class))

Page 20: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 20 of 16

Related Work

Prevention

Use of a legacy middleware or a specific communication protocol to connect a framework and its plugins.

Facilitation

Distribute changes: change info (as annotations or separate specifications) + adaptation rules.

Cons: middleware-dependent framework development.

Cons: cumbersome manual specifications; invasion by adapter code requires source availability and recompilation.

Pros: transparent client adaptation, in some cases without recompilation.

Pros: potentially unlimitedpower.

CORBA; COM; Forman et al., 1995; Malabarba et al., 2000; Camara et al. 2006;

Balaban et al., 2005; Chow and Notkin 1996; Henkel and Diwan 2005; Keller and Hölze 1998; Roock and Havenstein 2002;

Page 21: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 21 of 16

Setting the Context

RefactoringNote: we consider the addition of functionality also a refactoring Pure Deletion is not allowed

Frameworks API well definedBlack- and white-boxCallbacksNo generic types in the APINo public fields in the APIReflection and serialization used in a adaptive-aware disciplined wayControlled (expressed by refactoring) split/merge of types

Page 22: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 22 of 16

Beyond Refactorings

Adaptable signature-level component mismatches, no protocol orsemantic adaptation.

Intended behavior-modifying framework changes:• Visible: to be tested

– Testing adapters

• Unvisible: to be adapted– Updating change specification

Becker et al. 2004

Dig et al. 2007; MolhadoRef

Page 23: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 23 of 16

• Refactoring acquisition– Manual: annotations, + version control systems– Semi-automatic: metrics-based heuristics, vector space information

retrieval, relating CVS to transactions, origin analysis, clone detection

• combination of syntactic (signature-based, shingles) and semantic(clone detection, reference graphs) analysis

– Automatic: Eclipse and JBuilder

• Refactoring representation– Refactoring-aware SCM system

• Refactoring and metrics– Predictive and retrospective– Process-oriented frameworks

• Refactoring-driven testing

Other Related Issues

Chow and Notkin 1996; Wemmie 2006

Demeyer et al. 2000; Antoniol et al. 2004; Gorg and Weisgerber 2005; Zou and Godfrey 2003; Rysselberghe and Demeyer 2003

Weissgerber and Diehl 2006; Dig et al. 2006

Dig et al. 2007; MolhadoRef

Mens and Demeyer 2001; Cimon et al. 2000; Tahvildari et al. 2003

Bannwart and Müller 2006

Page 24: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 24 of 16

Tecnical Issues

• Linkage problems– Currently by reflection– In the future: by strong names

• Wrapping/Unwrapping types– Imply adaptation-requires dedicated methods– The performance pentalties to estimate

Page 25: Frameworkevolution ohne Nebenwirkung - Automatische Adaption von Clients und Dokumentation

Innovationsforum, 28.11.2007 Ilie Şavga Slide 25 of 16

References

S. Demeyer, S. Ducasse, and O. Nierstrasz. Finding refactorings via change metrics. In OOPSLA ’00: Proceedings of the 15th ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, pages 166–177, New York, NY, USA, 2000. ACM Press.

G. Antoniol, M. D. Penta, and E. Merlo. An automatic approach to identify class evolution discontinuities. In IWPSE ’04: Proceedings of the Principles of Software Evolution, 7th International Workshop on (IWPSE’04), pages 31–40, Washington, DC, USA, 2004. IEEE Computer Society.

C. Gorg and P. Weisgerber. Detecting and visualizing refactorings from software archives. In IWPC ’05: Proceedings of the 13th International Workshop on Program Comprehension, pages 205–214, Washington, DC, USA, 2005. IEEE Computer Society.

L. Zou and M.W. Godfrey. Detecting merging and splitting using origin analysis. In WCRE ’03: Proceedings of the 10th Working Conference on Reverse Engineering, page 146, Washington, DC, USA, 2003. IEEE Computer Society.

F. V. Rysselberghe and S. Demeyer. Reconstruction of successful software evolution using clone detection. In IWPSE ’03: Proceedings of the 6th International Workshop on Principles of Software Evolution, page 126, Washington, DC, USA, 2003. IEEE Computer Society.

P. Weissgerber and S. Diehl. Identifying refactorings from source-code changes. In ASE ’06: Proceedings of the 21st IEEE International Conference on Automated Software Engineering (ASE’06), pages 231–240, Washington, DC, USA, 2006. IEEE Computer Society.

D. Dig, C. Comertoglu, D. Marinov, and R. Johnson. Automated detection of refactorings in evolving components. In D. Thomas, editor, ECOOP, volume 4067 of Lecture Notes in Computer Science, pages 404–428. Springer, 2006.

D. Dig, K. Manzoor, R. Johnson, and T. N. Nguyen. Refactoring-aware configuration management for object-oriented programs. In ICSE, 2007.

Molhadoref homepage. https://netfiles.uiuc.edu/dig/MolhadoRef.C. Bitter. Using Aspect-Oriented Techniques for Adaptation. Master Thesis, TU Dresden, 2007.T. Mens and S. Demeyer. Evolution metrics. In Proc. Int. Workshop on Principles of Software Evolution, 2001.L. Tahvildari, K. Kontogiannis, and J. Mylopoulos. Quality-driven software reengineering. Journal of System Software, 66(3):225–239,

2003.F. Bannwart and P. Müller. Changing programs correctly: Refactoring with specifications. In J. Misra, T. Nipkow, and E. Sekerinski,

editors, FM, volume 4085 of Lecture Notes in Computer Science, pages 492–507. Springer, 2006.T. Mens, N. V. Eetvelde, S. Demeyer, and D. Janssens. Formalizing refactorings with graph transformations: Research articles. Journal

of Software Maintenance and Evolution:Research and Practice, 17(4):247–276, 2005.N.V.Eetvelde. A Graph Transformation Approach to Refactoring. University of Antwerp. PhD. Thesis, 2007.