全部 标题 作者
关键词 摘要

OALib Journal期刊
ISSN: 2333-9721
费用:99美元

查看量下载量

相关文章

更多...

Exploring the Eradication of Code Smells: An Empirical and Theoretical Perspective

DOI: 10.1155/2010/820103

Full-Text   Cite this paper   Add to My Lib

Abstract:

Code smells reflect code decay, and, as such, developers should seek to eradicate such smells through application of “deodorant” in the form of one or more refactorings. However, a relative lack of studies exploring code smells either theoretically or empirically when compared with literature on refactoring suggests that there are reasons why smell eradication is neither being applied in anger, nor the subject of significant research. In this paper, we present three studies as supporting evidence for this stance. The first is an analysis of a set of five, open-source Java systems in which we show very little tendency for smells to be eradicated by developers; the second is an empirical study of a subsystem of a proprietary, C# web-based application where practical problems arise in smell identification and the third, a theoretical enumeration of smell-related refactorings to suggest why smells may be left alone from an effort perspective. Key findings of the study were that first, smells requiring application of simple refactorings were eradicated in favour of smells requiring more complex refactorings; second, a wide range of conflicts and anomalies soon emerged when trying to identify smelly code; an interesting result with respect to comment lines was also observed. Finally, perceived (estimated) effort to eradicate a smell may be a key factor in explaining why smell eradication is avoided by developers. The study thus highlights the need for a clearer research strategy on the issue of code smells and all aspects of their identification and measurement. 1. Introduction Bad code smells are a concept described in Fowler [1] to denote code that “screams out” to be refactored. In other words, it reflects code that is decaying and, unless eradicated, is likely to be the cause of frequent future maintenance, potential faults, and associated testing overheads. Left unchecked and free to fester over time, smells can soon become “stenches” with the potential for relatively high fault-proneness, added maintenance demands, and extratesting as outcomes. An evolving system left to decay is a problem “stored-up” and growing in size for a later date. Eradication of a smell is usually achieved through application of a single, or set of, refactoring/s, and twenty-two different code smells are described by Fowler in [1] together with the refactorings that are needed to remedy those smells. While the related topic of refactoring has been the subject of a significant number of research and other studies [2–9], the empirical and theoretical study of code smells seems to

References

