@article{10580, author = {Marek Vok{\'a}c}, title = {Defect Frequency and Design Patterns: an Empirical Study of Industrial Code}, abstract = {Software {\textquoteleft}{\textquoteleft}Design Patterns{\textquoteright} 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,\% to 154,\% of the average rate. We developed a new set of tools able to extract design pattern information at a rate 3 imes10^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 tend to be used in complex parts, and so can serve as indicators of code that requires special attention. Conversely, code designed with the Factory pattern is less complex or less central, and consequently has lower defect rates. Template Method was used in both simple and complex situations, leading to no clear tendency.}, year = {2004}, journal = {IEEE Transactions on Software Engineering}, volume = {30}, number = {12}, pages = {904-917}, month = {Dec}, }