skip to main content
10.1145/1858996.1859015acmconferencesArticle/Chapter ViewAbstractPublication PagesaseConference Proceedingsconference-collections
research-article

Deviance from perfection is a better criterion than closeness to evil when identifying risky code

Published: 20 September 2010 Publication History

Abstract

We propose an approach for the automatic detection of potential design defects in code. The detection is based on the notion that the more code deviates from good practices, the more likely it is bad. Taking inspiration from artificial immune systems, we generated a set of detectors that characterize different ways that a code can diverge from good practices. We then used these detectors to measure how far code in assessed systems deviates from normality.
We evaluated our approach by finding potential defects in two open-source systems (Xerces-J and Gantt). We used the library JHotDraw as the code base representing good design/programming practices. In both systems, we found that 90% of the riskiest classes were defects, a precision far superiour to state of the art rule-based approaches.

References

[1]
}}M. Fowler, Refactoring - Improving the Design of Existing Code, 1st ed. Addison-Wesley, June 1999.
[2]
}}N. Fenton and S. L. Pfleeger, Software Metrics: A Rigorous and Practical Approach, 2nd ed. London, UK: International Thomson Computer Press, 1997.
[3]
}}F. Khomh, S. Vaucher, Y.-G. Guéhéneuc, and H. Sahraoui, "A Bayesian Approach for the Detection of Code and Design Smells," in Proceedings of the 9th International Conference on Quality Software, D.-H. Bae and B. Choi, Eds. IEEE Computer Society Press, August 2009.
[4]
}}N. Moha, Y.-G. Guéhéneuc, L. Duchien, and A.-F. L. Meur, "DECOR: A method for the specification and detection of code and design smells," Transactions on Software Engineering (TSE), 2009, 16 pages. {Online}. Available: http://www-etud.iro.umontreal.ca/~ptidej/Publications/Documents/TSE09.doc.pdf
[5]
}}H. Liu, L. Yang, Z. Niu, Z. Ma, and W. Shao, "Facilitating software refactoring with appropriate resolution order of bad smells," in ESEC/FSE '09: Proceedings of the the 7th joint meeting of the European software engineering conference and the ACM SIGSOFT symposium on The foundations of software engineering. New York, NY, USA: ACM, 2009, pp. 265--268.
[6]
}}R. Marinescu, "Detection strategies: Metrics-based rules for detecting design flaws," in Proceedings of the International Conference on Software Maintenance, 2004, pp. 350--359.
[7]
}}F. Azuaje, "Review of artificial immune systems: a new computational intelligence approach" by l.n. de castro and j. timmis (eds) springer, london, 2002," Neural Netw., vol. 16, no. 8, pp. 1229--1229, 2003.
[8]
}}A. J. Riel, Object-Oriented Design Heuristics. Addison-Wesley, 1996.
[9]
}}W. J. Brown, R. C. Malveau, W. H. Brown, H. W. McCormick III, and T. J. Mowbray, Anti Patterns: Refactoring Software, Architectures, and Projects in Crisis, 1st ed. John Wiley and Sons, March 1998. {Online}. Available: www.amazon.com/exec/obidos/tg/detail/-/0471197130/ref=ase_theantipatterngr/103-4749445-6141457
[10]
}}M. Mäntylä, J. Vanhanen, and C. Lassenius, "A taxonomy and an initial empirical study of bad smells in code," in ICSM '03: Proceedings of the International Conference on Software Maintenance. Washington, DC, USA: IEEE Computer Society, 2003, p. 381.
[11]
}}W. C. Wake, Refactoring Workbook. Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc., 2003.
[12]
}}K. J., Immunology, 5th ed. by Richard A. Goldsby, Thomas J. Kindt, Barbara A. Osborne, W.H, 2002.
[13]
}}D. Dasgupta, Z. Ji, and F. Gonzalez, "Artificial immune system (ais) research in the last five years." in IEEE Congress on Evolutionary Computation (1). IEEE, 2003, pp. 123--130. {Online}. Available: http://dblp.uni-trier.de/db/conf/cec/cec2003-1.html#DasguptaJG03
[14]
}}L. Nanni and A. Lumini, "Generalized needleman-wunsch algorithm for the recognition of t-cell epitopes," Expert Syst. Appl., vol. 35, no. 3, pp. 1463--1467, 2008.
[15]
}}M. Brudno, "Algorithms for comparison of dna sequences," Ph.D. dissertation, Stanford, CA, USA, 2004, adviser-Batzoglou, Serafim.
[16]
}}F. A. González and D. Dasgupta, "Anomaly detection using real-valued negative selection," Genetic Programming and Evolvable Machines, vol. 4, no. 4, pp. 383--403, 2003.
[17]
}}D. E. Goldberg, Genetic Algorithms in Search, Optimization and Machine Learning. Boston, MA, USA: Addison-Wesley Longman Publishing Co., Inc., 1989.
[18]
}}H. Hou and G. Dozier, "An evaluation of negative selection algorithm with constraint-based detectors," in ACM-SE 44: Proceedings of the 44th annual Southeast regional conference. New York, NY, USA: ACM, 2006, pp. 134--139.
[19]
}}I. G. Czibula and G. Czibula, "Clustering based automatic refactorings identification," in SYNASC '08: Proceedings of the 2008 10th International Symposium on Symbolic and Numeric Algorithms for Scientific Computing. Washington, DC, USA: IEEE Computer Society, 2008, pp. 253--256.
[20]
}}K. Erni and C. Lewerentz, "Applying design metrics to object-oriented frameworks," in Proc. IEEE Symp. Software Metrics. IEEE Computer Society Press, 1996.
[21]
}}H. Alikacem and H. Sahraoui, "Détection d'anomalies utilisant un langage de description de règle de qualité." in actes du 12e colloque LMO, LMO, Ed., 2006.
[22]
}}M. O'Keeffe and M. Cinnéide, "Search-based refactoring: an empirical study." Journal of Software Maintenance, vol. 20, no. 5, pp. 345--364, 2008. {Online}. Available: http://dblp.uni-trier.de/db/journals/smr/smr20.html#OKeeffeC08
[23]
}}M. Harman and J. A. Clark, "Metrics are fitness functions too." in IEEE METRICS. IEEE Computer Society, 2004, pp. 58--69. {Online}. Available: http://dblp.uni-trier.de/db/conf/metrics/metrics2004.html#HarmanC04
[24]
}}S. C. Kothari, L. Bishop, J. Sauceda, and G. Daugherty, "A pattern-based framework for software anomaly detection," Software Quality Journal, vol. 12, no. 2, pp. 99--120, June 2004. {Online}. Available: http://springerlink.com/content/v115717r15420214/?p=bf86b148d5d74754baec247cd0661c7c{\&}pi=53
[25]
}}K. Dhambri, H. A. Sahraoui, and P. Poulin, "Visual detection of design anomalies." in CSMR. IEEE, 2008, pp. 279--283. {Online}. Available: http://dblp.uni-trier.de/db/conf/csmr/csmr2008.html#DhambriSP08
[26]
}}C. Catal and B. Diri, "Software defect prediction using artificial immune recognition system," in SE'07: Proceedings of the 25th conference on IASTED International Multi-Conference. Anaheim, CA, USA: ACTA Press, 2007, pp. 285--290.
[27]
}}S. Rawat and A. Saxena, "Danger theory based syn flood attack detection in autonomic network," in SIN '09: Proceedings of the 2nd international conference on Security of information and networks. New York, NY, USA: ACM, 2009, pp. 213--218.
[28]
}}W. Pang and G. M. Coghill, "Modified clonal selection algorithm for learning qualitative compartmental models of metabolic systems," in GECCO '07: Proceedings of the 2007 GECCO conference companion on Genetic and evolutionary computation. New York, NY, USA: ACM, 2007, pp. 2887--2894.

