A Framework of Patterns Applicability in Software Development

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

2014 IEEE 38th Annual International Computers, Software and Applications Conference Workshops

A Framework of Patterns Applicability in Software


Development
Hossam Hakeem Hui Guan
Faculty of Computing and Information Technology School of Computer Science and Technology
King Abdulaziz University Shenyang University of Chemical Technology
Jeddah, Saudi Arabia Liaoning, China, 110142
[email protected] [email protected]

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)

978-1-4799-3578-9/14 $31.00 © 2014 IEEE 486


DOI 10.1109/COMPSACW.2014.129
may be designed to operate on their own or in a pattern account. In this section a framework is briefly introduced
group. Delano et al. [6] state that patterns are grouped by that uses a pattern application process with the application
subject, and that because the groupings are open, new context taken into consideration.
patterns can be added to them. Incidentally, Kavanagh
creates a parallel concept of ‘focus’ in her guidance as to The framework uses an Assumption and Commitment
how to use patterns in construction [14]. More formalised constraints pair to characterise a pattern context. These
pattern languages are developed from such groupings to constraints determine the applicability of patterns and help
become contextualised within specific domains and wider the designer to choose the next pattern to be applied in the
subject areas. design of a system by imposing conditions on these
constraints. The framework also uses a categorisation of
There are many collections of software patterns that patterns that characterise the role that a pattern can play in
claim to be languages. The following can be counted, the design of a system. This characterisation is orthogonal to
CHECK pattern language [5], Meszaros and Doble Pattern the other used types (architectural patterns, design patterns
Language for Pattern Writing [15], and GAMA – A Pattern and idioms or coding patterns). Although the terminology is
Language for Computer Supported Dynamic Collaboration the same as used in WU Graham [10], the definition is
by Schummer [18], but none of these three declares itself to however different. These patterns are:
be generative in the sense described above.
x Abstract pattern. This pattern is defined as the
specification of a problem which the system designer
B. Pattern Application Process
is trying to solve.
In which order to apply patterns, plus adjacent patterns,
is important to the right use of a pattern language. However, x Concrete pattern. This pattern is defined as any
as have been established, this is mostly determined by the pattern available in any pattern bank, i.e., any pattern
specific context supplied by the current state of the system which will solve a particular problem.
in the building process. This is mainly why the key problem
of composing pattern sequences is more temporal and
dynamic than it is static and structural. However, current
presentations of patterns have no way of capturing or
presenting the detailed contextualisation required for the
actual construction of a specific system. Very often, even in
current maps a pattern at one ‘level’ may be connected to
two or more patterns at the next lower level.
Recently O. Coplien et al. have been looking at the issue Fig. 1. Refinement condition between two patterns
of composing pattern sequences from different sources [16].
They discussed the possibility of using sequences to Pattern refinement denotes the ‘implementation’ of an
combine general patterns with pattern languages, as some abstract pattern by a concrete pattern. Again since
pattern languages may possibly have similar patterns or application of a pattern is context dependent, refinement
patterns that overlap. Their work also looks at the use of will be context dependent as well. Refinement is represented
different pattern from different sources to be used in as a dashed line (see Fig.1). So a concrete pattern
sequences to compose languages, but their study did not ‘implements’ an abstract pattern in a certain context if the
look at sequences in the use of a pattern language [16]. following two conditions hold:
Henney et al. [13] used some operators to compose patterns
1) The assumption A of the abstract pattern implies the
in a better way in addition to the widely used now pattern
assumption Ax of the concrete pattern.
languages graphs or maps. Also Zdun used pattern language
grammar for providing an approach to better support the A implies Ax
selection of patterns and systematic design decisions based
on patterns. He proposed a two steps approach where he 2) The commitment Cx of the concrete pattern implies
formally document the grammar of a pattern language and the commitment C of the abstract pattern.
annotate it with the effects on quality goals. The idea was Cx implies C
that the pattern sequences of a pattern language can be
driven from the pattern language grammar [21]. Welie and So intuitively refinement of patterns in certain context
Veer also discussed the issue of structuring a collection of means that an abstract pattern can be replaced by a concrete
patterns into pattern languages in Interaction Design and pattern if and only if those conditions hold. The framework
they proposed that this language can be organised would not only provide solutions to specific design
hierarchically, from high-level design problems to low-level problems, but it will also provide a process of how to apply
design problems [20]. patterns, which will help in the process of applying them:
when, how, and in which order.
III. A PATTERN APPLICATION FRAMEWORK In the framework a pattern is presented as a
From the discussion above, it is clear that a pattern problem/solution pair together with an Assumption
application process is needed that takes the context into /Commitment pair (Prob, Sol, A, C). The system designer
starts with an abstract pattern (Prob, Sol, A, C) that is a

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.

