This Article 
 Bibliographic References 
 Add to: 
Defect Frequency and Design Patterns: An Empirical Study of Industrial Code
December 2004 (vol. 30 no. 12)
pp. 904-917
Software "design patterns” seek to package proven solutions to design problems in a form that makes it possible to find, adapt, and reuse them. A common claim is that a design based on properly applied patterns will have fewer defects than more ad hoc solutions. This case study analyzes the weekly evolution and maintenance of a large commercial product (C++, 500,000 LOC) over three years, comparing defect rates for classes that participated in selected design patterns to the code at large. We found that there are significant differences in defect rates among the patterns, ranging from 63 percent to 154 percent of the average rate. We developed a new set of tools able to extract design pattern information at a rate of 3\times 10^6 lines of code per hour, with relatively high precision. Based on a qualitative analysis of the code and the nature of the patterns, we conclude that the Observer and Singleton patterns are correlated with larger code structures and, so, can serve as indicators of code that requires special attention. Conversely, code designed with the Factory pattern is more compact and possibly less closely coupled and, consequently, has lower defect numbers. The Template Method pattern was used in both simple and complex situations, leading to no clear tendency.

[1] E. Gamma, R. Helm, R. Johnson, and J. Vlissides, Design Patterns: Elements of Reusable Object-Oriented Software. Addison-Wesley, 1995.
[2] 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 Int'l Conf. and Exhibition Technology of Object-Oriented Languages and Systems, pp. 296-305, 2001.
[3] L. Rising, The Patterns Handbook. Cambridge Univ. Press, 1998.
[4] F. Buschmann, R. Meunier, H. Rohnert, P. Sommerlad, and M. Stal, Pattern-Oriented Software Architecture. Wiley, 1996.
[5] C. Larman, Applying UML and Patterns: An Introduction to Object-Oriented Analysis and Design and the Unified Process, second ed. Prentice Hall, 2001.
[6] J. Bieman, G. Straw, H. Wang, P. Munger, and R. Alexander, “Design Patterns and Change Proneness: An Examination of Five Evolving Systems,” Proc. Ninth Int'l Software Metrics Symp., pp. 40-49, 2003.
[7] L. Prechelt and B. Unger, “Methodik und Ergebnisse einer Experimentreihe über Entwurfsmuster,” Informatik— Forschung und Entwicklung, vol. 14, no. 2, pp. 74-82, 1999.
[8] L. Prechelt, B. Unger, W.F. Tichy, P. Brössler, and L.G. Votta, “A Controlled Experiment in Maintenance Comparing Design Patterns to Simpler Solutions,” IEEE Trans. Software Eng., vol. 27, no. 12, pp. 1134-1144, Dec. 2001.
[9] M. Vokáč, W. Tichy, D.I. K. Sjøberg, E. Arisholm, and M. Aldrin, “A Controlled Experiment Comparing the Maintainability of Programs Designed with and without Design Patterns: A Replication in a Real Programming Environment,” Empirical Software Eng., vol. 9, no. 3, pp. 149-195, 2004.
[10] J. Bieman, D. Jain, and H. Yang, “OO Design Patterns, Design Structure, and Program Changes: An Industrial Case Study,” Proc. IEEE Int'l Conf. Software Maintenance, pp. 580-589, 2001.
[11] D. Schmidt and P. Stephenson, “Experience Using Design Patterns to Evolve Communication Software across Diverse OS Platforms,” Proc. European Conf. Object-Oriented Programming, vol. 952, pp. 399-423, 1995.
[12] G. Neumann and U. Zdun, “Pattern-Based Design and Implementation of an XML and RDF Parser and Interpreter: A Case Study,” Proc. 16th European Conf. Object-Oriented Programming, pp. 392-414, 2002.
[13] W.C. Chu, C.W. Lu, C.P. Shiu, and X.D. He, “Pattern-Based Software Reeng.: A Case Study,” J. Software Maintenance— Research and Practice, vol. 12, no. 2, pp. 121-141, 2000.
[14] B. Huston, “The Effects of Design Pattern Application on Metric Scores},” J. Systems and Software, vol. 58, no. 3, pp. 261-269, 2001.
[15] TechExcel, “DevTrack Defect Tracking Tool,” 2004, http://www. dtoverview.html.
[16] Perforce, Inc., “Perforce Software Configuration Management System,” 2004, http:/
[17] C. Kramer and L. Prechelt, “Design Recovery by Automated Search for Structural Design Patterns in Object-Oriented Software,” Proc. Third Working Conf. Reverse Eng., pp. 208-215, 1996.
[18] G. Florijn, M. Meijers, and P. van Winsen, “Tool Support for Object-Oriented Patterns,” Proc. Object-Oriented Programming, vol. 1241, pp. 472-495, 1997.
[19] J. Bansiya, “Automating Design-Pattern Identification,” Dr. Dobb's J., vol. 23, no. 6, pp. 20-28, June 1998.
[20] G. Antoniol, R. Fiutem, and L. Cristoforetti, “Using Metrics to Identify Design Patterns in Object-Oriented Software,” Proc. Metrics 1998: Fifth Int'l Software Metrics Symp., pp. 23-34, 1998.
[21] G. Antoniol, G. Casazza, M. DiPenta, and R. Fiutem, “Object-Oriented Design Patterns Recovery,” J. Systems and Software, vol. 59, no. 2, pp. 181-196, 2001.
[22] R. Keller, R. Schauer, S. Robitaille, and P. Pagé, “Pattern-Based Reverse-Engineering of Design Components,” Proc. 1999 Int'l Conf. Software Eng., pp. 226-235, 1999.
[23] R. Schauer and R. Keller, “Pattern Visualization for Software Comprehension,” Proc. Sixth Int'l Workshop Program Comprehension, pp. 4-12, 1998.
[24] H. Albin-Amiot, P. Cointe, Y.G. Guéhéneuc, and N. Jussien, “Instantiating and Detecting Design Patterns: Putting Bits and Pieces Together,” Proc. 16th Ann. Int'l Conf. Automated Software Eng., pp. 26-29, 2001.
[25] Z. Balanyi and R. Ferenc, “Mining Design Patterns from C++ Source Code,” Proc. Int'l Conf. Software Maintenance, pp. 305-315, 2003.
[26] M. Vokáč, “A Tool for Recovering Design Patterns from C++ Code, and Its Application in a Case Study,” J. Object Technology, to appear.
[27] Scientific Toolworks Inc., “Understand for C++,” 2003, http:/
[28] G.J. Badros and D. Notkin, “A Framework for Preprocessor-Aware C Source Code Analyses,” Software-Practice and Experience, vol. 30, no. 8, pp. 907-924, 2000.
[29] MiniTAB, Inc., “MiniTab 13.32,” 2003, http:/
[30] D.G. Kleinbaum, Logistic Regression: A Self-Learning Text. 1994.
[31] A. DeMaris, “A Framework for the Interpretation of First-Order Interaction in Logit Modeling,” Psychological Bulletin, vol. 110, no. 3, pp. 557-570, 1991.
[32] D.W. Hosmer and S. Lemeshow, Applied Logistic Regression, second ed. John Wiley and Sons, 2000.
[33] J. Jaccard, Interaction Effects in Logistic Regression. Sage Publications, 2001.

Index Terms:
Design patterns, defects, defect frequency, industrial code, case study, maintenance.
Marek Vok?, "Defect Frequency and Design Patterns: An Empirical Study of Industrial Code," IEEE Transactions on Software Engineering, vol. 30, no. 12, pp. 904-917, Dec. 2004, doi:10.1109/TSE.2004.99
Usage of this product signifies your acceptance of the Terms of Use.