Download - Pattern Classification Kal Vot
-
7/31/2019 Pattern Classification Kal Vot
1/55
8109103
Ohjelmistotuotannon Teoria
Tampere University of Technology
Software Systems Institute
Pattern Classification
Imed Hammouda & Jakub [email protected], [email protected]
10.03.2004
-
7/31/2019 Pattern Classification Kal Vot
2/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Outline
Introduction
Pattern Classification Classification Criteria
Example Classification Schemas
Conclusions
-
7/31/2019 Pattern Classification Kal Vot
3/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Introduction: What is a Pattern?
Each pattern is a three-part rule, which expresses a relationbetween a certain context, a problem, and a solution.[Alexander77]
Each pattern is a three-part rule that expresses a relation betweena certain context, a certain system of forces that occursrepeatedly in that context, and a certain software configuration
that allows these forces to resolve themselves. [Gabriel]
A pattern for software architecture describes a particularrecurringdesign problem that arises in specific design contexts and
presents a well-proven generic scheme for its solution. The solutionscheme is specified by describing its constituent components, theirresponsibilities and relationships, and the ways in which theycollaborate. [Buschmann96]
-
7/31/2019 Pattern Classification Kal Vot
4/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Pattern Classification
The increase in the number of patterns made it very important todevelop proper methodologies and techniques how to organize
them.
Pattern classification is the organization of patterns into groups ofpatterns sharing the same set ofproperties.
The kind of these properties is not fixed and may include criteriasuch as structure, intent, or applicability.
Depending on the chosen criteria, we could define a classificationschema.
Pattern classification techniques
-
7/31/2019 Pattern Classification Kal Vot
5/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Dimensions of Classification
Schemas Different classification schemas can have different
dimensions.
A two dimensional schema, for example, uses two
criteria in the classification process.
Usually, the more dimensions a schema has, the more
useful the classification is.
Better partitioning of the pattern space
-
7/31/2019 Pattern Classification Kal Vot
6/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Dimensions of Classification
Schemas The same pattern can have different kinds of properties,
it can be included in more than one category.
Each property maps the pattern to the category of that
property kind.
In order for the classification to be efficient, we think that
a pattern should not belong to more than two categories.
Hint: Concentrate on the major attributes of patterns.
-
7/31/2019 Pattern Classification Kal Vot
7/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Purpose of Pattern Classification
The main goal of pattern classification is to make it easier for
software developers to select the right pattern to apply.
Example: In order to solve a certain design problem, the right
design pattern, if available, should be selected.
For selecting a specific pattern, i.e. pattern selection, the nature of
the problem should be matched with the right pattern category.
Hint: Match the description of the problem with the description ofthe pattern category, then with the description of the individual
patterns.
-
7/31/2019 Pattern Classification Kal Vot
8/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Purpose of Pattern Classification
Classification schemas can be used to understand and
perceive the main properties of patterns.
It is usually impractical to go through all the details of all
the patterns before picking up the right pattern.
Classification schemas can be used to structure a
pattern system and highlight the relationships betweenthe constituent patterns.
-
7/31/2019 Pattern Classification Kal Vot
9/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Properties of Classification Schemas
According to [Buschmann96]: Simple and easy to learn: It should be easy to use the classification
scheme to classify and select patterns.
Few classification criteria: In order to reduce complexity and ambiguity,the classification schema needs to be as compact as possible in terms ofthe number of criteria.
Reflecting pattern properties: Using the classification schema, it shouldbe possible to represent the main properties of the patterns to beclassified.
Roadmap to pattern selection: The classification scheme should easethe pattern selection process.
Openness to the integration of new patterns: Using the classificationschema, it should be possible to classify new patterns.
-
7/31/2019 Pattern Classification Kal Vot
10/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Properties of Classification Schemas
Additional Properties:
Openness to new classification criteria: It should be possible to
extend the classification scheme by either increasing its
dimension or by modifying a given dimension.
Reflecting the relationship between patterns: In addition tocapturing their main properties, the classification schema should
be able to highlight the relationships between the patterns.
-
7/31/2019 Pattern Classification Kal Vot
11/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Pattern Classification Criteria
Discipline Scope
Criteria
Granularity
Domain Purpose
Paradigm
-
7/31/2019 Pattern Classification Kal Vot
12/55
-
7/31/2019 Pattern Classification Kal Vot
13/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification by Discipline:
Example
A pattern system for conservation economy [ConservationEconomy04]
-
7/31/2019 Pattern Classification Kal Vot
14/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification Criteria: Domain
In software engineering, patterns are mostly known for, but not
restricted to, solving problems of design and architecture.
Different patterns have been proposed to solve design problems in
various areas of software engineering.
Patterns have been applied in the domain of real-time systems,
communications, distributed systems, user interface, embedded
systems, etc.
Software developers tend to select patterns within the category
matching theirspecific problem domain.
-
7/31/2019 Pattern Classification Kal Vot
15/55
-
7/31/2019 Pattern Classification Kal Vot
16/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification Criteria: Paradigm
Patterns became a popular practice in the development ofobject-
oriented software systems.
Patterns apply to other paradigms as well. Imperative languages
may provide their own imperative patterns.
In the object oriented paradigm, patterns are described in terms of
concepts like objects, classes, object composition, and class
inheritance.
In imperative programming, patterns are mainly expressed in terms
of other concepts such as functions and procedures.
-
7/31/2019 Pattern Classification Kal Vot
17/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification by Paradigm:
ExampleA pattern catalogue for functional logic languages: [Antoy02]
Ensure that values of a datatype are
hidden.
Opaque Type
Ensure that a local name is globally
unique.
Locally Defined Global
Identifier
Compute solutions in an incremental
manner.
Incremental Solution
Ensure that a mapping from indexes to
values is injective.
Concurrent Distinct Choices
Prevent invoking a constructor that
might create invalid data.
Constrained ConstructorIntentPattern
-
7/31/2019 Pattern Classification Kal Vot
18/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification Criteria: Granularity
Patterns in a software system can be categorized
depending on the level at which they address the
system.
It is sometimes difficult to draw the border line between
different pattern categories.
The same pattern could be classified in differentgranularity categories.
-
7/31/2019 Pattern Classification Kal Vot
19/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification by Granularity:
Example Widely used granularity-based classification:
[Buschmann96]
Architectural patterns: refer to a software system at high level.
Design patterns: focus on subsystems and components.
Idioms (coding patterns): address the lowest level of a software
system.
-
7/31/2019 Pattern Classification Kal Vot
20/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification Criteria: Purpose
An efficient method to classify patterns is to categorize
them according to theirpurpose.
The purpose represents the kind of problems the pattern
solves.
This criterion is the most useful since it describes the
concrete situation where the pattern applies.
-
7/31/2019 Pattern Classification Kal Vot
21/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification by Purpose: Example
For designing real-time frameworks, the followingpurposes are defined: [Douglass99] Architectural support patterns: represent the strategic decisions
for the organization of real-time applications.
Collaboration and distribution:patterns provide solutions to
common application domain problems in real-time systems.
Safety and reliability patterns: deal with common problems ofsafety and reliability.
Behavioral patterns: provide different implementation solutionsinvolving multiple objects.
-
7/31/2019 Pattern Classification Kal Vot
22/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification Criteria: Scope
Patterns can then be classified according to the features
implementing them.
Such a classification criteria is known as scope.
In the object-oriented paradigm, design patterns can be
implemented using either object composition or class
inheritance.
-
7/31/2019 Pattern Classification Kal Vot
23/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Classification by Scope: Example
GOF classification uses the scope criterion: [Gamma95]
Class representation: uses class inheritance.
Object representation: uses object composition.
The same pattern might be implemented either way.
Example: Adapter.
-
7/31/2019 Pattern Classification Kal Vot
24/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Example Classification: GOF
The design patterns catalogue presented in [Gamma95]
is one of the most widely known pattern classification
schema.
GOF classification is two dimensional.
Patterns are classified by theirpurpose and scope.
-
7/31/2019 Pattern Classification Kal Vot
25/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Example Classification: GOF
Purpose:
Creational: related to object creation.
Structural: concerning structures (compositions) created by
classes and objects.
Behavioral: deal with the way responsibilities in classes are
distributed.
Scope:
Class representation: uses class inheritance. Object representation: uses object composition.
l f l
-
7/31/2019 Pattern Classification Kal Vot
26/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
GOF Classification: Singleton
Purpose: Creational
Scope: Object
Singleton
static Instance()
SingletonOperation()GetSingletonData()
static uniqueInstance
singletonData
return uniqueInstance
Ensure that only one object of given class is created
l ifi i d
-
7/31/2019 Pattern Classification Kal Vot
27/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
GOF Classification: Adapter
Purpose: Structural
Scope: Object or Class
TextShape
BuildingBox()
CreateManipulator()
Line
BuildingBox()
CreateManipulator()
DrawingEditorShape
BuildingBox()
CreateManipulator()
TextView
GetExtent()
return text -> GetExtent()
return new TextManipulator
Convert the interface of a class into another interface clients expect
GOF Cl ifi i S
-
7/31/2019 Pattern Classification Kal Vot
28/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
GOF Classification: Strategy
Purpose: Behavioral
Scope: Object
Composition
Traverse()
Repair()
Compositor
Compose()
compositor -> Compose()
SimpleCompositor
Compose()
TeXCompositor
Compose()
ArrayCompositor
Compose()
Define a family of algorithms, encapsulate each one,
and make them interchangeable
E l Cl ifi i B h
-
7/31/2019 Pattern Classification Kal Vot
29/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Example Classification: Buschmann
The work of Buschmann classifies patterns using two
criteria: [Buschmann96]
Buschmann classification is two dimensional.
Patterns are classified by theirgranularity (pattern
categories) and purpose (problem categories).
E l Cl ifi i B h
-
7/31/2019 Pattern Classification Kal Vot
30/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Example Classification: Buschmann
Granularity:
Architectural patterns: specify the fundamental structure of
applications. They specify structure of the system as subsystems,and their responsibilities, and define rules for relationships
between them.
Design patterns: focus on subsystems and components, the
middle level of a software system. Design patterns describe
common problems arising in a given context of particular
subsystem.
Coding patterns (idioms): use proven conventions and
techniques during the implementation phase of applications.
-
7/31/2019 Pattern Classification Kal Vot
31/55
E l Cl ifi i B h
-
7/31/2019 Pattern Classification Kal Vot
32/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Example Classification: Buschmann
Purpose:
Organization of work patterns define solutions for solving complex
services through component collaboration.
Access control patterns manage access to services.
Management patterns handle the management of collections ofhomogeneous objects, services, and components.
Communication patterns manage the communication between
components.
Resource handling patterns manage shared components and objects.
B h Cl ifi ti
-
7/31/2019 Pattern Classification Kal Vot
33/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Buschmann Classification:
Blackboard Granularity: Architectural.
Purpose: From mud to
structure.
Blackboard
inspect
update
solutions
controlData
Control
loop
nextSource
Knowledge
Source
updateBlackboard
execConditionexecAction
operate on
activates
+1
+1
Several specialized subsystems assemble their knowledge
to build a possibly or approximate solution
Zi Cl ifi ti
-
7/31/2019 Pattern Classification Kal Vot
34/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Zimmer Classification
Zimmer Classification [Zimmer95] : New classification of
the GOF design patterns.
Three kinds of relationship between patterns defined:
Pattern X uses pattern Y in its solution.
Pattern X is similarto pattern Y.
Pattern X can be combined with pattern Y.
These relationships describe new classification schemafor the GOF design patterns.
-
7/31/2019 Pattern Classification Kal Vot
35/55
Domain Dependent Patterns J2EE
-
7/31/2019 Pattern Classification Kal Vot
36/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Domain-Dependent Patterns - J2EE
J2EE design patterns can be implemented only in J2EE
technology.
Domain specific patterns may be based on other
patterns Session Facade is based on the GOF
Facade design pattern.
They also may be completely domain dependent
Value Object J2EE design pattern.
Session Facade Example
-
7/31/2019 Pattern Classification Kal Vot
37/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Session Facade Example
Clients directly accessing application components must deal with
complexity of the implementation.
Changes in the internal implementation affect clients.
High number of calls needed to achieve a task.
Client
Client
Client
Network
Application Server
Access Without Faade [Marinescu02]
Session Facade Benefits
-
7/31/2019 Pattern Classification Kal Vot
38/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Session Facade - Benefits
Access involving Session Faade:
Application internal complexity is hidden.
Changes in the internal implementation do not affect clients. Number of calls is reduced.
Client
Client
Client
Application Server
Fac
ade
Facade
Network
Access With Faade [Marinescu02]
Process Patterns
-
7/31/2019 Pattern Classification Kal Vot
39/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Process Patterns
Address the problem ofstructures and processes in organisations
especially in domain of software development. [Coplien94]
Applicable to whole organisations or only particularprojects.
Used in many aspects of organisation structure:
Size of the organisation.
Tasks scheduling.
Assigning tasks to organisation (project) members.
Information flow. Assuring quality level.
Process Patterns Example 1
-
7/31/2019 Pattern Classification Kal Vot
40/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Process Patterns Example 1
Size of the organization pattern:
Answers the question how big should be the organisation (project
group) for creation a product of 25000 lines of code.
Considerations:
Too small organisation may not be able to deal with a task. Too big organisation may not be profitable enough at the beginning and
may face communication problems.
Solution: Create a team of about 10 selected members that number should
ensure enough workforce, but should not affect communication and
profit margins.
Process Patterns Example 2
-
7/31/2019 Pattern Classification Kal Vot
41/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Process Patterns Example 2
Solo Virtuoso pattern:
Addresses small projects not likely to grow rapidly.
Considerations:
Too big team may be too costly to maintain when the project is small.
Solution:
The team should be based on one or two members that are specialists in
the domain.
Possible problems:
Absence of even one team member may cause challenges to the
project.
Process Patterns Example 3
-
7/31/2019 Pattern Classification Kal Vot
42/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Process Patterns Example 3
Firewalls pattern:
Addresses communication problems between the team
and the outside world.
Considerations:
Developers are being directly contacted too often by theoutsiders - this distracts developers.
Information flow from the outside world must be maintained .
Solution: A manager role who shields developers from direct contact from
outside, but sustains the information flow.
Analysis Patterns
-
7/31/2019 Pattern Classification Kal Vot
43/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Analysis Patterns
Analysis patterns are used to analyse organisations
structures and processes in order to model them in
software. [Fowler97]
Some Analysis Patterns may be applicable only to one
domain (e.g. health care) but many can be used invarious domains.
Analysis Patterns Classification
-
7/31/2019 Pattern Classification Kal Vot
44/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Analysis Patterns Classification
Analysis Patterns can be classified in following groups:
Accountability describing relations between parties
(organisations, people). Observations and measurement used to record information
about the world.
References to objects how unique to objects in real life can be
created.
Accounting used in accounting systems.
Planning planning and recording of resources use.
Trading used for trade analysis (e.g. the influence of changingprices on profits).
Analysis Patterns - Party
-
7/31/2019 Pattern Classification Kal Vot
45/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Analysis Patterns Party
The Party analysis pattern addresses the problem of
relating information (phone number, email etc.) to
many parties (people or organisations), which are
similar to each other.Telephone
Number
Person
Organization
Party Address
PersonZero or more [0,*] Zero or one [0,1]
Party Analysis Pattern
Analysis Patterns - Quantity
-
7/31/2019 Pattern Classification Kal Vot
46/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Analysis Patterns Quantity
The Quantity pattern deals with problem of storing
measurement results.
Results stored only as values may be difficult to interpretand prone to conversion errors.
Without the Quantity pattern the values are interpreted
based on an explicit contract with the client.Person
height: Number
weight: Number
blood glucose level: Number
Measurement Without Quantity
Analysis Patterns - Quantity
-
7/31/2019 Pattern Classification Kal Vot
47/55
Tampere University of Technology
Software Systems Institute
8109103
Ohjelmistotuotannon Teoria
Analysis Patterns Quantity
The Quantity analysis pattern advocates storing valuesalong with units.
Measurement results can be stored in units that were usedin the measurement.
Conversion rules to other units are stored with the results
Results are not ambiguous.Person
height: Quantity
weight: Quantity
blood glucose level: Quantity
Quantity
amount: Number
units: Unit
+, -, *, /, =, >,