Tool-supported refactoring for JavaScript

  • Authors:
  • Asger Feldthaus;Todd Millstein;Anders Møller;Max Schäfer;Frank Tip

  • Affiliations:
  • Aarhus University, Aarhus, Denmark;University of California, Los Angeles, Los Angeles, CA, USA;Aarhus University, Aarhus, Denmark;University of Oxford, Oxford, United Kingdom;IBM Research, Hawthorne, NY, USA

  • Venue:
  • Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications
  • Year:
  • 2011

Quantified Score

Hi-index 0.00

Visualization

Abstract

Refactoring is a popular technique for improving the structure of existing programs while maintaining their behavior. For statically typed programming languages such as Java, a wide variety of refactorings have been described, and tool support for performing refactorings and ensuring their correctness is widely available in modern IDEs. For the JavaScript programming language, however, existing refactoring tools are less mature and often unable to ensure that program behavior is preserved. Refactoring algorithms that have been developed for statically typed languages are not applicable to JavaScript because of its dynamic nature. We propose a framework for specifying and implementing JavaScript refactorings based on pointer analysis. We describe novel refactorings motivated by best practice recommendations for JavaScript programming, and demonstrate how they can be described concisely in terms of queries provided by our framework. Experiments performed with a prototype implementation on a suite of existing applications show that our approach is well-suited for developing practical refactoring tools for JavaScript.