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.
- C. Anderson, P. Giannini, and S. Drossopoulou. Towards Type Inference for JavaScript. In Proc. 19th European Conference on Object-Oriented Programming, volume 3586 of LNCS. Springer-Verlag, July 2005. Google Scholar
Digital Library
- C. Bachmann and E. Pfister. JavaScript Refactoring Eclipse Plug-in. Bachelor thesis, University of Applied Science Rapperswil, 2008.Google Scholar
- M. Balmer and R. Kühni. Refactoring Support für Eclipse JavaScript Development Tools. Diploma thesis, University of Applied Science Rapperswil, 2008.Google Scholar
- K. Beck. Extreme Programming Explained: Embrace Change. Addison-Wesley, 2000. Google Scholar
Digital Library
- D. Crockford. JavaScript: The Good Parts. O'Reilly, 2008. Google Scholar
Digital Library
- Eclipse. JavaScript Development Tools. http://wiki.eclipse.org/JSDT.Google Scholar
- ECMA. ECMAScript Language Specification, 5th edition, 2009. ECMA-262.Google Scholar
- er, Schafer, and Tip}trA. Feldthaus, T. Millstein, A. Møller, M. Schafer, and F. Tip. Tool-supported Refactoring for JavaScript. http://www.brics.dk/jsrefactor/, 2011. Technical Report.Google Scholar
- M. Fowler. Refactoring: Improving the Design of Existing Code. Addison-Wesley, 1999. Google Scholar
Digital Library
- A. Garrido and R. E. Johnson. Refactoring C with Conditional Compilation. In phProc. 18th IEEE International Conference on Automated Software Engineering, October 2003.Google Scholar
Digital Library
- W. G. Griswold. Program Restructuring as an Aid to Software Maintenance. Ph.D. thesis, University of Washington, 1991. Google Scholar
Digital Library
- S. Guarnieri and V. B. Livshits. Gatekeeper: Mostly static enforcement of security and reliability policies for JavaScript code. In Proc. 18th USENIX Security Symposium, August 2009. Google Scholar
Digital Library
- S. Guarnieri, M. Pistoia, O. Tripp, J. Dolby, S. Teilhet, and R. Berg. Saving the world wide web from vulnerable JavaScript. In Proc. 20th International Symposium on Software Testing and Analysis, July 2011. Google Scholar
Digital Library
- A. Guha, S. Krishnamurthi, and T. Jim. Using Static Analysis for Ajax Intrusion Detection. In Proc. 18th International Conference on World Wide Web, May 2009. Google Scholar
Digital Library
- A. Guha, C. Saftoiu, and S. Krishnamurthi. The Essence of JavaScript. In Proc. 24th European Conference on Object-Oriented Programming, volume 6183 of LNCS. Springer-Verlag, June 2010. Google Scholar
Digital Library
- R. Hasti and S. Horwitz. Using Static Single Assignment Form to Improve Flow-Insensitive Pointer Analysis. In Proc. ACM SIGPLAN Conference on Programming Language Design and Implementation, June 1998. Google Scholar
Digital Library
- D. Jang and K.-M. Choe. Points-to Analysis for JavaScript. In Proc. 24th Annual ACM Symposium on Applied Computing, Programming Language Track, March 2009. Google Scholar
Digital Library
- er, and Thiemann}tajs2009S. H. Jensen, A. Møller, and P. Thiemann. Type Analysis for JavaScript. In Proc. 16th International Static Analysis Symposium, volume 5673 of LNCS. Springer-Verlag, August 2009. Google Scholar
Digital Library
- er, and Thiemann}lazypropagation2010S. H. Jensen, A. Møller, and P. Thiemann. Interprocedural Analysis with Lazy Propagation. In Proc. 17th International Static Analysis Symposium, volume 6337 of LNCS. Springer-Verlag, September 2010. Google Scholar
Digital Library
- er}dom2011S. H. Jensen, M. Madsen, and A. Møller. Modeling the HTML DOM and browser API in static analysis of JavaScript web applications. In Proc. European Software Engineering Conference and ACM SIGSOFT International Symposium on Foundations of Software Engineering, September 2011. Google Scholar
Digital Library
- JetBrains. JavaScript Editor. http://www.jetbrains.com/editors/javascript_editor.jsp.Google Scholar
- I. Moore. Automatic Inheritance Hierarchy Restructuring and Method Refactoring. In Proc. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, October 1996. Google Scholar
Digital Library
- W. F. Opdyke. Refactoring Object-Oriented Frameworks. Ph.D. thesis, University of Illinois at Urbana-Champaign, 1992. 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
- P. Saxena, D. Akhawe, S. Hanna, S. McCamant, D. Song, and F. Mao. A Symbolic Execution Framework for JavaScript. In phProc. 31st IEEE Symposium on Security and Privacy, May 2010. Google Scholar
Digital Library
- M. Schafer, T. Ekman, and O. de Moor. Sound and Extensible Renaming for Java. In Proc. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, October 2008. Google Scholar
Digital Library
- F. Tip. Refactoring Using Type Constraints. In Proc. 14th International Static Analysis Symposium, volume 4634 of LNCS. Springer-Verlag, August 2007. Google Scholar
Digital Library
- D. von Dincklage and A. Diwan. Converting Java Classes to Use Generics. In Proc. ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, October 2004. Google Scholar
Digital Library
- World Wide Web Consortium. Document Object Model Level 3. http://www.w3.org/DOM/DOMTR#dom3.Google Scholar
Index Terms
Tool-supported 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 ...
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 ...
Towards an appropriate software refactoring tool support
ACS'09: Proceedings of the 9th WSEAS international conference on Applied computer scienceRefactoring is a technique that is concerned with changing internal software design while external software behaviour is preserved. Although the refactoring process seems to be clear and well defined, there are difficulties with regard to its ...







Comments