Font Size: a A A

Automated JavaScript Refactoring

Posted on:2014-07-09Degree:M.EType:Thesis
University:The Cooper Union for the Advancement of Science and ArtCandidate:Yee, HowardFull Text:PDF
GTID:2458390008453940Subject:Engineering
Abstract/Summary:
Refactoring refers to the rewriting or restructuring of existing code without changing the code's functionality. Refactoring is necessary for improving code structure of existing programs. Benefits of refactoring include maintainability, ease-of-debugging, and improved readability. Although refactoring should be streamlined into a developer's workflow, more times than not, the requirements of rapid development leaves little time for refactoring. Refactoring tools can help to profile programs and alert the developer where code can potentially be refactored, or it can automatically perform the refactoring for the developer.;Many modern IDEs provide plugins for refactoring well-established languages such as Java, C, and C++. However, the minimal usage of JavaScript in the past, and the type of application it was used for never warranted the need for refactoring tools. JavaScript was limited to webpages, and programs typically contained less than a thousand lines worth of code. However, recent wide-spread adoption of JavaScript led to its use in the mobile and backend space, where large JavaScript libraries are being developed. Maintaining these large codebases now become a problem.;I have focused on one specific type of refactoring, known as the Extract Method, in order to develop a framework for refactoring JavaScript. Three established algorithms used to detect code similarity were tested, and ultimately a fourth, custom approach that achieved better speeds by leveraging web technologies was implemented and used. The entire tool's codebase is written in JavaScript and runs within a browser. By using JavaScript and other web technologies, the system is platform agnostic; it can run on most platforms that supports the technologies used within browsers.
Keywords/Search Tags:Refactoring, Javascript, Code, Used
Related items