Code Smells Revisited: A Variability Perspective

Highly-configurable software systems (also called software product lines) gain momentum in both, academia and industry. For instance, the Linux kernel comes with over 12 000 configuration options and thus, can be customized to run on nearly every kind of system. To a large degree, this configurability is achieved through variable code structures, for instance, using conditional compilation. Such source code variability adds a new dimension of complexity, thus giving rise to new possibilities for design flaws. Code smells are an established concept to describe design flaws or decay in source code. However, existing smells have no notion of variability and thus do not support flaws regarding variable code structures. In this paper, we propose an initial catalog of four variability-aware code smells. We discuss the appearance and negative effects of these smells and present code examples from real-world systems. To evaluate our catalog, we have conducted a survey amongst 15 researchers from the field of software product lines. The results confirm that our proposed smells (a) have been observed in existing product lines and (b) are considered to be problematic for common software development activities, such as program comprehension, maintenance, and evolution.

[1]  Aiko Yamashita How Good Are Code Smells for Evaluating Software Maintainability? Results from a Comparative Case Study , 2013, 2013 IEEE International Conference on Software Maintenance.

[2]  Mauricio A. Saca Refactoring improving the design of existing code , 2017, 2017 IEEE 37th Central America and Panama Convention (CONCAPAN XXXVII).

[3]  Ira D. Baxter,et al.  Preprocessor conditional removal by simple partial evaluation , 2001, Proceedings Eighth Working Conference on Reverse Engineering.

[4]  Gunter Saake,et al.  Feature-Oriented Software Product Lines , 2013, Springer Berlin Heidelberg.

[5]  Thomas J. Mowbray,et al.  AntiPatterns: Refactoring Software, Architectures, and Projects in Crisis , 1998 .

[6]  Thomas Leich,et al.  FeatureIDE: An extensible framework for feature-oriented software development , 2014, Sci. Comput. Program..

[7]  Don S. Batory,et al.  Scaling step-wise refinement , 2004, IEEE Transactions on Software Engineering.

[8]  Michael D. Ernst,et al.  An Empirical Analysis of C Preprocessor Use , 2002, IEEE Trans. Software Eng..

[9]  Don S. Batory,et al.  Feature Models, Grammars, and Propositional Formulas , 2005, SPLC.

[10]  Yann-Gaël Guéhéneuc,et al.  A Domain Analysis to Specify Design Defects and Generate Detection Algorithms , 2008, FASE.

[11]  Sven Apel,et al.  An analysis of the variability in forty preprocessor-based software product lines , 2010, 2010 ACM/IEEE 32nd International Conference on Software Engineering.

[12]  Foutse Khomh,et al.  An Empirical Study of the Impact of Two Antipatterns, Blob and Spaghetti Code, on Program Comprehension , 2011, 2011 15th European Conference on Software Maintenance and Reengineering.

[13]  Chanchal K. Roy,et al.  A Survey on Software Clone Detection Research , 2007 .

[14]  Leon Moonen,et al.  Java quality assurance by detecting code smells , 2002, Ninth Working Conference on Reverse Engineering, 2002. Proceedings..

[15]  Marko Rosenmüller,et al.  Avoiding Variability of Method Signatures in Software Product Lines: A Case Study , 2007 .

[16]  Roberto Erick Lopez-Herrejon,et al.  A Standard Problem for Evaluating Product-Line Methodologies , 2001, GCSE.

[17]  D. C. Sharp,et al.  Reducing avionics software cost through component based product line development , 1998, 17th DASC. AIAA/IEEE/SAE. Digital Avionics Systems Conference. Proceedings (Cat. No.98CH36267).

[18]  Sven Apel,et al.  Language-Independent and Automated Software Composition: The FeatureHouse Experience , 2013, IEEE Transactions on Software Engineering.

[19]  Robert C. Martin,et al.  Agile Principles, Patterns, and Practices in C# (Robert C. Martin) , 2006 .

[20]  Sandro Schulze,et al.  Refactoring delta-oriented software product lines , 2013, Software Engineering & Management.

[21]  Yuanfang Cai,et al.  Prioritizing software anomalies with software metrics and architecture blueprints , 2013, 2013 5th International Workshop on Modeling in Software Engineering (MiSE).

[22]  Foutse Khomh,et al.  An Exploratory Study of the Impact of Code Smells on Software Change-proneness , 2009, 2009 16th Working Conference on Reverse Engineering.

[23]  Sven Apel,et al.  Does the discipline of preprocessor annotations matter?: a controlled experiment , 2014, GPCE '13.

[24]  Krzysztof Czarnecki,et al.  Generative Programming , 2001, ECOOP Workshops.

[25]  Ivica Crnkovic,et al.  Architectural bad smells in software product lines: an exploratory study , 2014, WICSA '14 Companion.

[26]  Naouel Moha,et al.  Detection and correction of design defects in object-oriented designs , 2007, OOPSLA '07.

[27]  Juha Savolainen,et al.  Identifying improvement potential in evolving product line infrastructures: 3 case studies , 2012, SPLC '12.

[28]  Elmar Jürgens,et al.  Analyzing the Effect of Preprocessor Annotations on Code Clones , 2011, 2011 IEEE 11th International Working Conference on Source Code Analysis and Manipulation.

[29]  Gunter Saake,et al.  Feature-Oriented Software Product Lines , 2013, Springer Berlin Heidelberg.

[30]  Stéphane Ducasse,et al.  Object-Oriented Metrics in Practice , 2005 .

[31]  Christian Prehofer,et al.  Feature-Oriented Programming: A Fresh Look at Objects , 1997, ECOOP.

[32]  Martin L. Griss Implementing Product-line features by composing aspects , 2000, SPLC.

[33]  Sven Apel,et al.  Code clones in feature-oriented software product lines , 2010, GPCE '10.

[34]  Nenad Medvidovic,et al.  Are automatically-detected code anomalies relevant to architectural modularity?: an exploratory analysis of evolving systems , 2012, AOSD.

[35]  Elmar Jürgens,et al.  Do code clones matter? , 2009, 2009 IEEE 31st International Conference on Software Engineering.

[36]  Sven Apel,et al.  Measuring programming experience , 2012, 2012 20th IEEE International Conference on Program Comprehension (ICPC).

[37]  João M. Fernandes,et al.  Towards a Catalogue of Refactorings and Code Smells for AspectJ , 2006, LNCS Trans. Aspect Oriented Softw. Dev..

[38]  Henry Spencer,et al.  #ifdef Considered Harmful, or Portability Experience with C News , 1992, USENIX Summer.

[39]  Joshua Kerievsky,et al.  Refactoring to Patterns , 2004, XP/Agile Universe.

[40]  Sven Apel,et al.  Virtual Separation of Concerns - A Second Chance for Preprocessors , 2009, J. Object Technol..

[41]  Kyo Chul Kang,et al.  Feature-Oriented Domain Analysis (FODA) Feasibility Study , 1990 .

[42]  Alessandro F. Garcia,et al.  An exploratory study of code smells in evolving aspect-oriented systems , 2011, AOSD '11.

[43]  Sven Apel,et al.  Granularity in software product lines , 2008, 2008 ACM/IEEE 30th International Conference on Software Engineering.

[44]  Michael W. Godfrey,et al.  “Cloning considered harmful” considered harmful: patterns of cloning in software , 2008, Empirical Software Engineering.

[45]  Yuanyuan Zhou,et al.  CP-Miner: finding copy-paste and related bugs in large-scale software code , 2006, IEEE Transactions on Software Engineering.