Fig. 3. A bigger pattern solution to solve a smaller problem

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.

Fig. 5. Decomposition of a problem and composition of a solution

From Fig.5 it can be seen that the problem is


decomposed into sub-problems and then the concrete
patterns solving those sub-problems can be composed to
solve the original problem, i.e., the designer performs the
following steps:
(Prob, Sol, A, C)
(Prob1 OPd Prob2, Sol, A, C) Fig. 6. Site type design patterns for an E-commerce website
(Prob1 OPd Prob2, Sol1 OPc Sol2, A, C)
(Prob1, Sol1, A1, C1) OP (Prob2, Sol2, A2, C2) TABLE I. THE ASSUMPTION/COMMITMENT OF THE USED PATTERNS
IN THE ETIDY WEBSITE
So composing two concrete patterns applications
denotes first the decomposition of the problem Prob and Pattern Source Assumption Commitment
name
then the composition of the solutions for the sub-problems. P1: Establish WU There are business List of chosen
The Ax and Cx stand for the Assumption and commitment of the business objectives. business objectives.
the composed patterns. objectives
P2: Business WU List of chosen List of business
IV. CASE STUDY process business processes
model objectives. corresponding to the
The purpose of this case study is to evaluate the business objectives.
Assumption /Commitment framework and the use of the P3: Establish WU List of chosen List of use cases
operators in the application of patterns to build a small the use cases business corresponding to the
processes. business processes.
shopping website. P4: E- Welie There is a Website that
A total of 10 basic patterns are picked from WU and commerce shopping use case provides the E-
Site for the E- commerce process
Welie [10, 19]. For the space limitation, the full patterns commerce process shopping.
descriptions are not given in this paper. The first four P5: Shopping Welie There are objects A website for
patterns are picked to determine the type of website to be to buy and there is buying objects
built. The rest of the patterns are selected to show the design a shopping use online.
of the basic functionality of shopping website. Table I lists case.
the Assumption/Commitment of these patterns. P6: View Welie There is a set of Display the objects
objects. the user can buy
Because the original design of the website is unknown a P7: Shopping Welie A collection of List the objects the
design in the form of pattern map is proposed. This design is Cart objects the user user wants to buy.
can buy
represented as a pattern map and illustrated in Fig. 6 and
P1: Collector Welie There are objects Set of objects
Fig.7. The proposed design is analysed using the that the user can selected by the user.
Assumption/Commitment framework. In the analysis the select.
application order of the patterns is determined, i.e., what is P9: List Welie There is a set of To list the objects in
needed (Assumption) in order to apply a certain pattern and Builder objects selected the set selected by
what is provided (Commitment) in order to apply the next by the user the user in a
particular order.
pattern.
P10: Purchase Welie There are objects Buy the objects in
For the simplicity the pattern map will be divided to two Process in the shopping the shopping cart.
cart.
sections:
The application of the proposed design in a certain
x Section one: The Site Type Design (Abstract context is checked using the Assumption/Commitment
Patterns). In this section the first 3 patterns can be framework. This is proved by applying the framework for

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.

Fig. 7. ETIDY website concrete design patterns

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

You might also like