期刊文献+

单例模式导向的源代码自动重构研究 被引量:6

Singleton Pattern Directed Automatic Refactoring for Source Code
下载PDF
导出
摘要 针对手工重构存在容易引入错误且重构效率较低等问题,本文提出了一种以单例模式为导向的源代码自动重构方法.首先将源代码转换成抽象语法树,然后对抽象语法树进行操作,按照单例模式的要求修改抽象语法树,并自动生成重构后的单例类.该方法不仅可以对指定类进行自动单例化重构,还可以对源代码中所有创建该类实例的代码进行自动重构.对方法进行正确性检验并将其应用于两个不同规模的软件项目,实验结果表明该方法可以准确、高效地实现类的自动单例化重构,重构算法的执行时间与系统规模呈线性关系. In order to reduce introducing errors and increase refactoring efficiency in manual refactoring, a novel automatic refactoring approach which is the Singleton pattern directed for source code is proposed in this paper. Source code is transformed to an abstract syntax tree firstly. Then the abstract syntax tree is handled and modified in accordance with the standard of the Singleton pattern, and the Singleton class is generated by an automatic refactoring program. Not only the target class is refactored to a Singleton class, but also the other classes which have statements for creating the instance of the Singleton are refactored automatically. The approach' s correctness is verified during the experiment stage, and this approach is applied to two software projects with different scales. The experimental results show that the approach can implement automatic refactoring to the Singleton pattern accurately and efficiently,and the execution time of the automatic algorithm has a linear relationship with the size of system.
出处 《小型微型计算机系统》 CSCD 北大核心 2014年第12期2664-2669,共6页 Journal of Chinese Computer Systems
基金 国家自然科学基金项目(60970038 61272148)资助
关键词 源代码解析 抽象语法树 重构 自动重构 单例模式 模式导向重构 source code parsing abstract syntax tree refactoring automatic refactoring the Singleton pattern pattern-directed refactoring
  • 相关文献

参考文献1

二级参考文献9

  • 1JavaCC[ EB/OL]. https://javacc, dev. java. net/, Accessed October 2007. 被引量:1
  • 2JDK1.5 [ EB/OL]. http://java, sun. com/javase/downloads/index. jsp, Accessed March 2008. 被引量:1
  • 3Toshihiro Kamiya, Shinji Kusumoto, Katsuro Inoue. CCFinder: a multilinguistic token-based code clone detection system for large scale source c.ode[ J]. IEEE Transactions on Software Engineering, 2002, 28(7) : 654-670. 被引量:1
  • 4Ira D Baxter, Andrew Yahin, Leonardo Moura, et al. Clone detection using abstract syntax trees[ C]. Proceedings of the Internation- al Conference on Software Maintenance, 1998, 368-377. 被引量:1
  • 5Komondoor R, Horwitz S. Using slicing to identify duplication in source code[ C]. Proceedings of the 8th International Symposium on Static Analysis, 2001, 40 - 56. 被引量:1
  • 6Higo Y, Kamiya T, Kusumoto S, et al. Refactoring support based on code clone analysis[ C]. Proceedings of 5th International Conference on Product Focused Software Process Improvement, April 2004, 220-233. 被引量:1
  • 7Bas Comelissen, Bas Graaf, Leon Moonen. Identification of variation points using dynamic analysis[ C]. Proceedings of First International Workshop on Reengineering Towards Product Lines, November 2005, 9-13. 被引量:1
  • 8Simian [ EB/OL]. http://www, redhillconsulting, com. au/products/simian/, Accessed October 2007. 被引量:1
  • 9JTB [ EB/OL]. http ://compilers. cs. ucla. edu/jtb/, Accessed October 2007. 被引量:1

共引文献13

同被引文献25

引证文献6

二级引证文献6

相关作者

内容加载中请稍等...

相关机构

内容加载中请稍等...

相关主题

内容加载中请稍等...

浏览历史

内容加载中请稍等...
;
使用帮助 返回顶部