[1]  M. Fowler, Refactoring (Improving the Design of Existing Code), Addison Wesley, 1999.
[2]  S. Counsell, Y. Hassoun, G. Loizou, and R. Najjar, “Common refactorings, a dependency graph and some code smells: an empirical study of java OSS,” in Proceedings of the 5th ACM-IEEE International Symposium on Empirical Software Engineering (ISESE '06), pp. 288–296, Rio de Janeiro, Brazil, September 2006.
[3]  S. Counsell, “Is the need to follow chains a possible deterrent to certain refactorings and an inducement to others?” in Proceedings of the 2nd International Conference on Research Challenges in Information Science (RCIS '08), pp. 111–122, Marrakech, Morocco, June 2008.
[4]  S. Demeyer, S. Ducasse, and O. Nierstrasz, “Finding refactorings via change metrics,” in Proceedings of the ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA '00), pp. 166–177, Minneapolis, Minn, USA, October 2000.
[5]  J. Kerievsky, Refactoring to Patterns, Addison-Wesley, 2005.
[6]  T. Mens and A. van Deursen, “Refactoring: emerging trends and open problems,” in Proceedings 1st International Workshop on REFactoring: Achievements, Challenges, and Effects (REFACE '03), Univ. of Waterloo, 2003.
[7]  T. Mens and T. Tourwé, “A survey of software refactoring,” IEEE Transactions on Software Engineering, vol. 30, no. 2, pp. 126–139, 2004.
[8]  R. Najjar, S. Counsell, G. Loizou, and K. Mannock, “The role of constructors in the context of refactoring object-oriented software,” in IEEE European Conference on Software Maintenance and Reengineering, pp. 111–120, Benevento, Italy, March 2003.
[9]  W. Opdyke, Refactoring object-oriented frameworks, Ph.D. thesis, Univ. of Illinois, 1992.
[10]  M. V. M?ntyl?, J. Vanhanen, and C. Lassenius, “Bad smells—humans as code critics,” in Proceedings of the 20th IEEE International Conference on Software Maintenance (ICSM '04), pp. 399–408, Chicago, Ill, USA, September 2004.
[11]  M. V. M?ntyl? and C. Lassenius, “Subjective evaluation of software evolvability using code smells: an empirical study,” Empirical Software Engineering, vol. 11, no. 3, pp. 395–431, 2006.
[12]  M. V. M?ntyl? and C. Lassenius, “Drivers for software refactoring decisions,” in Proceedings of the 5th ACM-IEEE International Symposium on Empirical Software Engineering (ISCE '06), pp. 297–306, Rio de Janeiro, Brazil, September 2006.
[13]  M. M?ntyl?, Bad smells in software–a taxonomy and an empirical study, M.S. thesis, Helsinki University of Technology, Software Business and Engineering Institute, 2003.
[14]  F. Khomh, S. Vaucher, Y.-G. Guéehéeneuc, and H. Sahraoui, “A bayesian approach for the detection of code and design smells,” in Proceedings 9th International Conference on Quality Software (QSIC '09), C. Byoung-ju, Ed., pp. 305–314, August 2009.
[15]  F. Khomh, M. Di Penta, and Y.-G. Guéhéneuc, “An exploratory study of the impact of code smells on software change-proneness,” in Proceedings 16th Working Conference on Reverse Engineering (WCRE '09), pp. 75–84, Antwerp, Belgium, October 2009.
[16]  S. Olbrich, D. S. Cruzes, V. Basili, and N. Zazworka, “The evolution and impact of code smells: a case study of two open source systems,” in Proceedings of the 3rd International Symposium on Empirical Software Engineering and Measurement (ESEM '09), pp. 390–400, Lake Buena Vista, Fla, USA, October 2009.
[17]  S. M. Olbrich, D. S. Cruzes, and D. I. K. Sjoberg, “Are all code smells harmful? A study of God Classes and Brain Classes in the evolution of three open source systems,” in Proceedings of IEEE International Conference on Software Maintenance (ICSM '10), Timisoara, Romania, September 2010.
[18]  W. Li and R. Shatnawi, “An empirical study of the bad smells and class error probability in the post-release object-oriented system evolution,” Journal of Systems and Software, vol. 80, no. 7, pp. 1120–1128, 2007.
[19]  E. Van Emden and L. Moonen, “Java quality assurance by detecting code smells,” in Proceedings of the 9th Working Conference on Reverse Engineering (WCRE '02), Richmond, Va, USA, 2002.
[20]  R. Marinescu, “Detection strategies: Metrics-based rules for detecting design flaws,” in Proceedings of the 20th IEEE International Conference on Software Maintenance (ICSM '04), pp. 350–359, Chicago, Ill, USA, September 2004.
[21]  R. Marinescu, “Measurement and quality in object-oriented design,” in Proceedings of the 21st IEEE International Conference on Software Maintenance (ICSM '05), pp. 701–704, September 2005.
[22]  H. Hamza, S. Counsell, G. Loizou, and T. Hall, “Code smell eradication and associated refactoring,” in Proceedings of the European Computing Conference (ECC '08), Malta, September 2008.
[23]  S. Counsell and S. Swift, “Refactoring steps, java refactorings and empirical evidence,” in Proceedings of the 32nd Annual IEEE International Computer Software and Applications Conference, pp. 176–179, Turku, Finland, August 2008.
[24]  SourceMonitor Tool, http://www.campwoodsw.com/sourcemonitor.html.
[25]  N. Fenton and S. Pfleeger, Software Metrics: A Rigorous and Practical Approach, International Thomson Press, London, UK, 2002.
[26]  S. R. Chidamber and C. F. Kemerer, “Metrics suite for object oriented design,” IEEE Transactions on Software Engineering, vol. 20, no. 6, pp. 476–493, 1994.
[27]  S. McConnell, Code Complete: A Practical Handbook of Software Construction, Microsoft Press, 2004.
[28]  M. Fowler, Patterns of Enterprise Application Architecture, Addison Wesley, 2003.
[29]  S. Counsell, S. Swift, and J. Crampton, “The interpretation and utility of three cohesion metrics for object-oriented design,” ACM Transactions on Software Engineering and Methodology, vol. 15, no. 2, pp. 123–149, 2006.
[30]  R. Wheeldon and S. Counsell, “Power law distributions in class relationships,” in Proceedings of the 3rd IEEE International Workshop on Source Code Analysis and Manipulation, pp. 45–54, Amsterdam, The Netherlands, 2003.
[31]  B. Pietrzak and B. Walter, “Leveraging code smell detection with inter-smell relations,” in Proceedings of the 7th International Conference on Extreme Programming and Agile Processes in Software Engineering (XP '06), vol. 4044 of Lecture Notes in Computer Science, pp. 75–84, Oulu, Finland, June 2006.
[32]  C. F. Kemerer and S. Slaughter, “An empirical approach to studying software evolution,” IEEE Transactions on Software Engineering, vol. 25, no. 4, pp. 493–509, 1999.
[33]  T. T. Dinh-Trong and J. M. Bieman, “The FreeBSB project: a replication case study of open source development,” IEEE Transactions on Software Engineering, vol. 31, no. 6, pp. 481–494, 2005.

Full-Text

comments powered by Disqus

Contact Us

service@oalib.com

QQ:3279437679

WhatsApp +8615387084133

WeChat 1538708413