Automatically Generating Refactorings to Suppport API Evolution

Similar documents
Refactoring Practice: How it is and How it Should be Supported

SOFTWARE reuse simplifies the design of new systems, but,

CatchUp! Capturing and Replaying Refactorings to Support API Evolution

ReBA: Refactoring-aware Binary Adaptation of Evolving Libraries

Overview of Eclipse Lectures. Module Road Map

National Aeronautics and Space and Administration Space Administration. cfe Release 6.6

Exploring the Use of Automated API Migrating Techniques in Practice: An Experience Report on Android

COURSE 11 DESIGN PATTERNS

These new operators are intended to remove some of the holes in the C type system introduced by the old C-style casts.

ReBA: Refactoring-aware Binary Adaptation of Evolving Libraries

1Copyright 2012, Oracle and/or its affiliates. All rights reserved.

CPM: A Declarative Package Manager with Semantic Versioning

Lab 8. An Introduction to Objects

Binghamton University. CS-140 Fall Unit Testing

Magento Technical Guidelines

Java SE 8: Lambda Expressions And The Stream API

C# - ATTRIBUTES. Specifying an Attribute. Predefined Attributes. AttributeUsage

Patl: Safe Program Transformation between APIs with Many-to-Many Mappings. Yingfei Xiong Peking University

CSE 403 Lecture 21. Refactoring and Code Maintenance. Reading: Code Complete, Ch. 24, by S. McConnell Refactoring, by Fowler/Beck/Brant/Opdyke

SOFTWARE ENGINEERING SOFTWARE EVOLUTION. Saulius Ragaišis.

Paradoxes of API Design. Jaroslav Tulach NetBeans Platform Architect

Object-Oriented Principles and Practice / C++

Tapestry. Code less, deliver more. Rayland Jeans

Binghamton University. CS-140 Fall Unit Testing

Run-time Environments

Run-time Environments

Understading Refactorings

Inter-Project Dependencies in Java Software Ecosystems

CPSC 427: Object-Oriented Programming

JUnit in EDA Introduction. 2 JUnit 4.3

Structure of Programming Languages Lecture 10

DSL vs. Library API Shootout

Reflection (in fact, Java introspection)

CPSC 427: Object-Oriented Programming

Assertions, pre/postconditions

mod_perl 2.0 Documentation

Software Reengineering Working with Legacy Code. Martin Pinzger Andy Zaidman Delft University of Technology

AURA: A Hybrid Approach to Identify

1 Version management tools as a basis for integrating Product Derivation and Software Product Families

Oracle Utilities Application Framework

Moodle Plugin Upgrade 2017 ( )

Designing API: 20 API Paradoxes. Jaroslav Tulach NetBeans Platform Architect

How We Refactor, and How We Know It

The Journal of Systems and Software

SpringSource Tool Suites M3

Test Factoring: Focusing test suites on the task at hand

WA1278 Introduction to Java Using Eclipse

Write for your audience

4-Byte AS Numbers. The view from the old BGP world. Geoff Huston October 2006 APNIC

Justification for Names and Optional Parameters

Evolution of Fortran. Presented by: Tauqeer Ahmad. Seminar on Languages for Scientific Computing

04 Webservices. Web APIs REST Coulouris. Roy Fielding, Aphrodite, chp.9. Chp 5/6

Lab Exercise Refactoring using Eclipse

Extract Slice Refactoring. Rani Ettinger, Programming Tools Group, May 19th, 2003

print statements, debugger expressions, test scripts. Writing expressions in a debugger only that t a program works now. An application typically

Analysiss of Software Artifacts

Programming II (CS300)

InsECTJ: A Generic Instrumentation Framework for Collecting Dynamic Information within Eclipse

Run-time Environments. Lecture 13. Prof. Alex Aiken Original Slides (Modified by Prof. Vijay Ganesh) Lecture 13

CS 6V Program Analysis I: Dynamic Detection of Likely Invariants and Robust Signatures for Kernel Data Structure.

CHAPTER 3. Using Java Development Tools

Lecture 8 Classes and Objects Part 2. MIT AITI June 15th, 2005

Classes, interfaces, & documentation. Review of basic building blocks

Testing. My favourite testing quote: Program testing can be used to show the presence of bugs, but never to show their absence!

SpringSource Tool Suites 3.0.0

Refactoring with Eclipse

API Tooling in the Eclipse SDK

Comparing Approaches to Analyze Refactoring Activity on Software Repositories

MarkLogic Server. Information Studio Developer s Guide. MarkLogic 8 February, Copyright 2015 MarkLogic Corporation. All rights reserved.

Automatic Inference of Structural Changes for Matching Across Program Versions

We defined congruence rules that determine the order of evaluation, using the following evaluation

Differential Symbolic Execution

Semantic Versioning A Large Existing Codebase

Stage 11 Array Practice With. Zip Code Encoding

Constructors for classes

Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science

Analysis of Software Evolution Over Time

Oracle Corporation

NetCDF and Scientific Data Durability. Russ Rew, UCAR Unidata ESIP Federation Summer Meeting

Javadoc. Computer Science and Engineering College of Engineering The Ohio State University. Lecture 7

What's New in MySQL 5.7?

Syntax and Grammars 1 / 21

Interface (API) Design

Analysis Tool Project

Eclipse and Java 8. Daniel Megert Platform and JDT Lead Eclipse PMC Member IBM Rational Zurich Research Lab

About this exam review

