This Article 
   
 Share 
   
 Bibliographic References 
   
 Add to: 
 
Digg
Furl
Spurl
Blink
Simpy
Google
Del.icio.us
Y!MyWeb
 
 Search 
   
DECOR: A Method for the Specification and Detection of Code and Design Smells
January/February 2010 (vol. 36 no. 1)
pp. 20-36
Naouel Moha, INRIA, IRISA, Université de Rennes 1, France
Yann-Gaël Guéhéneuc, École Polytechnique de Montréal, Québec
Laurence Duchien, LIFL, INRIA Lille-Nord Europe, Université de Lille, France
Anne-Françoise Le Meur, LIFL, INRIA Lille-Nord Europe, Université de Lille, France
Code and design smells are poor solutions to recurring implementation and design problems. They may hinder the evolution of a system by making it hard for software engineers to carry out changes. We propose three contributions to the research field related to code and design smells: 1) Decor, a method that embodies and defines all the steps necessary for the specification and detection of code and design smells, 2) Detex, a detection technique that instantiates this method, and 3) an empirical validation in terms of precision and recall of Detex. The originality of Detex stems from the ability for software engineers to specify smells at a high level of abstraction using a consistent vocabulary and domain-specific language for automatically generating detection algorithms. Using Detex, we specify four well-known design smells: the antipatterns Blob, Functional Decomposition, Spaghetti Code, and Swiss Army Knife, and their 15 underlying code smells, and we automatically generate their detection algorithms. We apply and validate the detection algorithms in terms of precision and recall on Xerces v2.7.0, and discuss the precision of these algorithms on 11 open-source systems.

