skip to main content
research-article

Semi-automatic rename refactoring for JavaScript

Published:29 October 2013Publication History
Skip Abstract Section

Abstract

Modern IDEs support automated refactoring for many programming languages, but support for JavaScript is still primitive. To perform renaming, which is one of the fundamental refactorings, there is often no practical alternative to simple syntactic search-and-replace. Although more sophisticated alternatives have been developed, they are limited by whole-program assumptions and poor scalability.

We propose a technique for semi-automatic refactoring for JavaScript, with a focus on renaming. Unlike traditional refactoring algorithms, semi-automatic refactoring works by a combination of static analysis and interaction with the programmer. With this pragmatic approach, we can provide scalable and effective refactoring support for real-world code, including libraries and incomplete applications. Through a series of experiments that estimate how much manual effort our technique demands from the programmer, we show that our approach is a useful improvement compared to search-and-replace tools.

References

  1. T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. ECMA. ECMAScript Language Specification, 5th edition, 2009. ECMA-262.Google ScholarGoogle Scholar
  3. A. Feldthaus, T. Millstein, A. Møller, M. Schäfer, and F. Tip. Tool-supported refactoring for JavaScript. In Proc. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), October 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. A. Guha, C. Saftoiu, and S. Krishnamurthi. Typing local control and state using flow analysis. In Proc. 20th European Symposium on Programming (ESOP), 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. H. Jensen, A. Møller, and P. Thiemann. Type Analysis for JavaScript. In Proc. 16th International Static Analysis Symposium (SAS), volume 5673 of LNCS. Springer-Verlag, August 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. M. Madsen, B. Livshits, and M. Fanning. Practical static analysis of JavaScript applications in the presence of frameworks and libraries. MSR-TR-2012-66, Microsoft Research, 2012.Google ScholarGoogle Scholar
  8. E. R. Murphy-Hill, C. Parnin, and A. P. Black. How we refactor, and how we know it. IEEE Trans. Software Eng., 38(1):5--18, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. D. B. Roberts, J. Brant, and R. Johnson. A Refactoring Tool for Smalltalk. Theory and Practice of Object Systems, 3(4): 253--263, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. M. Sridharan, J. Dolby, S. Chandra, M. Schäfer, and F. Tip. Correlation tracking for points-to analysis of JavaScript. In Proc. 26th European Conference Object-Oriented Programming (ECOOP), 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. B. Steensgaard. Points-to analysis in almost linear time. In Proc. 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. M. Vakilian, N. Chen, S. Negara, B. A. Rajkumar, B. P. Bailey, and R. E. Johnson. Use, disuse, and misuse of automated refactorings. In Proc. 34th International Conference on Software Engineering (ICSE), 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. D. Vardoulakis. CFA2: Pushdown Flow Analysis for Higher-Order Languages. Ph.D. thesis, Northeastern University, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Semi-automatic rename refactoring for JavaScript

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in

    Full Access

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 48, Issue 10
      OOPSLA '13
      October 2013
      867 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2544173
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '13: Proceedings of the 2013 ACM SIGPLAN international conference on Object oriented programming systems languages & applications
        October 2013
        904 pages
        ISBN:9781450323741
        DOI:10.1145/2509136

      Copyright © 2013 ACM

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 29 October 2013

      Check for updates

      Qualifiers

      • research-article

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!