A Framework of Patterns Applicability in Software Development
A Framework of Patterns Applicability in Software Development
A Framework of Patterns Applicability in Software Development
Hongji Yang
Centre for Creative Computing, Bath Spa University
Bath, UK
[email protected]
Abstract— Patterns and pattern languages are widely used application process that takes into account the changes in
nowadays. The need to apply patterns in the right sequence is the context of the system because the system context
very important, but how to apply them using many pattern /environment will affect the application of the next pattern
languages or pattern catalogue is sometimes very difficult. and the result will change from one pattern application to
After examining the current literature on the use of patterns another. The paper will discuss some of the confusion
from the software development perspective, this paper caused by these maps when they are put to use and when
proposes a framework for determining the pattern pattern application fails at some certain steps of the maps.
applicability during the software development. It will also
examine the use of pattern maps and the resulting ambiguity in In Section 2 we provide related works on pattern
their use by looking at different well-documented pattern maps. application process from the perspective of pattern
The paper investigates how patterns applicability alters the languages and the process to apply patterns. In Section 3,
way of applying them in a language and from different we present our framework for pattern application that takes
patterns banks. The proposed framework in this paper allows into account the context. Section 4 shows the application of
the designer to be guided through the process of applying our proposed framework with a specified case study. The
patterns. paper summarises the results in Section 5.
Keywords—software pattern; pattern map; pattern languages;
II. RELATED WORK
I. INTRODUCTION The first introduction to patterns for the software
development community came via a paper presented by
Patterns have - in the course of less than fifteen years -
Kent Beck and Ward Cunningham [3]. In that paper, they
risen from being the concern of a minority group within the
demonstrated the utility of patterns in designing applications
object-oriented programming community to a mainstream
implemented in the Smalltalk programming language. A
concern of a number of domains within information
highly influential book, Design Patterns – elements of
sciences and software engineering. From an original
reusable object-oriented software [9], published some
concern with generic design patterns, the systems-building
twenty three patterns in three categories (‘creational’,
communities have subsequently evolved analysis patterns
‘structural’ and ‘behavioural’) that they had found in a
[8, 12], process patterns [2], organisational patterns [4],
number of successful object oriented frameworks and which
architectural patterns [1] and web usability patterns [10]. All
seemed therefore to be characteristic of good design. Since
of this is testimony that patterns are increasingly a
then, literally hundreds of patterns have been published.
‘mainstream’ rather than peripheral concern of the computer
Books focus on the use of patterns in object-oriented
systems-building world.
software design can be found in [7, 9, 10, 17]. In this
This paper will explore some of the essential aspects of section, related works about pattern applicability are
pattern languages and pattern sequences, in order to provided from pattern language and pattern application
highlight some un-clarities in current understanding and to process perspective.
draw out the unfolding importance of the idea of ‘context’.
By looking at some well documented and used patterns A. Pattern Language
maps, it is shown that there is some ambiguity in the use of Generally, a pattern language is not a programming
them. This ambiguity during the pattern application process language; rather it is a procedural document, with the
in the system design shows there is a need for a pattern purpose of guiding and informing the designer. Patterns
This work is partially sponsored by Research Project (Grant No.
L2013156) of Education Department of Liaoning Province (China)
487
specification of the system to be built, i.e., Prob is the x To invent a new concrete pattern. This new pattern
specification and Sol is the solution. The designer is needs to be examined and used over and over again
constructing Sol to solve Prob within a context described by to become an accepted pattern.
the Assumption/Commitment pair (A, C).
If none of the above is appropriate or no solution is
found using Stage 1 then the system designer proceeds to
Stage 2.
Stage 2: Divide and Conquer. If the designer faces a
problem where there exists no concrete pattern in any bank
to solve that particular problem then the designer has to
decompose this problem into sub-problems and find
concrete patterns that will provide a solution for these sub-
problems. The rationale is that for a complex system, there
may not be an existing concrete pattern that can be used
directly to solve this big problem. The stages of Divide and
Conquer are as follows:
a) Decompose the Problem into Sub-problems (Divide)
If there are no concrete patterns available for solving a
specific problem directly, the designer decomposes the
big/complex problem using operator OPd into smaller sub-
problems. The context described by A and C remain the
Fig. 2. An overview of the framework
same for these sub-problems. Fig.4. shows a problem
The general overview of the framework is pictured in decomposition into two sub-problems using operator OPd.
Fig. 2. and consists of 2 stages.
Stage 1: Use/Adapt Existing Patterns. Firstly the
designer will look for a concrete pattern to solve the
problem Prob. If there is a pattern in a particular pattern
bank that solves this problem then the designer will use it.
This pattern must solve the whole problem. Secondly, if
there is no pattern in a particular pattern bank that solves the
problem Prob the designer has to search for a solution and Fig. 4. Decomposition of a problem
the designer will have the following 2 options:
b) Compose the Solutions for the Sub-problems
x To search for a concrete pattern that solves a bigger (Conquer)
problem.
After decomposing the problem the focus is now on how
In this case there is a concrete pattern P = (Probp, Solp, to compose the solutions of the sub-problems to form the
Ap, Cp) such that Prob is contained in Probp because then solution to the problem Prob. Instead of looking for patterns
pattern P will provide a solution Solp for it. So if Prob is that will solve Prob, the designer needs to find patterns that
contained in Probp, i.e., Prob is smaller than Probp, and Solp will solve the sub-problems. If the designer finds concrete
is a solution for Probp then obviously Solp is also a solution patterns P1 and P2 that will provide solutions Sol1 and Sol2
for the smaller Prob. Since also the context need to match for respectively Prob1 and Prob2, then Sol1 OPc Sol2 will
then the following conditions need to hold: provide a solution for the original problem Prob. Sol1 OPc
Sol2 will only provide a solution for problem Prob if the
A implies Ap (because of refinement)
context of patterns P1 and P2 matches that of the abstract
Cp implies C (because of refinement) pattern. If the operator OPd and OPc are the sequential
operator then the matching of context is expressed as
In that case Solp provides a solution for problem Prob in follows:
the context described by A and C. Fig.3 illustrates this
relation. A implies A1 (because of refinement)
C2 implies C (because of refinement)
C1 implies A2 (because of sequential
application/composition)
In [11] the matching of context with respect to various
operators, i.e., Sequential, Choice and Parallel has been
discussed.
488
used as a start to design any type of business [10].
These patterns are applied according to the context.
The 4th pattern determines the site type and in this
case an E-commerce site. The patterns in this section
are Abstract Patterns. They are illustrated in Fig.6.
x Section two: The Site Concrete Design (Concrete
Patterns). In section one the type of site is
determined. In section two a concrete design of the
site is given, i.e., a concrete design for the abstract
pattern E-commerce site is given. This is illustrated
in Fig.7.
489
each pattern application. The application of these patterns five conditions trivially hold and the matching of context is
includes the following steps. For the paper length limitation, expressed as follows:
only first two steps are specified and the other two steps are
shown only with the result. In circle 1: A implies A1 which means that the
Assumption of the shopping website (There are business
objectives) matches the Assumption of the Establish the
business objectives pattern (There are business objectives).
The remainder circles have the similar meaning with circle 1,
which are in circle 2: C1 implies A2; in circle 3: C2 implies
A3; in circle 4: C3 implies A4; in circle 5: C4 implies.
1) Step one
The first four Abstract patterns need to be applied in the
right context by using the Assumption and Commitment of
each patterns listed in Table I. Since they are applied in
sequential order, the operator is the sequential operator. The Fig. 8. Basic patterns to start the design of an E-commerce site
framework is used here to aid the designer in solving the
problem of building shopping website and the framework 2) Step Two
stages will be applied as follows:
For the following two patterns, P4: E-commerce site and
Stage 1: there are no single concrete patterns in the P5: Shopping need to be applied in the right context by
designer’s pattern bank that can be applied to produce this using the Assumption and Commitment of each patterns
website and solve this problem. Also there is no bigger listed in Table I.
concrete pattern that will provide a solution to the problem
The framework is now used to give a concrete design for
of building this website. Then the next stage in the
pattern P4: E-commerce.
framework is applied.
Stage 2: will have the following steps:
a) I - (Divide). The shopping website problem cannot
be solved by applying only one pattern. The
shopping website problem is decomposed into four
sub-problems in this context: the Establish the
business objectives, Business process model,
Establish the use cases and E-commerce Site. The
decomposition is done using the sequential operator.
b) II - (Conquer). Since the sub-problems of those
patterns are representing part of the solution for the
problem of the shopping website problem the Fig. 9. Application of P4 and P5 in the ETIDY website
sequential composition of the solutions of four
patterns will solve the shopping website problem. Stage 1: there is an abstract pattern in the designer’s
These four patterns need to be applied in the right pattern bank that can be used to solve this problem and it is
context. Table I list the Assumption and Commitment of P5: Shopping. Then the designer will use it and there is no
each patterns used. Fig.8 illustrates the relation between the need for Stage 2. The relation is expressed as: P4 is refined
Assumption/Commitment of these patterns. by P5. In this case the abstract pattern P4: E-commerce site
is refined by the concrete pattern P5: Shopping in a certain
The operator used here is the sequential operator and the context. In this case the condition trivially holds and the
relation is expressed as: P is refined by P1 ; P2 ; P3; P4. matching of context is expressed as follows:
The system designer needs to check the five following In circle 1: A4 implies A5; in circle 2: C5 implies C4.
conditions to make sure that the sequence of pattern can be
applied for the shopping website problem. In this case the So the system designer needs to check those two
conditions. In this case the two conditions trivially hold. So
refinement holds between the patterns.
490
3) Step Three Assumption/ Commitment framework makes it easier for
designer to decide which pattern to apply next in the design.
Fig.10 shows that the concrete design uses three basic
patterns that need to be applied sequentially. It also shows
the context in which those patterns are applied. The operator V. CONCLUSIONS
used here is the sequential operator and the relation is We emphasise the importance of pattern language and
expressed as P5 is refined by P6 ; P7 ; P10. In this case the pattern application process when applying software patterns
four conditions trivially hold and the matching of context is in software development. A framework of pattern
expressed as follows: applicability is proposed by analysing the assumption and
commitment condition. The case study shows our proposed
In circle 1: A5 implies A6; in circle 2: C6 implies A7; in framework a positive result when applying patterns during
circle 3: C7 implies A10; in circle 4: C10 implies C5. the software development.
REFERENCES
[1] C. Alexander, S. Ishikawa and M. Silverstein, "Pattern Languages,"
Center for Environmental Structure, vol. 2, 1977.
[2] S. W. Ambler, Process Patterns: Building Large-Scale Systems
Using Object Technology: Cambridge University Press, 1998.
[3] K. Beck and W. Cunningham, "Using Pattern Languages for Object-
Oriented Programs," in Conference on Object-Oriented
Programming, Systems, Languages, and Applications, 1987.
[4] J. O. Coplien and N. B. Harrison, Organizational Patterns of Agile
Software Development: Prentice-Hall, Inc., 2004.
[5] W. Cunningham, "The Checks Pattern Language of Information
Integrity," in Pattern Languages of Program Design, pp. 145-155,
1995.
[6] D. E. Delano, "Patterns Mining," The Patterns Handbook:
Techniques, Strategies, and Applications, vol. 13, pp. 87, 1998.
Fig. 10. Patterns for the design of an E-commerce site
[7] B. Foote, H. Rohnert and N. Harrison, Pattern Languages Of
Program Design 4: Addison-Wesley Longman Publishing Co.,
4) Step Four 1999.
[8] M. Fowler, Analysis Patterns: Reusable Object Models: Addison-
A concrete design can be given to the Shopping Cart Wesley Professional, 1997.
problem using Pattern P8 and P9. This is repeated below for [9] E. Gamma, R. Helm, R. Johnson and J. Vlissides, Design Patterns:
completeness. The operator used here is the sequential Elements of Reusable Object-Oriented Software: Pearson Education,
operator and the relation is expressed as: P7 is refined by 1994.
P8 ; P9. In this case the three conditions trivially hold and [10] I. Graham, "Four Patterns from the WU Pattern Language: a Pattern
Language for Web Usability," in EuroPLoP, pp. 159-178, 2002.
the matching of context is expressed as follows: [11] H. Hakeem, "A Compositional Framework for Determining Pattern
In circle 1: A7 implies A8; in circle 2: C8 implies A9; in Applicability," Ph.D. thesis, De Montfort University, 2010.
[12] D. Hay, Data Model Patterns: Conventions of Thought: Addison-
circle 3: C9 implies C7. Wesley, 2013.
[13] K. Henney, E. Schlossberg and A. Kelly, "Context Encapsulation-
Three Stories, A Language, and Some Sequences," in In
Proceedings of EuroPlop 2005, 2005.
[14] M. J. Kavanagh, "Foci and Centres in the Design and Use of Pattern
Languages," Ph.D. thesis, De Montfort University, 2005.
[15] G. Meszaros and J. Doble, "A Pattern Language for Pattern
Writing," Pattern Languages of Program Design, vol. 3, pp. 529-
574, 1998.
[16] R. Porter, J. O. Coplien and T. Winn, "Sequences as A Basis for
Pattern Language Composition," Science of Computer
Programming, vol. 56, no. 1, pp. 231-249, 2005.
[17] L. Rising, "Design Patterns: Elements of Reusable Architectures,"
The Patterns Handbook: Techniques, Strategies and Applications,
pp. 9-13, 1998.
[18] T. Schümmer, "GAMA: A Pattern Language for Computer
Supported Dynamic Collaboration," in EuroPLoP, pp. 53-114, 2003.
[19] M. van Welie, Patterns in Interaction Design, Available:
Fig. 11. Decomposition of the problem and composition of the solutions for http://www.welie.com/, 2010.
Shopping Cart pattern [20] M. Van Welie and G. C. Van der Veer, "Pattern Languages in
Interaction Design: Structure and Organization," in Proceedings Of
Fig.11 shows that solving the shopping Cart problem Interact, pp. 1-5, 2003.
needs more than one pattern and this is depending on the [21] U. Zdun, "Systematic Pattern Selection Using Pattern Language
Grammars and Design Space Analysis," Software: Practice and
context. In this case the patterns are very basic showing the Experience, vol. 37, no. 9, pp. 983-1016, 2007.
user what is inside the shopping cart. The establishment of
the shopping cart is not done through one specific pattern
but through the application of two patterns. The
491