A methodology to assess the impact of design patterns on software quality

https://doi.org/10.1016/j.infsof.2011.10.006Get rights and content

Abstract

Context

Software quality is considered to be one of the most important concerns of software production teams. Additionally, design patterns are documented solutions to common design problems that are expected to enhance software quality. Until now, the results on the effect of design patterns on software quality are controversial.

Aims

This study aims to propose a methodology for comparing design patterns to alternative designs with an analytical method. Additionally, the study illustrates the methodology by comparing three design patterns with two alternative solutions, with respect to several quality attributes.

Method

The paper introduces a theoretical/analytical methodology to compare sets of “canonical” solutions to design problems. The study is theoretical in the sense that the solutions are disconnected from real systems, even though they stem from concrete problems. The study is analytical in the sense that the solutions are compared based on their possible numbers of classes and on equations representing the values of the various structural quality attributes in function of these numbers of classes. The exploratory designs have been produced by studying the literature, by investigating open-source projects and by using design patterns. In addition to that, we have created a tool that helps practitioners in choosing the optimal design solution, according to their special needs.

Results

The results of our research suggest that the decision of applying a design pattern is usually a trade-off, because patterns are not universally good or bad. Patterns typically improve certain aspects of software quality, while they might weaken some other.

Conclusions

Concluding the proposed methodology is applicable for comparing patterns and alternative designs, and highlights existing threshold that when surpassed the design pattern is getting more or less beneficial than the alternative design. More specifically, the identification of such thresholds can become very useful for decision making during system design and refactoring.

Introduction

Object oriented design patterns have been introduced in mid 1990s as a catalog of common solutions to common design problems, and are considered as standard of “good” software designs [31]. The notion of patterns was firstly introduced by Alexander et al. [2] in the field of architecture. Later the notion of patterns has been transformed in order to fit software design by Gamma, Helm, Johnson and Vlissides (GoF) [31]. The authors cataloged 23 design patterns, classified according to two criteria. The first, i.e. purpose, represents the motivation of the pattern. Under this scope patterns are divided into creational, structural and behavioral patterns. The second criterion, i.e. scope, defines whether the pattern is applied on object or class level. In [31], the authors suggest that using specific software design solutions, i.e. design patterns, provide easier maintainability and reusability, more understandable implementation and more flexible design. At this point it is necessary to clarify GoF are not the first or the only design patterns in software literature. Some other well known patterns are architectural patterns, computational patterns, game design patterns, etc. In recent years, many researchers have attempted to evaluate the effect of GoF design patterns on software quality. Reviewing the literature on the effects of design pattern application on software quality provides controversial results. Until now, researchers attempted to investigate the outcome of design patterns with respect to software quality through empirical methods, i.e. case studies, surveys and experiments, but safe conclusions cannot be drawn since the results lead to different directions. As mentioned in [37], [39], [53], [59], [69], design patterns propose elaborate design solutions to common design problems that can be implemented with simpler solutions as well.

In this paper we propose a methodology for comparing pattern designs. The proposed method is analytical in the sense that system comparison is not performed on specific system instances, but on design motifs that can describe every possible instance of a system during its extension. The methodology is generic so that it can be applied for comparing design alternatives that describe equivalent functionality and have specified axes of change. The proposed method attempts to formulate several quality attributes as functions of functionality addition on multiple, equivalent solutions to a design problem. Then the functions are compared so as to identify cut-off points during system maintenance when one solution gets better or worse than the other. In this study we illustrate the applicability of the methodology by employing it for comparing GoF design patterns to equivalent adhoc solutions. In the next section, we present background information on design patterns. In Section 3, the methodology is presented and in Section 4, three exploratory cases are demonstrated. A discussion on the methodology is presented in Section 5. Conclusions, threats to validity and future work are presented by the end of the paper.

Section snippets

Related work

In this section of the paper, previous scientific research related to design patterns is presented. More specifically, the section is organized into paragraphs concerning indications on pattern identification according to metric scores, qualitative evaluation of pattern employment, quantitative evaluation of pattern employment, discussion on pattern application and class change proneness, results of controlled experiments on the comparison of design pattern application versus simpler solutions

Methodology

This paper is inspired by the work of Hsueh et al. [38] and Huston [39]. Our methodology can be used to compare design patterns and alternative design solutions of equivalent functionality, during system extension. The method of our paper can be summarized in the following steps:

Prerequisite: Suppose a design problem that can be treated with a pattern.

  • 1.

    Catalog alternative design solutions from literature, open-source solutions and personal experiences.

  • 2.

    Identify the major axes of change for the

Methodology illustration