[1] E. Gamma, R. Helm, R. Johnson, and J. Vlissides, Design Patterns—Elements of Reusable Object-Oriented Software, first ed. Addison-Wesley, 1994.
[2] M. Fowler, Refactoring—Improving the Design of Existing Code, first ed. Addison-Wesley, June 1999.
[3] W.J. Brown, R.C. Malveau, W.H. Brown, H.W. McCormickIII, and T.J. Mowbray, Anti Patterns: Refactoring Software, Architectures, and Projects in Crisis, first ed. John Wiley and Sons, Mar. 1998.
[4] R.S. Pressman, Software Engineering—A Practitioner's Approach, fifth ed. McGraw-Hill Higher Education, Nov. 2001.
[5] G. Travassos, F. Shull, M. Fredericks, and V.R. Basili, "Detecting Defects in Object-Oriented Designs: Using Reading Techniques to Increase Software Quality," Proc. 14th Conf. Object-Oriented Programming, Systems, Languages, and Applications, pp. 47-56, 1999.
[6] N. Moha, Y.-G. Guéhéneuc, and P. Leduc, "Automatic Generation of Detection Algorithms for Design Defects," Proc. 21st Conf. Automated Software Eng., S. Uchitel and S. Easterbrook, eds., pp. 297-300, Sept. 2006.
[7] N. Moha, Y.-G. Guéhéneuc, A.-F.L. Meur, and L. Duchien, "A Domain Analysis to Specify Design Defects and Generate Detection Algorithms," Proc. 11th Int'l Conf. Fundamental Approaches to Software Eng., J. Fiadeiro and P. Inverardi, eds., 2008.
[8] B.V. Rompaey, B.D. Bois, S. Demeyer, and M. Rieger, "On the Detection of Test Smells: A Metrics-Based Approach for General Fixture and Eager Test," IEEE Trans. Software Eng., vol. 33, no. 12, pp. 800-817, Dec. 2007.
[9] G. Bruno, P. Garza, E. Quintarelli, and R. Rossato, "Anomaly Detection in xml Databases by Means of Association Rules," Proc. 18th Int'l Conf. Database and Expert Systems Applications, pp. 387-391, 2007.
[10] S. Jorwekar, A. Fekete, K. Ramamritham, and S. Sudarshan, "Automating the Detection of Snapshot Isolation Anomalies," Proc. 33rd Int'l Conf. Very Large Data Bases, pp. 1263-1274, 2007.
[11] A. Patcha and J.-M. Park, "An Overview of Anomaly Detection Techniques: Existing Solutions and Latest Technological Trends," Computer Networks, vol. 51, no. 12, pp. 3448-3470, 2007.
[12] Y.-G. Guéhéneuc and G. Antoniol, "DeMIMA: A Multi-Layered Framework for Design Pattern Identification," IEEE Trans. Software Eng., vol. 34, no. 5, pp. 667-684, Sept./Oct. 2008.
[13] B.F. Webster, Pitfalls of Object Oriented Development, first ed. M&T Books, Feb. 1995.
[14] A.J. Riel, Object-Oriented Design Heuristics. Addison-Wesley, 1996.
[15] M. Mäntylä, "Bad Smells in Software—A Taxonomy and an Empirical Study," PhD dissertation, Helsinki Univ. of Tech nology, 2003.
[16] W.C. Wake, Refactoring Workbook. Addison-Wesley Longman Publishing Co., Inc., 2003.
[17] R. Marinescu, "Detection Strategies: Metrics-Based Rules for Detecting Design Flaws," Proc. 20th Int'l Conf. Software Maintenance, pp. 350-359, 2004.
[18] M.J. Munro, "Product Metrics for Automatic Identification of "Bad Smell" Design Problems in Java Source-Code," Proc. 11th Int'l Software Metrics Symp., F. Lanubile and C. Seaman, eds., Sept. 2005.
[19] E.H. Alikacem and H. Sahraoui, "Generic Metric Extraction Framework," Proc. 16th Int'l Workshop Software Measurement and Metrik Kongress, pp. 383-390, 2006.
[20] K. Dhambri, H. Sahraoui, and P. Poulin, "Visual Detection of Design Anomalies," Proc. 12th European Conf. Software Maintenance and Reeng., pp. 279-283, Apr. 2008.
[21] F. Simon, F. Steinbrückner, and C. Lewerentz, "Metrics Based Refactoring," Proc. Fifth European Conf. Software Maintenance and Reeng., p. 30, 2001.
[22] G. Langelier, H.A. Sahraoui, and P. Poulin, "Visualization-Based Analysis of Quality for Large-Scale Software Systems," Proc. 20th Int'l Conf. Automated Software Eng., T. Ellman and A. Zisma, eds., Nov. 2005.
[23] M. Lanza and R. Marinescu, Object-Oriented Metrics in Practice. Springer-Verlag, 2006.
[24] E. van Emden and L. Moonen, "Java Quality Assurance by Detecting Code Smells," Proc. Ninth Working Conf. Reverse Eng., Oct. 2002.
[25] D. Garlan, R. Allen, and J. Ockerbloom, "Architectural Mismatch: Why Reuse Is So Hard," IEEE Software, vol. 12, no. 6, pp. 17-26, Nov. 1995.
[26] R. Allen and D. Garlan, "A Formal Basis for Architectural Connection," ACM Trans. Software Eng. and Methodology, vol. 6, no. 3, pp. 213-249, 1997.
[27] E.M. Dashofy, A. van der Hoek, and R.N. Taylor, "A Comprehensive Approach for the Development of Modular Software Architecture Description Languages," ACM Trans. Software Eng. and Methodology, vol. 14, no. 2, pp. 199-245, 2005.
[28] D. Jackson, "Aspect: Detecting Bugs with Abstract Dependences," ACM Trans. Software Eng. and Methodology, vol. 4, no. 2, pp. 109-145, 1995.
[29] D. Evans, "Static Detection of Dynamic Memory Errors," Proc. Conf. Programming Language Design and Implementation, pp. 44-53, 1996.
[30] D.L. Detlefs, "An Overview of the Extended Static Checking System," Proc. First Formal Methods in Software Practice Workshop, 1996.
[31] J. Brant, Smalllint, http://st-www.cs.uiuc.edu/users/brant/ Refactory Lint.html, Apr. 1997.
[32] D. Hovemeyer and W. Pugh, "Finding Bugs Is Easy," SIGPLAN Notices, vol. 39, no. 12, pp. 92-106, 2004.
[33] D. Reimer, E. Schonberg, K. Srinivas, H. Srinivasan, B. Alpern, R.D. Johnson, A. Kershenbaum, and L. Koved, "Saber: Smart Analysis Based Error Reduction," Proc. 2004 ACM SIGSOFT Int'l Symp. Software Testing and Analysis, pp. 243-251, 2004.
[34] Analyst4j, http:/www.codeswat.com/, Feb. 2008.
[35] PMD, http:/pmd.sourceforge.net/, June 2002.
[36] CheckStyle, http:/checkstyle.sourceforge.net, 2004.
[37] FXCop, http://www.binarycoder.net/fxcopindex.html , June 2006.
[38] Hammurapi, http:/www.hammurapi.biz/, Oct. 2007.
[39] SemmleCode, http:/semmle.com/, Oct. 2007.
[40] D. Beyer, A. Noack, and C. Lewerentz, "Efficient Relational Calculation for Software Analysis," IEEE Trans. Software Eng., vol. 31, no. 2, pp. 137-149, Feb. 2005.
[41] D. Beyer, T.A. Henzinger, R. Jhala, and R. Majumdar, "The Software Model Checker Blast: Applications to Software Engineering," Int'l J. Software Tools for Technology Transfer, vol. 9, pp. 505-525, 2007.
[42] H. Chen and D. Wagner, "Mops: An Infrastructure for Examining Security Properties of Software." Proc. Ninth ACM Conf. Computer and Comm. Security, pp. 235-244, 2002.
[43] R. Prieto-Díaz, "Domain Analysis: An Introduction," Software Eng. Notes, vol. 15, no. 2, pp. 47-54, Apr. 1990.
[44] R. Wirfs-Brock and A. McKean, Object Design: Roles, Responsibilities and Collaborations. Addison-Wesley Professional, 2002.
[45] Y.-G. Guéhéneuc and H. Albin-Amiot, "Using Design Patterns and Constraints to Automate the Detection and Correction of Inter-Class Design Defects," Proc. 39th Conf. Technology of Object-Oriented Languages and Systems, Q. Li, R. Riehle, G. Pour, and B. Meyer, eds., pp. 296-305, July 2001.
[46] S. Boroday, A. Petrenko, J. Singh, and H. Hallal, "Dynamic Analysis of Java Applications for Multithreaded Antipatterns," Proc. Third Int'l Workshop Dynamic Analysis, pp. 1-7, 2005.
[47] B. Dudney, S. Asbury, J. Krozak, and K. Wittkopf, J2EE AntiPatterns. Wiley, 2003.
[48] B.A. Tate and B.R. Flowers, Bitter Java. Manning Publications, 2002.
[49] C.U. Smith and L.G. Williams, Performance Solutions: A Practical Guide to Creating Responsive, Scalable Software. Addison-Wesley Professional, 2002.
[50] J.K.-Y. Ng and Y.-G. Guéhéneuc, "Identification of Behavioral and Creational Design Patterns through Dynamic Analysis," Proc. Third Int'l Workshop Program Comprehension through Dynamic Analysis, A. Zaidman, A. Hamou-Lhadj, and O. Greevy, eds., pp. 34-42, Oct. 2007.
[51] J.M. Chambers, W.S. Clevelmd, B. Kleiner, and P.A. Tukey, Graphical Methods for Data Analysis. Wadsworth Int'l, 1983.
[52] R. Marinescu, "Measurement and Quality in Object-Oriented Design," PhD dissertation, Politehnica Univ. of Timisoara, June 2002.
[53] S.R. Chidamber and C.F. Kemerer, "A Metrics Suite for Object Oriented Design," IEEE Trans. Software Eng., vol. 20, no. 6, pp. 476-493, June 1994.
[54] Y.-G. Guéhéneuc and H. Albin-Amiot, "Recovering Binary Class Relationships: Putting Icing on the UMLcake," Proc. 19th Conf. Object-Oriented Programming, Systems, Languages, and Applications, D.C. Schmidt, ed., pp. 301-314, Oct. 2004.
[55] C. Consel and R. Marlet, "Architecturing Software Using: A Methodology for Language Development," Lecture Notes in Computer Science, pp. 170-194, Springer, Sept. 1998.
[56] R. Wuyts, "Declarative Reasoning about the Structure of Object-Oriented Systems," Proc. 26th Conf. Technology of Object-Oriented Languages and Systems, J. Gil, ed., pp. 112-124, Aug. 1998.
[57] DECOR, http://www.ptidej.net/researchdecor/, Jan. 2010.
[58] G. Kiczales, J. des Rivières, and D.G. Bobrow, The Art of the Metaobject Protocol, first ed. MIT Press, July 1991.
[59] M. Mernik, J. Heering, and A.M. Sloane, "When and How to Develop Domain-Specific Languages," ACM Computing Surveys, vol. 37, no. 4, pp. 316-344, Dec. 2005.
[60] Y.-G. Guéhéneuc, H. Sahraoui, and F. Zaidi, "Fingerprinting Design Patterns," Proc. 11th Working Conf. Reverse Eng., E. Stroulia and A. de Lucia, eds., pp. 172-181, Nov. 2004.
[61] H. Albin-Amiot, P. Cointe, and Y.-G. Guéhéneuc, "Francaisun Méta-Modèle pour Coupler Application et Détection des Design Patterns," Proc. Actes du $8^{e}$ Colloque Langages et Modèles à Objets, M. Dao and M. Huchard, eds., vol. 8, nos. 1/2, pp. 41-58, Jan. 2002.
[62] S. Demeyer, S. Tichelaar, and S. Ducasse, "FAMIX 2.1—The FAMOOS Information Exchange Model," technical report, Univ. of Bern, 2001.
[63] A. Winter, B. Kullbach, and V. Riediger, "An Overview of the GXL Graph Exchange Language," Software Visualization, S. Diehl, ed., pp. 324-336, Springer, 2002.
[64] G.C. Murphy and D. Notkin, "Lightweight Lexical Source Model Extraction," ACM Trans. Software Eng. and Methodology, vol. 5, no. 3, pp. 262-292, 1996.
[65] H.A. Muller, J.H. Jahnke, D.B. Smith, M.-A.D. Storey, S.R. Tilley, and K. Wong, "Reverse Engineering: A Roadmap," Proc. Int'l Conf. Software Eng.—Future of SE Track, pp. 47-60, 2000.
[66] W.B. Frakes and R.A. Baeza-Yates, Information Retrieval: Data Structures and Algorithms. Prentice-Hall, 1992.

Index Terms:
Antipatterns, design smells, code smells, specification, metamodeling, detection, Java.
Citation:
Naouel Moha, Yann-Gaël Guéhéneuc, Laurence Duchien, Anne-Françoise Le Meur, "DECOR: A Method for the Specification and Detection of Code and Design Smells," IEEE Transactions on Software Engineering, vol. 36, no. 1, pp. 20-36, Jan.-Feb. 2010, doi:10.1109/TSE.2009.50
Usage of this product signifies your acceptance of the Terms of Use.