›› 2016, Vol. 29 ›› Issue (11): 70-.

• 论文 • 上一篇    下一篇

代码依恋检测与重构研究

刘丹丹,赵逢禹   

  1. (上海理工大学 光电信息与计算机工程学院,上海 200093)
  • 出版日期:2016-11-15 发布日期:2016-11-24
  • 作者简介:刘丹丹(1990-),男,硕士研究生。研究方向:软件工程。赵逢禹(1963-),男,博士,教授,硕士生导师。研究方向:计算机软件与软件系统安全,软件工程。
  • 基金资助:

    国家质检公益性行业科研专项基金资助项目(201310032-3)

Detecting Analysis for Feature Envy and Code Refactoring

LIU Dandan,ZHAO Fengyu   

  1. (School of Optical-Electrical and Computer Engineering,University of Shanghai for Science and Technology,Shanghai 200093, China)
  • Online:2016-11-15 Published:2016-11-24

摘要:

代码依恋是指一个类中的方法对其他类的兴趣高于定义此方法的类的一种代码坏味道。文中基于代码依恋的思想,给出代码依恋度的定义与度量方法,设计了代码依恋检测算法,并设计出一种工具BADFeature检测代码依恋味道且重构代码。经实验证实,BADFeature能检测代码依恋味道,且可通过重构消除代码味道。

关键词: 代码依恋, 坏味道, 度, 检测, 重构

Abstract:

Feature envy is a kind of bad smells of codes, which occurs when a method of a class is more interested in some other classes than that in the class itself. Based on feature envy essential concepts, a definition for feature envy is proposed and its measuring method is provided. A feature envy detecting algorithm is introduced and a tool  BADFeature is developed to detect feature envy and to refactory it. The experimental results show that BADFeature can detect feature envy and eliminate it through refactoring.

Key words: feature envy, bad smell, degree, detect, refactoring

中图分类号: 

  • TP311.1