As illustrative examples of using the proposed method, we investigate six research questions, evaluating design patterns w.r.t. various quality aspects. The research questions are listed below:

  • [RQ1]Which is the effect of employing an instance of the bridge pattern on the maintainability of a system?

  • [RQ2] Which is the effect of employing an instance of the abstract factory pattern on the maintainability of a system?

  • [RQ3] Which is the effect of employing an instance of the bridge pattern on the

Discussion

This section discusses our analytical methodology and the findings of our work concerning the research questions stated in Section 4. The results that are presented in this paper can be used in various ways. First of all, the mathematical formulas that have been extracted can be used for goal driven decision making. Our study suggests that if a designer is about to apply a pattern, he/she should firstly estimate the number of classes that his system will probably use, then should select the

Threats to validity

This section of the paper discusses possible threats to the validity of the paper. Firstly, even though the analytical method employed in the metric comparison ensures the accuracy of the procedure, the results on three design patterns cannot be generalized to the rest of the 23 design patterns that are described in [31], or any other type of design pattern. Another threat to the validity of the study is the fact that we have considered only two adhoc solutions. We have tried to adopt

Future work

Thus, future work includes a replication of the research with a wider variety of patterns and design alternatives. Additionally, we plan to replicate the methodology by using a quality model that uses code metrics and extends the systems with more ways as described in [56]. Moreover, future work plans also involve the conversion of the DesignPAD tool into an Eclipse plug-in that will automatically receive size information from an already implemented pattern or alternative solution and confirm

Conclusions

Concluding, this paper suggested a methodology for exploring designs where design patterns have been implemented, through the mathematical formulation of the relation between design pattern characteristics and well known metrics, and the identification of thresholds for which one design becomes more preferable than another. This approach can assist goal oriented decision making, since it is expected that every design problem demands a specific solution, according to its special needs with

