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.
- T. H. Cormen, C. E. Leiserson, R. L. Rivest, and C. Stein. Introduction to Algorithms. MIT Press, 2009. Google Scholar
Digital Library
- ECMA. ECMAScript Language Specification, 5th edition, 2009. ECMA-262.Google Scholar
- 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 Scholar
Digital Library
- M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- B. Steensgaard. Points-to analysis in almost linear time. In Proc. 23rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL), 1996. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- D. Vardoulakis. CFA2: Pushdown Flow Analysis for Higher-Order Languages. Ph.D. thesis, Northeastern University, 2012. Google Scholar
Digital Library
Index Terms
Semi-automatic rename refactoring for JavaScript
Recommendations
Tool-supported refactoring for JavaScript
OOPSLA '11: Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applicationsRefactoring 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 ...
Semi-automatic rename refactoring for JavaScript
OOPSLA '13: Proceedings of the 2013 ACM SIGPLAN international conference on Object oriented programming systems languages & applicationsModern 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 ...
Tool-Supported Refactoring of Existing Object-Oriented Code into Aspects
Aspect-Oriented Programming (AOP) provides mechanisms for the separation of crosscutting concerns—functionalities scattered through the system and tangled with the base code. Existing systems are a natural testbed for the AOP approach since they often ...







Comments