CSE 331 Midterm Exam Sample Solution 2/18/15

Course Outline. Introduction to java

Evolving Software. CMSC 433 Programming Language Technologies and Paradigms Spring Example. Some Motivations for This Refactoring

JAVA REVIEW cs2420 Introduction to Algorithms and Data Structures Spring 2015

Design and Evaluation of Gradual Typing for Python

Program Verification (6EC version only)

Towards Refactoring-Aware Regression Test Selection

Administrivia. Programming Language Fall Example. Evolving Software. Project 3 coming out Midterm October 28. Refactoring October 14, 2004

Eclipse Scout. Release Notes. Scout Team. Version 7.0

QUIZ Friends class Y;

Let's Treat the Eclipse IDE More Like a Product. Productizing open source Eclipse IDEs

A Third Look At Java. Chapter Seventeen Modern Programming Languages, 2nd ed. 1

Object-Oriented Principles and Practice / C++

Creating a Lattix Dependency Model The Process

Transcription:

Automatically Generating Refactorings to Suppport API Evolution MIT CSAIL Page 1

Outline Library evolution Libraries evolve Clients often don t track library changes Contributions Mechanism to automatically upgrade clients Non-behavior preserving changes Applicability Comparison with other approaches Conclusion Page 2

APIs change Refactorings Bug fixes New functionality Design changes Libraries evolve Deprecated methods, classes, fields, etc are retained for backwards compatibility Page 3

Laziness Fear Clients often don t track library changes Problems result Improvements are missed Code may fail (if old methods are removed) Libraries must maintain deprecated methods (or old versions of the library) indefinitely Page 4

Contributions Use information already in the library to upgrade the client Upgrade information is specified in code (precise, machine readable) Mechanism to test library improvements without changing client Analysis of applicability in two libraries Page 5

Outline Library evolution Mechanism to automatically upgrade clients Upgrading Methods Upgrading Classes Upgrading fields Non-behavior preserving changes Applicability Comparison with other approaches Conclusion Page 6

Upgrading Methods Deprecated code normally includes documentation with a suggested change. For example: /** Use getsize() instead of size() **/ This can be expressed more precisely in the body of the method: @Deprecated public int size() { return getsize(); } A tool can update client code accordingly. Page 7

Upgrading Classes The deprecated class indicates its replacement by extending the new class class NewClass { public void m1() {... } public void m2() {... }... } @Deprecated class OldClass extends NewClass { } The tool could replace uses of OldClass with NewClass Page 8

Upgrading fields A deprecated static final field s replacement is the value of the deprecated field class Old { static final int CURSOR = New.CURSOR;... } The tool could replace instances of Old.CURSOR with New.Cursor Other fields don t have as straightforward a substitution. Annotations could be used in these cases. Page 9

Outline Library evolution Mechanism to automatically upgrade clients Non-behavior preserving changes Library evolution may result in semantic changes Run time selection between implementations Advantages of run time selection Applicability Comparison with other approaches Conclusion Page 10

Library evolution may result in semantic changes Reasons for semantic changes More precise or accurate results may be returned. New exceptions or errors may be thrown Exceptions that were previously thrown may no longer be thrown Clients may rely on the old behavior Library developers will retain and deprecate the previous version for compatibility Page 11

Run time selection between implementations The deprecated method contains two implementations Original implementation A call to the replacement method For example: Deprecated int old_method (Object x) { if (complete_backwards_compatibility) { // old code } else { return new_method (x); } } Page 12

Advantages of run time selection Code with semantic changes can be handled Preferred update to client code is precisely expressed Client can test changes without modifying their code Client can update only if testing indicates that the change is compatible for them. Page 13

Outline Library evolution Mechanism to automatically upgrade clients Non-behavior preserving changes Applicability Library test cases Results Comparison with other approaches Conclusion Page 14

Library test cases java.awt and Apache Byte Code Engineering Library (BCEL) Examined deprecated methods to determine the types of modifications Modifications that our approach supports Rename method Method arguments changed Method semantics changed Rename static final field Modifications that our approach would not support Replace constructor with factory Redesign required Page 15

Results AWT BCEL Supported Rename method 73 0 Yes Method arguments changed 9 0 Yes Method semantics changed 1 4 Yes Rename static final field 13 0 Yes Replace constructor with factory 0 1 No Redesign required 26 0 No Total deprecated methods/fields 122 5 Page 16

Outline Library evolution Mechanism to automatically upgrade clients Non-behavior preserving changes Applicability Comparison with other approaches Other approaches Refactoring disadvantages Conclusion Page 17

Other approaches Chow and Notkin (1996) - annotate changed functions with update rules in the language of Sorcerer Borland (2004) - team refactoring tool Lund University (2004) - similar team refactoring tool for Eclipse Henkel and Diwan (2005) - capture refactorings to an XML file for later replay Page 18

Refactoring disadvantages Changes are limited to refactorings. A new language or file format is required An additional artifact must be shipped A special tool must be used by developers to record refactorings Page 19

Outline Library evolution Mechanism to automatically upgrade clients Non-behavior preserving changes Applicability Comparison with other approaches Conclusion Conveying updates in code is a potentially useful approach Page 20

Conveying updates in code is a potentially useful approach Library developers explicitly and precisely indicate suggested replacements Replacement information is specified and edited in the original programming language Replacement information is encoded directly into the distributed code Clients can test changes before updating The use of particular development environments is not required 79% of examined cases are applicable Page 21

Questions Page 22