References (80)

  • P.S.C. Alencar, D.D. Cowan, J. Dong, C.J.P. de Lucena, A pattern-based approach to structural design composition, 23rd...
  • C. Alexander et al.

    A Pattern Language – Town, Buildings, Construction

    (1977)
  • H. Albin-Amiot, P. Cointe, Y.-G. Gueheneuc, N. Jussien, Instantiating and detecting design patterns: putting bits and...
  • A. Ampatzoglou, A. Chatigeorgiou, “Evaluation of object-oriented design patterns in game development”, Information and...
  • G. Antoniol, R. Fiutem, L. Cristoforetti, Using metrics toidentify design patterns in object-oriented software, IEEE...
  • F. Arcelli, S. Spinelli, Impact of refactoring on quality code evaluation, Proceeding of the 4th workshop on...
  • E.L.A. Baniassad, G.C. Murphy, C. Schwanninger, Design pattern rationale graphs: linking design to source, Proceedings...
  • J. Bansiya et al.

    A hierarchical model for object-oriented design quality assessment

    IEEE Transaction on Software Engineering

    (2002)
  • I. Bayley et al.

    Formal specification of the variants and behavioural features of design patterns

    Journal of Systems and Software

    (2010)
  • I. Bayley, H. Zhu, Specifying behavioural features of design patterns in first order logic, Proceedings of the 32nd...
  • J.M. Bieman, G. Straw, H. Wang, P.W. Munger, R.T. Alexander, Design patterns and change proneness: an examination of...
  • J.M. Bieman, D. Jain, H.J. Yang, OO design patterns, design structure, and program changes: an industrial case study,...
  • A. Birukou, A survey of existing approaches for pattern search and selection, Proceedings of the 2010 European...
  • A. Blewitt, A. Bundy, I. Stark, Automatic verification of design patterns in Java, Proceedings of the 20th IEEE/ACM...
  • F. Brito e Abreu, The MOOD metrics set, Proceedings of the 9th European Conference on Object-Oriented Programming...
  • G.E. Boussaidi, H. Mili, A model driven framework for representing and applying design patterns, 31st Annual...
  • M. Cartwright et al.

    An empirical investigation of an object-oriented software system

    IEEE Transaction on Software Engineering

    (2000)
  • A. Chatzigeorgiou

    Object-Oriented Design: UML, Principles, Patterns and Heuristics

    (2005)
  • S.R. Chidamber et al.

    A metrics suite for object oriented design

    IEEE Transactions on Software Engineering

    (1994)
  • S.R. Chidamber et al.

    Managerial use of metrics for object oriented software: an exploratory analysis

    IEEE Transactions on Software Engineering

    (1998)
  • M. Dagpinar, J.H. Jahnke, Predicting maintainability with object-oriented metrics – an empirical comparison, IEEE...
  • D.P. Darcy et al.

    The structural complexity of software: an experimental test

    IEEE Transactions on Software Engineering

    (2005)
  • M. Di Penta, L. Cerulo, Y.G. Gueheneuc, G. Antoniol, An empirical study of relationships between design pattern roles...
  • J. Dong

    Adding pattern related information in structural and behavioural diagrams

    Information and Software Technology

    (2004)
  • J. Dong et al.

    Visualizing design patterns in their applications and compositions

    IEEE Transactions on Software Engineering

    (2007)
  • J. Deng, E. Kemp, E.G. Todd, Managing UI pattern collections, Proceedings of the 6th ACM SIGCHI New Zealand Chapter’s...
  • A.H. Eden, A. Yehudai, J. Gil, Precise specification on automatic application of design patterns, Proceedings of the...
  • E. Eide, A. Reid, J. Regehr, J. Lepreau, Static and dynamic structure in design patterns, Proceedings of the 24th...
  • M. Fowler, Patterns of Enterprise Application Architecture, Addison-Wesley Professional,...
  • R.B. France et al.

    A UML-based pattern specification technique

    IEEE Transactions on Software Engineering

    (2004)
  • E. Gamma et al.

    Design Patterns: Elements of Reusable Object-Oriented Software

    (1995)
  • Y. G. Gueheneuc, H. Saharaoui, F. Zaidi, Fingerprinting design patterns, IEEE Proceedings of the 11th Working...
  • Y.G. Gueheneuc et al.

    Improving design pattern identification: a new approach and an exploratory study

    Software Quality Journal

    (2010)
  • P. Gomes, F.C. Pereira, P. Paiva, N. Seco, P. Carreiro, J.L. Ferreira, C. Bento, Using CBR for automation of software...
  • G. Shu-Hang, L. Yu-Qing, J. Mao-Zhong, G. Jing, L. Hong-Juan, A requirement analysis pattern selection method for...
  • B. Henderson-Sellers et al.

    Coupling, cohesion: towards a valid metrics suite for object-oriented analysis and design

    Object-Oriented Systems

    (2002)
  • N.L. Hsueh et al.

    Object-oriented design: a goal driven and pattern based approach

    Software and Systems Modeling

    (2009)
  • N.L. Hsueh et al.

    A quantitative approach for evaluating the quality of design patterns

    Journal of Systems and Software

    (2008)
  • B. Huston

    The effects of design pattern application on metric scores

    Journal of Systems and Software

    (2001)
  • Y. Kataoka, T. Imai, H. Andou, T. Fukaya, A quantitative evaluation of maintainability enhancement by refactoring,...
  • Cited by (48)

    • High assurance software architecture and design

      2022, System Assurances: Modeling and Management
    • What can violations of good practices tell about the relationship between GoF patterns and run-time quality attributes?

      2019, Information and Software Technology
      Citation Excerpt :

      Finally, this study assumes that PP classes in the dataset contribute to pattern instances that are correctly implemented. A pattern implementation might not be the correct one, due to either a programming mistake or pattern grime [55], or because the deployed pattern is not the optimal way to solve the underlying problem considering that the effect of a pattern on quality is affected by different factors [56]. This poses a threat to construct validity.

    • Efficiently detecting structural design pattern instances based on ordered sequences

      2018, Journal of Systems and Software
      Citation Excerpt :

      Design patterns, proposed by GoF (Gang of Four: Gamma, Helms, Johnson and Vlisides), are meant to solve recurring design problems in object-oriented software systems, so as to improve the reusability, maintainability, comprehensibility, evolvability, and robustness of applications (Gamma et al., 1995). Although design patterns are not universally good or bad, they typically improve certain aspects of software quality if chosen wisely (Zhang and Budgen, 2012; Ampatzoglou et al., 2012). According to the definitions of GoF, design patterns can be classified as creational, which address object instantiation issues, structural, which concentrate on object composition and relations among the run-time object structures, and behavioural, which focus on the internal dynamics and object interaction in the system (DeLucia et al., 2010b).

    • Understanding the impact of cloud patterns on performance and energy consumption

      2018, Journal of Systems and Software
      Citation Excerpt :

      Cloud patterns, which are general and reusable solutions to recurring design problems, have been proposed as best practices to guide developers during the development of cloud-based applications. Although previous works such as Hecht et al. (2014) and Ampatzoglou et al. (2012) have shown that patterns can improve the QoS of cloud based applications, their impact on energy consumption is still unknown. Several works in the literature have assessed the impact of design patterns on software quality (Khomh and Guéhéneuc, 2008), software maintenance (Vokáč et al., 2004) and code complexity (Prechelt et al., 2001).

    • Comparing Word-Based and AST-Based Models for Design Pattern Recognition

      2023, ACM International Conference Proceeding Series
    View all citing articles on Scopus
    View full text