Professional Documents
Culture Documents
Design Patterns
48
the design patterns in the previous studies, we decide to systematically. Sometimes software reuse is regarded as a
analyse the demographic quantitative data in depth and in- panacea. Indeed, in some studies about real development,
vestigate links between the respondents’ background and the the results indicate that design patterns do not always lead
usage of design patterns. The response data are based on to positive products [16, 15]. For some specific patterns, for
the online survey. Therefore, our research question for this example, the Singleton pattern, even one of the authors of
study was the GoF has doubts about the benefit of it 1 . These conflict-
ing conditions reveal that there is no thorough investigation
“What lessons can we learn from the links be- on design patterns. Most people have no comprehensive cog-
tween the respondents’ demographic data and the nition for all design patterns. Therefore, a systematic inves-
design patterns? ” tigation, survey for all design patterns are required. More
In the following section we provide a little more background details about the systematic review and survey are discussed
about the previous studies. Then Section 3 describes the as follows.
analysis method for the quantitative data of the online sur- 2.2 The Mapping Study
vey. In the rest of this paper we present our results and
discuss how far they answer the research questions . The mapping study is an evidence-based approach widely
used in software engineering research [11]. The concept of
evidence-based research was originally developed in the area
2. BACKGROUND of clinical medicine. With its success in clinical medicine,
In this paper our study is based on software design pat- evidence-based research was adopted for use in other do-
terns and some forms of the previous studies. The objectives mains, including software engineering. Evidence-based soft-
of this section are to introduce the software design patterns. ware engineering aims “to provide the means by which cur-
And it also describes the previous studies in this section. rent best evidence from research can be integrated with prac-
tical experience and human values in the decision making
2.1 Software Design Patterns process regarding the development and maintenance of soft-
ware” [4].
“Patterns are a means of documentation.” [14] Based on the mapping study method applied in the pre-
vious study, we conducted a very thorough systematic map-
Design patterns are not specific methods as libraries and ping study which searched the design patterns literature
frameworks. They provide something much more like guid- from 1995 to 2009. 611 candidate papers were identified
ance for software design and maintenance. However libraries after the mapping study. And then via the selection pro-
and frameworks focus on the specific application on pro- cess the mapping study found 10 papers which included 11
gramming, and they do not consider such design properties experimental studies and 7 experience studies [17]. In the
as understandability, flexibility and maintainability. Design 11 experimental studies and 7 experience papers 17 specific
patterns do not focus on coding. They aim to provide access design patterns were examined. The results of the mapping
to successful solutions when software developers meet recur- study displayed an overview of the field of design patterns,
ring problems. The structure of design patterns focuses on making clear where evidence is lacking and what needs to
the relation of classes and objects rather than the specific be investigated. And also the outcomes helped to form a
code. clear framework about design patterns, they provided the
Figure 1 describes how users employ design patterns. First basis for both the organisation the online survey as well as
of all design patterns are the documentation for successful an input to the final results of this study.
software design in the minds of developers and maintainers.
They are not specific code for programming reuse. When 2.3 The Online Survey
developers meet a design problem, they think about how Because of the small number of papers containing empiri-
to choose suitable patterns under that situation. Then the cal evidence about design patterns, and about the usefulness
thinking of the patterns and their structures can be used in of particular patterns, it was felt that it would be valuable
the specific programming process. The application of design to perform a primary study to try to find out more about
patterns also make the implementation more maintainable. which patterns from the 23 in the GoF text were more widely
Design patterns provide the common vocabulary to improve used (and which ones were little used). Therefore, it was felt
the communication between designers and maintainers. that performing an online survey could provide a compre-
hensive overview of the ranking of all 23 GoF design pat-
terns, and improve and complement the analysis from the
mapping study.
Creational
Structural Developer The purpose of the online survey was therefore to investi-
Design Patterns Design
(Documentation) (Common Vocabulary)
Programming gate how deeply design patterns influenced software develop-
ers’ experiences, which design patterns were most frequently
applied, the ones they were most reluctant to use, and the
Behavioral
Maintainer reasons for their views. Therefore the title of the survey was
defined as “The survey of experience about design patterns”.
The survey form consists of five parts and 47 questions. Each
Figure 1: The Working Process of Design Patterns part has its own questions [18].
to Users Part I is the Introduction part. Part II asks participants
to provide their profiles and offer their general assessments
The most basic problem for design patterns is that design
1
patterns have not been investigated, evaluated and validated http://www.informit.com/articles/article.aspx?p=1404056
49
for the 23 design patterns. Part III asks participants to
provide the experiences of the patterns (up to three) which Table 1: The Definition of the Data Used in the
are considered as useful. Part IV asks participants to pro- Demographic Questions of the Online Survey
vide the experiences of the patterns (up to three) which are Question Continuity Category Method
considered as not useful. Part VI asks participants some Q2 Discrete Nominal Quantitative
miscellaneous questions and thanks to their contributions. Q3 Discrete Ordinal Quantitative
The details about Part II is shown in Appendix A. Q4 Continuous Interval Quantitative
After finishing the survey form design, we performed a Q5 Continuous Interval Quantitative
pilot testing. The form was reviewed by a small team of two Q6 Discrete Nominal Quantitative
assessors. Then the forms were sent out with the requests Q7 Discrete Ordinal Quantitative
after being modified based on the assessors’ comments.
Finally we sent 877 requests and reminders to the authors
of the collected papers in the mapping study. After removing the descriptive statistics only provided the basic profiles for
196 invalid email addresses, there were 681 valid addresses the data, and we could not analyse them deeply and sys-
in our database. We received 136 responses from the au- tematically. Therefore inferential statistics were employed
thors, 53 responses from the people known to authors, and to address this need. This section aims to introduce the sta-
38 responses from the LinkedIn groups. After excluding the tistical forms and analysis methods employed in analysing
invalid responses we collected 128 responses from the au- our survey. These provide the basic and solid concepts for
thors, 41 responses from the people known to authors, and our practical analysis.
37 responses from the LinkedIn groups finally. Therefore the 3.1 Hypothesis Testing
response rate of the survey originally targeted (authors) is
128/681 or 19%. Because we do not know how many peo- Hypothesis testing is a statistical method used to evaluate
ple the authors passed the survey requests to, so we simply a hypothesis and make decisions by using sample data, it
added the 53 responses to the sampling frame and calculated is a commonly used method in inferential statistics [8, 9].
the response rate for the wider set as (128+41)/(681+53) or Following to the methods for hypothesis testing [3, 9, 10],
23%. Because we cannot determine the valid population the process applied in our survey data was defined as below:
of the LinkedIn groups, the responses from the LinkedIn • Firstly, we defined an appropriate scientific hypoth-
groups were not counted in any calculation of the response esis about the causes we aimed to investigate. The
rate. Whichever value is used as the final response rate, it scientific hypothesis was then used to derive the sta-
is well above the usual expected response rate for a survey tistical hypothesis, including the null hypothesis (H0 )
(10%). and alternative hypothesis (HA ). Normally the null
In the following sections we focus on the profile of the hypothesis represents the case that there is no differ-
respondents in Part II of the online survey and their dis- ence or relation between the samples. If the statistical
tributions. Therefore we analyse the composition of the re- result shows that there is no significant difference, it
spondents by making use of the demographic questions in means that the null hypothesis is accepted. Otherwise,
the online survey, and explore the links between the demo- the null hypothesis is rejected and the alternative hy-
graphic data and design pattern usage by applying statistical pothesis is accepted if the statistical result shows there
method. exists a significant difference.
2.4 The Follow-on Survey • Secondly, we analysed whether the samples satisfied
The previous online survey showed that software devel- the statistical assumptions or not, and distinguished
opers who are experienced with using design patterns hold between the types of data. The condition used for de-
some conflicting opinions about three of the more popular termining satisfaction can be employed to decide what
design patterns: Facade, Singleton and Visitor. Therefore, kind of testing is more suitable, parametric testing or
we conducted a follow-on survey to investigate “What char- non-parametric testing [10].
acteristics of these three patterns cause developers to hold Besides that, normally the form of the data can be clas-
widely differing views about their use?” sified as either discrete data, including nominal and or-
After finishing the follow-on survey, We received 46 usable dinal data, or continuous data, including interval and
responses from a possible total of 188, with nearly 85% of ratio data [2]. For better analysis of the survey we
respondents having six or more years of experience with de- classified the types of the data employed in the survey
sign patterns. Of these, 27 also provided comments and according to this classification. The clear definition of
descriptions of experiences about the patterns, which we the data makes it possible to analyse the survey by
categorised. This follow-on survey performed a qualitative using SPSS appropriately and determine which statis-
analysis for the three patterns, Facade, Singleton and Vis- tical test should be employed. For those nominal data
itor. The outcomes displayed that all three patterns could elements that have qualitative values we coded them
easily be misused and in each case, the consequences of mis- to give them a quantitative property. Table 1 displays
use were regarded as being particularly significant. the definition of the data elements from our survey.
• Thirdly, we chose a suitable statistical test for data
3. THE ANALYSIS METHOD analysis. The factor variable and the independent vari-
Normally descriptive statistics can be used to describe and able were also defined. The data relying on others are
analyse the data based on the tables and charts as above [12] defined as the independent variable [2]. Conversely,
using frequencies, ratio, etc to describe the data patterns the data which are relied by other data are defined as
[13]. But for our samples in the online survey we found that the factor variable.
50
• Fourthly, we accepted or rejected the null hypothesis analysed the composition of the respondents by making use
based on the analysis results. If the statistical results of the demographic questions in the online survey question-
were not very significant we accepted the null hypothe- naire (Q2-Q7).
sis (H0 ). Otherwise, if the statistical results considered Analysis of the responses to Question 2 generated Table
to be statistically significant we rejected the null hy- 2, which displays the profile of the respondents based on
pothesis and accepted the alternative hypothesis (HA ). their primary roles. Table 2 shows that the majority of the
respondents were software developers and researchers. The
3.2 Parametric Test numbers for the software teachers and computing students
Parametric test is a statistics method which assumes the were smaller.
data is probability distributed and infer the distribution of
the parameters [7]. In our survey analysis, we employed
the parametric test to infer the distribution of the respon-
dents’ profile. From the definition of parametric test, it has Table 2: Profile of respondents: Primary Roles
to meet the assumptions. If it fails to meet the assump- Category Authors Snowball LinkedIn Total
tions, Non-Parametric test can be used for an alternative, Groups
and also can apply “Post Hoc” analysis method for multiple (#) (%)
compare between the variables. We applied the “Tamhane’s Developer 20 27 34 81 39.3
T2” analysing method of “Post Hoc” analysis in our para- Researcher 70 6 3 79 38.4
metric test. Parametric test contains a series of methods. Teacher 38 1 0 39 18.9
In our analysis we applied One-Way ANOVA and t-Test. Student 0 7 0 7 3.4
Total 128 41 37 206 100.0
• One-Way ANOVA
One-Way ANOVA is a parametric test to compare Using the same categories of respondents, Table 3 sum-
means of three or more populations [1]. The applica- maries the distribution of the respondents in terms of their
tion of One-Way ANOVA in our survey analysis dealt education. Most of the respondents have a degree higher
with comparing three groups of respondents’ profiles than Bachelors. The respondents who have a PhD degree
(Hypothesis 1). dominate the majority of all respondents, with 124 respon-
dents forming 60.2% of the entire in the database.
• t-Test
The difference with One-Way ANOVA is that t-Test Table 3: Profile of Respondents: Education
compares the means of two populations [1]. The appli- Highest Authors Snowball LinkedIn Total
cation of t-Test in our survey analysis dealt with com- Degree Groups
paring two groups of respondents’ profiles (Hypothesis (#) (%)
2). Associate 0 1 0 1 0.5
Bachelor’s 1 12 20 33 16.0
3.3 Non-Parametric Test Master’s 13 18 14 45 21.8
Non-Parametric test is a distribution-free technique, it can PhD 114 7 3 124 60.2
be used under the condition of that data do not meet the Other 0 3 0 3 1.5
assumptions of Parametric test [1]. In our analysis we ap- Total 128 41 37 206 100.0
plied the Kruskal Wallis method and the Chi-Square Test
method of Non-Parametric test.
In Questions 4 and 5 of the questionnaire form we re-
• Kruskal Wallis spectively obtained the experiences of the participants about
Object-Oriented development and design patterns applica-
Kruskal Wallis is used to test ordinal data. The appli- tion. We summarised the two profiles for these in Table 4
cation of Kruskal Wallis in our survey analysis dealt and Table 5. Table 4 provides a profile of the experience of
with comparing three groups of respondents’ profiles the different groups of respondents with object-oriented de-
(Hypothesis 1). velopment in general. More than half had over ten years of
experience with OO development (54.9%). Table 5 provides
4. RESULTS a similar profile for experience with OO patterns. Again 58
In this section we present the results obtained from analysing (42.2%) respondents who had 6-10 years experiences of us-
the relations between the different variables of each ques- ing OO patterns dominated the majority of all respondents.
tion which were summarised in Table 1. A mix of descrip- The second group was the group of 11-15 years respondents,
tive statistics and inferential statistics were employed in our 52 respondents (25.2%). From the percentage of each group
analysis. The analysing process was based on demographic of the respondents in these two tables, we can see that most
part of the online survey. In the demographic part we ap- of the respondents have at least 3 years experience of OO
plied the hypothesis method to test the relation between the development and applying patterns. This reflects the expec-
respondents’ profiles and their pattern assessment. tation that most of the respondents were experts in the areas
of OO development and OO design patterns. The probabil-
4.1 Descriptive Analysis ity of the responses being influenced by novices is therefore
Before it is possible to perform any inferential statistical very small. So in the analysis process of the next step we
data analysis, it is necessary to be familiar with the pro- concentrated on those respondents whose experiences of OO
file of the respondents and their distributions. Therefore we development and using patterns are over three years.
51
LinkedIn group will not be different in terms of their
Table 4: Profile of Respondents: Experience with experience of using design patterns.
OO Development
Length of Authors Snowball LinkedIn Total H0 : p > 0.05. The three groups will not have any
Experi- Groups significant differences.
ence
HA : p 6 0.05. The three groups will differ signifi-
(#) (%)
cantly.
<3 years 1 5 4 10 4.8
3-5 years 2 13 10 25 12.1 Statistical Tests Used: Kruskal Wallis Test, One-
6-10 years 35 10 13 58 28.2 way ANOVA.
11-15 years 34 4 5 43 20.9 Questions Used: Question 5.
>15 years 56 9 5 70 34.0
52
90.00% choices in Question 7 against the different design patterns
80.00% experience year range in Question 5. First of all, the num-
70.00%
bers for each assessment choice, such as very useful (VU);
useful (U); not very useful (NVU); not at all useful (NU);
60.00% Little or no experience of using this pattern (LE), were
50.00% Positive counted under the category of the different design patterns
40.00% Negative experience. Because the number of respondents in the differ-
LE ent experience groups were not the same, it is not possible
30.00%
to compare the count values directly. So we counted the
20.00% percentages of each assessment in each experience group.
10.00% Then the assessments of very useful (VU) and useful (U)
were aggregated into the positive assessment, and not very
0.00%
<3 3-5 6-10 11-15 useful (NVU); not at all useful (NU) were aggregated into
the negative assessment.
We compared the assessment percentages in both of the
Figure 2: The Comparison of Using Patterns Expe- author group and the merged group. Figures 2 and 3 com-
riences in the Author Group pared the assessment percentages in each year range for us-
ing patterns experience. From these two figures it is very
90.00%
obvious that the positive assessment percentage of using pat-
80.00% terns increases with greater experience with design patterns,
70.00% and the ‘less or no experience’ assessment percentage of us-
ing patterns decreases with design patterns’ experience. In
60.00%
the negative assessment there is no significant difference be-
50.00% Positive tween the different pattern experiences. To summarise, the
40.00% Negative degree of experience with using design patterns influences
30.00%
LE how people apply the design patterns. Greater experience
means that more patterns are considered useful. Note that
20.00%
we did not consider those respondents whose experience with
10.00% using design patterns was less than 3 years in the following
0.00% analysis.
<3 3-5 6-10 11-15
4.2.3 The Relation between the Primary Roles and
Figure 3: The Comparison of Using Patterns Expe-
the Pattern Usefulness
riences in the Merged Group We also looked at how the ‘votes’ were used by the respon-
dents according to their different roles (researchers, teachers
and developers). To do this, we compared the assessment
percentage in each role. The method is same as used for
• Hypothesis 2: The respondents from the Snowball the comparison of the different design patterns experiences
group and the LinkedIn group will have no difference in the previous section. Figures 4 and 5 show that there are
on the experience of using design patterns. no significant differences on the assessment of design pat-
H0 : p > 0.05. The two groups will not have significant terns between the different roles. Within the four primary
differences. roles just that of the student is slightly different from the
HA : p 6 0.05. The two groups will have significant other roles. The percentage of students in Figure 4 is 0%.
differences. That is there are not any student respondents in the Author
group. Figure 5 reflects the percentage of design patterns
Statistical Test Used: t Test. under ‘little or no experience’ is higher than the other roles,
Questions Used: Question 5. such as developer, researcher and teacher. With the results
We compared the difference on using design patterns be- of the previous section for the pattern experiences, it is clear
tween the two respondents’ groups, the Author group and that the students have less experience than the other roles.
the LinkedIn group. The result has no difference (p > 0.05). Therefore, from the two figures opinions about how to use
So the null hypothesis is accepted. The two respondents’ and assess the design patterns is not influenced by people’s
groups have not a significant different experience on using primary roles.
design patterns. Therefore, the profiles for each of these
groups have no a significant difference, and can be consid-
ered as being drawn from the same population. Therefore
5. THREATS TO VALIDITY
both of these two groups were merged into a single group. As with any empirical study, it is necessary to consider
We analyse the data from the author group and the merged the possible effects of any factors that could have biassed the
group separately in the following hypothesis. outcomes from the study. Here we can identify two threats
to validity for the online survey:
4.2.2 The Relation between Patterns Experience and
the Usefulness Profile • the effectiveness of the responses (internal)
In order to investigate the relations between the experi-
ences of using design patterns, we compared the profile of • the completeness of the responses (external)
53
90.00% 5.2 External Validity
80.00%
During the process of collecting responses from the online
70.00% survey, we found there were only few responses to the open
60.00% questions. Most of the answers to the open questions were
50.00% also very short and simple. Only a few of the respondents
Positive
40.00% provided any details of their experiences about using pat-
Negative terns. For this study we focused on the close questions in
30.00%
20.00%
LE the demographic part. Therefore, our results would not be
10.00%
influenced by this problem.
To the length of the survey form, we checked the responses
0.00%
Commercial Software Software Student of
including the ‘excluded’ responses. Some respondents only
software researcher teacher computing answered the “Demographic” part before exiting. But most
developer respondents completed it, they were not influenced by the
form length. So overall, the rate of completion suggests that
Figure 4: The Comparison of Different Roles in the we got the length of the survey about right.
Author Group
6. SUMMARY
90.00%
Since the publication of the milestone GoF textbook, some
80.00% of the 23 design patterns in this book have been widely em-
70.00% ployed in the OO development and maintenance process.
60.00% The concept of a design pattern indicates that design pat-
50.00% terns are a reuse means of documentation for successful so-
Positive lutions, which have been abstracted from experts’ successful
40.00%
30.00%
Negative experiences. Theoretically design patterns can make our de-
LE signs easier, and also help to create systems with properties
20.00%
such as flexibility and maintainability. The use of a design
10.00%
pattern can make a system more understandable for both
0.00% designers and maintainers.
Commercial Software Software Student of
software researcher teacher computing
But actually design patterns are not a universal solution
developer for more effective software development, and the application
of design patterns is not so easy and perfect as the expec-
tation. Our study has investigated the links between the
Figure 5: The Comparison of Different Roles in the
users’ background and the effectiveness of design patterns
Merged Group
by analysing quantitative data. This study has observed
and analysed the functions of design patterns are influenced
by users’ experiences rather than users’ roles.
54
[6] E. Gamma, R. Helm, R. Johnson, and J. Vlissides. APPENDIX
Design Patterns: Elements of Reusable
Object-Oriented Software. Addison-Wesley, 1995. A. THE ONLINE SURVEY (PART II)
[7] S. Geisser and W. Johnson. Modes of Parametric
Statistical Inference (Wiley Series in Probability and 1. Please note you will not be identified in any report that
Statistics). Wiley-Interscience, 1st edition, 2006. is produced using the information you have provided in
this questionnaire.
[8] F. Gravetter and L. Wallnau. Essentials of Statistics
Your name: Email address:
for the Behavioral Science. Wadsworth Publishing, 6th
2. Which of the following best describes your primary role
edition, 2007.
during software development?
[9] D. Howell. Fundamental Statistics for the Behavioral
Sciences (with CD-ROM). Duxbury Resource Center, (a) Commercial software developer
4th edition, 1998. (b) Software researcher
[10] R. Kirk. Experimental Design: Procedures for (c) Software teacher
Behavioral Sciences (Psychology). Wadsworth
Publishing, third edition, 1994. (d) Student of computing
[11] B. A. Kitchenham, D. Budgen, and O. P. Brereton. 3. Highest degree you have earned?
Using mapping studies as the basis for further research
(a) Associate degree
- a participant-observer case study. Information and
Software Technology, 53(6):638 – 651, 2011. (b) Bachelor’s degree
[12] P. S. Mann. Introductory Statistics. Wiley, 6 edition, (c) Masters
2006. (d) Ph.D. or equivalent
[13] S. Ross. Introduction to Probability and Statistics for (e) Other
Engineers and Scientists. Academic Press, 2nd edition,
1999. 4. How many years of experience do you have with Object-
[14] H. van Vliet. Software Engineering: Principles and Oriented development?
Practice. Wiley, 2 edition, 2000. (a) Less than 3 years
[15] M. Vokáč, W. F. Tichy, D. I. K. Sjøberg, E. Arisolm, (b) 3 to 5 years
and M. Aldrin. A controlled experiment comparing
the maintainability of programs designed with and (c) 6 to 10 years
without design patterns—a replication in a real (d) 11 to 15 years
programming environment. Empirical Software (e) Over 15 years
Engineering, 9:149–195, 2004.
5. How many years of experience do you have with work-
[16] P. Wendorff. Assessment of design patterns during
ing with design patterns?
software reengineering: Lessons learned from a large
commercial project. In Proceedings of 5th European (a) Less than 3 years
Conference on Software Maintenance and (b) 3 to 5 years
Reengineering (CSMR’01), pages 77–84. IEEE
(c) 6 to 10 years
Computer Society Press, 2001.
[17] C. Zhang and D. Budgen. What do we know about (d) 11 to 15 years
the effectiveness of software design patterns? IEEE 6. Have you written any patterns (or rewritten any exist-
Transactions on Software Engineering, ing patterns)?
38(5):1212–1231, September/October 2012.
(a) Yes
[18] C. Zhang and D. Budgen. A survey of experienced
user perceptions about software design patterns. (b) No
Information and Software Technology, 55(5):822 – 835, 7. In this section you are asked to provide us with your
2013. assessment of the usefulness of each pattern in the book
[19] C. Zhang, D. Budgen, and S. Drummond. Using a “Design Patterns: Elements of Reusable Object-Oriented
follow-on survey to investigate why use of the visitor, Software” by Gamma et al., based upon your experi-
singleton amp; facade patterns is controversial. In ences with using that pattern.
Empirical Software Engineering and Measurement (For each pattern identify as: Very Useful ; Useful ; Not
(ESEM), 2012 ACM-IEEE International Symposium Very Useful ; Not at all Useful ; Little or no Experience
on, pages 79–88, Sept 2012. of using this pattern)
55