Cited By

View all
  • (2024)A systematic review of refactoring opportunities by software antipattern detectionAutomated Software Engineering10.1007/s10515-024-00443-y31:2Online publication date: 15-May-2024
  • (2022)What Refactoring Topics Do Developers Discuss? A Large Scale Empirical Study Using Stack OverflowIEEE Access10.1109/ACCESS.2021.314003610(56362-56374)Online publication date: 2022
  • (2021)Exploiting Results of Model-Based Analysis ToolsComposing Model-Based Analysis Tools10.1007/978-3-030-81915-6_7(129-158)Online publication date: 18-Jul-2021
  • Show More Cited By

Index Terms

  1. Deviance from perfection is a better criterion than closeness to evil when identifying risky code

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    ASE '10: Proceedings of the 25th IEEE/ACM International Conference on Automated Software Engineering
    September 2010
    534 pages
    ISBN:9781450301169
    DOI:10.1145/1858996
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Sponsors

    In-Cooperation

    • IEEE CS

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 20 September 2010

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. artificial immune systems
    2. design defects
    3. maintenance

    Qualifiers

    • Research-article

    Conference

    ASE10
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 82 of 337 submissions, 24%

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)6
    • Downloads (Last 6 weeks)0
    Reflects downloads up to 08 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)A systematic review of refactoring opportunities by software antipattern detectionAutomated Software Engineering10.1007/s10515-024-00443-y31:2Online publication date: 15-May-2024
    • (2022)What Refactoring Topics Do Developers Discuss? A Large Scale Empirical Study Using Stack OverflowIEEE Access10.1109/ACCESS.2021.314003610(56362-56374)Online publication date: 2022
    • (2021)Exploiting Results of Model-Based Analysis ToolsComposing Model-Based Analysis Tools10.1007/978-3-030-81915-6_7(129-158)Online publication date: 18-Jul-2021
    • (2020)Oracles of Bad SmellsProceedings of the XXXIV Brazilian Symposium on Software Engineering10.1145/3422392.3422415(62-71)Online publication date: 21-Oct-2020
    • (2020)Improving change prediction models with code smell-related informationEmpirical Software Engineering10.1007/s10664-019-09739-025:1(49-95)Online publication date: 1-Jan-2020
    • (2019)Toward a Smell-Aware Bug Prediction ModelIEEE Transactions on Software Engineering10.1109/TSE.2017.277012245:2(194-218)Online publication date: 1-Feb-2019
    • (2018)Towards a Reliable Identification of Deficient Code with a Combination of Software MetricsApplied Sciences10.3390/app81019028:10(1902)Online publication date: 12-Oct-2018
    • (2018)The Scent of a Smell: An Extensive Comparison Between Textual and Structural SmellsIEEE Transactions on Software Engineering10.1109/TSE.2017.275217144:10(977-1000)Online publication date: 1-Oct-2018
    • (2018)Continuous Improvement of Systems in Maintenance Using a Proactive Quality Management2018 11th International Conference on the Quality of Information and Communications Technology (QUATIC)10.1109/QUATIC.2018.00017(47-55)Online publication date: Sep-2018
    • (2018)On the diffuseness and the impact on maintainability of code smells: a large scale empirical investigationEmpirical Software Engineering10.1007/s10664-017-9535-z23:3(1188-1221)Online publication date: 1-Jun-2018
    • Show More Cited By

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media