SlideShare a Scribd company logo
Introduction to Patterns
Hironori Washizaki
Waseda University
Twitter: @Hiro_Washi washizaki@waseda.jp
http://www.washi.cs.waseda.ac.jp/
Agenda
• Patterns and Pattern Languages
• Software Patterns
• Writing Patterns
2
PATTERNS AND PATTERN
LANGUAGES
3
4
Stockholm, Sweden
Alaior, Spain
Repetition, and, not a coincidence.
• Small public squares
• Street cafes
• Live! Active! Positive!
5
What makes this repetition?
6
• Settings were common
– Planning city structure and environment
• Problems were common
– Open and attractive city
– Having places for people gathering and sitting lazily
• Considerations were common
– Not too large space
– Not closed.
=> Common solution! SolutionSolution
ProblemProblem
ContextContext
ForcesForces
Pattern form
• Context: when to consider?
• Problem: what should be solved and
when?
• Forces: why the problem is hard?
• Solution: what to do to solve problem?
• Resulting context: both positive and
negative 7
SolutionSolution
ProblemProblem
ContextContext
ForcesForces
Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
SMALL PUBLIC SQUARES
• … this pattern forms the core which makes
an ACTIVITY NODE … it can also help to
generate a PROMENADE, …, through the
action of the people who gather there…
• A town needs public squares; they are the
largest, most public rooms, that the town
has. But when they are too large, they
look and feel deserted.
• Make a public square much smaller than
you would at first imagine…
8
SolutionSolution
ProblemProblem
ContextContext
ForcesForces
Christopher Alexander, et al., “A Pattern Language,“ Oxford University Press, 1977
Abstraction and concretization
9
Abstraction
Concretization
Alexander’s definition of patterns
• Describes a problem that occurs over
and over again in our environment
• Describes the core of the solution to
that problem
• In such a way that you can use this
solution a million times over without
ever doing it the same way twice.
• Both a process and a thing
– both a description of a thing which is alive
– and a description of the process which
will generate that thing
10
Christopher Alexander, et al., “A Pattern Language,“ Oxford University Press, 1977
Christopher Alexander , “The Timeless Way of Building,” Oxford University Press, 1979
Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
Quality Without A Name (QWAN)
• “There is a central quality which is the root criterion
of life and spirit in a man, a town, a building, or a
wilderness. This quality is objective and precise,
but it cannot be named.”
– Christopher Alexander
• Message from C. Alexander
11
Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
Thinking and communications by
patterns
… OK, so, to attract many
people to our city, SMALL
PUBLIC SQUAREs should be
located in the center. At the
SMALL PUBLIC SQUARE, make
STREET CAFES be OPNENING
TO THE STREET...
12
BuildingBuilding
Street
Public square
Cafe
Pattern Language
• “A collection of patterns and
the rules to combine them
into an architectural style.”
– James O. Coplien
• “Each pattern then, depends
both on the smaller patterns
it contains, and on the larger
patterns within which it is
contained.”
– Christopher Alexander
13
SMALL
PUBLIC
SQUARE
STREET CAFES
OPENING TO
THE STREET
DIFFERENT
CHAIRS
ACTIVITY
NODES
Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
SOFTWARE PATTERNS
14
History of patterns and Japan
C. Alexander: A Pattern Language for Building
K. Beck and W. Cunningham: Application of pattern language
to software at OOPSLA
E. Gamma: Doctoral thesis on object-oriented design patterns
E. Gamma et al.: Design Patterns
PLoP conference started
(Many books on patterns)
Japan PLoP started as study meetings
IPSJ SIGSE Patterns WG
1979
1987
1990
1995
1994
2003
AsianPLoP conference started2010
1999
(OOPSLA workshops)
Adapted from Takeshi Inoue, “Introduction to Patterns”, IPSJ SIGSE Patterns WG, 2003
16
Software pattern
• A pattern is a proven solution to a problem
in a software context.
• What software community adopted
– Tool for knowledge transfer and communication
– Pattern form: context-problem-solution
– Pattern catalog (and partially language..)
– Especially object-orientation community
• What software community did NOT adopt
– Common language among stakeholders
17What’s the problem?
class Mathematic {
public Data sort(Data data){
switch(settings) {
case QUICK:
return quickSort(data);
case BUBBLE:
return bubbleSort(data);
default: ...
}
}
class Loan {
public double capital() {
if(expiry == null &&
maturity != null)
return ...;
if(expiry != null &&
maturity == null) {
...
}
18
class Mathematic {
public Data sort(Data data){
switch(settings) {
case QUICK:
return quickSort(data);
case BUBBLE:
return bubbleSort(data);
default: ...
}
}
class Loan {
public double capital() {
if(expiry == null &&
maturity != null)
return ...;
if(expiry != null &&
maturity == null) {
...
}
class Mathematic {
Sorter sorter;
public Data sort(Data data){
return sorter.sort(data);
}
abstract class Sorter {
public abstract Data sort(Data);
class QuickSorter extends Sorter {
public Data sort(Data) { ... }
class Loan {
CapitalCalc capitalCalc;
public double capital(){
return capitalCalc.calc(this);
}
Interface CapitalCalc {
double calc(Loan l);
class TermCapital implements ...{
double calc(Loan l) { ... }
19STRATEGY
ContextContext StrategyStrategy
algorithmInterface()algorithmInterface()
ConcreteStrategyAConcreteStrategyA
algorithmInterface()algorithmInterface()
ConcreteStrategyBConcreteStrategyB
algorithmInterface()algorithmInterface()
・・・・・・
・・・・・・
contextInterface()contextInterface()
Structure
Motivation
If there are hard-wiring line breaking algorithms, clients get
bigger and harder to maintain. Moreover it becomes difficult to add
new algorithms and vary existing ones…
Applicability
Many related classes differ only in their behavior.
You need different variants of an algorithm…
Consequences
Benefits: families of algorithms , elimination of conditional statements…
Drawbacks: Communication overhead…
SolutionSolution
ProblemProblem
ContextContext
ForcesForces
E. Gamma, et al. “Design Patterns: Elements of Reusable
Object-Oriented Software,” Addison-Wesley, 1994.
20
Applying STRATEGY
MathematicMathematic SorterSorter
sort(Data)sort(Data)
QuickSorterQuickSorter
sort(Data)sort(Data)
BubbleSorterBubbleSorter
sort(Data)sort(Data)
・・・・・・
・・・・・・
ClientClient
sort(Data)
setSorter(Sorter)
sort(Data)
setSorter(Sorter)
Context
Strategy
ConcreteStrategy
class Client {
Mathematic math;
void init() {
math.setSorter(
new QuickSorter());
}
void calc() {
data = math.sort(data);
}
class Mathematic {
Sorter sorter;
public Data sort(Data data){
return sorter.sort(data);
}
abstract class Sorter {
public abstract Data sort(Data);
class QuickSorter extends Sorter {
public Data sort(Data) { ... }
21Benefit of patterns and
pattern form
• Reuse
– Solution
– Problem
• Communication
• Understanding
• Way of thinking
• Generative. New ideas!
22What’s going on?
interface MessageStrategy { public class HelloWorld {
public void sendMessage();                 public static void main(String[] args) {
} MessageBody mb =
new MessageBody();
abstract class AbstractStrategyFactory { mb.configure(“Hello World!”);
public abstract MessageStrategy
createStrategy(MessageBody mb); AbstractStrategyFactory asf
= DefaultFactory.getInstance();
class MessageBody { MessageStrategy strategy
object payload; = asf.createStrategy(mb);
public Object getPayload() { mb.send(strategy);
return payload; }
} }
public void configure(Object obj) {
payload obj;
}
public void send(MessageStrategy ms) {
ms.sendMessage();
}
}
class DefaultFactory extends AbstractStrategyFactory {
private DefaultFactory() {}
static DefaultFactory instance;
public static AbstractStrategyFactory getInstance() {
if(instance == null) instance = new DefaultFactory();
return instance;
}
public MessageStrategy createStrategy(final MessageBody mb) {
return new MessageStrategy() {
MessageBody body = mb;
public void sendMessage() {
Object obj = body.getPayload();
System.out.println(obj);
}   }; }   }
Joshua Kerievsky, "Refactoring to Patterns," Addison-Wesley, 2004.
23
Pitfall of software patterns
• “Only solution is important.”
– Context, problem and forces are most important!
• “Should use as it is.”
– There could be variants.
• “Always beneficial.”
– Misuse leads to bad complexity and defects.
• “Should use at the beginning.”
– Simple design at the beginning, and refactor it!
24
E.g. Replace Conditional Logic with STRATEGY
MathematicMathematic SorterSorter
sort(Data)sort(Data)
QuickSorterQuickSorter
sort(Data)sort(Data)
BubbleSorterBubbleSorter
sort(Data)sort(Data)
・・・・・・
・・・・・・
ClientClient
sort(Data)sort(Data)
Replace Conditional with
Polymorphism
MathematicMathematicClientClient
sort(Data)sort(Data)
MathematicMathematicClientClient
sort(Data)sort(Data)
SorterSorter
sort(Data)sort(Data)
Move method
if ...
else ...
if ...
else ...
Joshua Kerievsky, "Refactoring to Patterns," Addison-Wesley, 2004.
Pattern catalogs and languages
• Product patterns
– “Analysis patterns” (M. Fowler)
– “Pattern-Oriented Software Architecture” (Bushmann et al)
– “Design Patterns: Elements of Reusable Object-Oriented Software”
(Gamma et al.)
– “Implementation patterns” (Beck)
– “xUnit Test Patterns” (Meszaros)
– “Object-Oriented Reengineering Patterns” (Nierstrasz et al)
• Process and organizational patterns
– “EPISODE” (Cunningham)
– "A Generative Development-Process Pattern Language” (Coplien)
– "Organizational Patterns of Agile Software Development“ (Coplien and
Harrison)
• Links to catalogs
– “Pattern almanac” (Linda Rising)
– Portland Pattern Repository (Cunningham http://c2.com/ppr/) 25
Network in Portland Pattern
Repository
Pattern name
N.
patterns
referred
by the
pattern
N.
patterns
referring
to the
pattern
ModelViewController 11 12
AdapterPattern 6 15
HandleBodyPattern 9 10
SynchronizationStrategies 9 9
VisitorPattern 7 11
SceneGraph 6 11
ValueObject 3 14
ScapeGoat 6 10
CompositePattern 4 12
StrategyPattern 5 11
26
Hironori Washizaki, Masashi Kadoya, Yoshiaki Fukazawa and Takeshi Kawamura, “Network Analysis
for Software Patterns including Organizational Patterns in Portland Pattern Repository,” Agile 2014
Conference (to appear)
27
ENGAGE CUSTOMERS
• ...an organization is in place,
and its Quality Assurance
function has been generally
shaped and chartered…
• It's important that the
development
organization ensures and
maintains customer
satisfaction by
encouraging communication
between customers and key
development organization
roles…
• Closely couple the Customer
role to the Developer and
Architect, not just to QA or
marketing…James O. Coplien, Neil B. Harrison, "Organizational Patterns
of Agile Software Development", Prentice Hall, 2004.
James O. Coplien, "A
Development Process
Generative Pattern
Language," PLoPD
From patterns to Agile development
Pattern languageTakeuchi
The New New
Development
Game, 1986
Design patterns
OO patterns
A Generative Development-
Process Pattern Language EPISODE
XPScrum
Kenji Hiranabe: From Software Patterns to Agile Movements
http://www.infoq.com/jp/articles/AlexanderFestaReport
WRITING PATTERNS
29
Light-weight pattern writing
1. Individual: write down good experiments or
important things.
2. Team: brainstorming
– Grouping, relating
– Add, modify
1. Team: write in pattern form from important
groups
– (1) Write context and resulting context
– (2) Write context, problem and solution
– (3) Identify forces
– (4) Name it! 30
E.g. Self continuing
education
I can study while
commuting because
of no interruption..
I always carry short
literature for little
vacant time…
Smartphone
for free
time…
Study group
meetings on
Fridays…
Wake up early
to …
Plan reading
groups in my
company…
I set concrete
goals in 1, 5, 10
years…
CARRYING SHORT LITERATURE
Context
You want to enrich your knowledge
in an additional and unfamiliar area
by reading some literatures.
Problem
You are too busy to make time for
studying at your home and office.
Forces
-Making time specific for study will
sacrifice your family considerations
and business.
-There are a number of discrete
short times during your
commuting…
Solution
Select short literatures and carry
them at all times so that you could
read them even in short time
during commuting.
Resulting Context
You are now enriching your
knowledge continuously!
32
From patterns to pattern languages
• Connect related
patterns
– X is similar to Y.
– X uses Y in its
solution.
– X can be combined
with Y.
• Identify surrounding
patterns
ACCUMULATION OF
COMMUTING HOURS
SPLITTING FAT
BOOKS
CARRYING
SHORT
LITERATURE
CARRYING
E-BOOK
READER
BOOK
SCANNING
33
Summary
• Pattern: a proven solution to a problem in a
software context.
• Pattern form: context, problem, forces,
solution, resulting context
• Pattern Language: individual patterns are
useful, but they are most powerful when
combined into a language. (Alexander)
• Benefit and pitfall of patterns
• Various software patterns: design patterns and
organizational patterns
• Writing your own patterns: easy and fun!

More Related Content

PPTX
Robie House and Bradley House by Sir F.L.Wright
PPTX
Hassan fathy
PPTX
Peter behrens werkbund
PPT
Philosophies of f l wright
PPTX
Falling water
PPTX
Basic Structural System
PPTX
B.V. DOSHI
PPTX
Richard roger
Robie House and Bradley House by Sir F.L.Wright
Hassan fathy
Peter behrens werkbund
Philosophies of f l wright
Falling water
Basic Structural System
B.V. DOSHI
Richard roger

What's hot (20)

PDF
Walter Gropius: Biography, Phylosophy, Works and The Bauhaus
PPTX
Falling water
PPTX
Presentation1: Surry Hills Community Centre and Library
PPT
Ar. Raj rewal
PDF
F.L. Wright - Architecture
PDF
Swiss re building london
PPTX
Raj rewal
PDF
Farnsworth house Construction Details
PDF
case study of residential buildings
PPTX
Modernism in europe auguste perret
PPTX
Schroder house
PPTX
Antoni gaudi ppt
PPTX
CHARLES MOORE
PPT
Le corbusier
PPTX
Darpana academy performing arts, Ahemdabad vernacular ARCHITECTURE
PDF
Walter gropius
PDF
Qatar National Library
PDF
The Gherkin.
Walter Gropius: Biography, Phylosophy, Works and The Bauhaus
Falling water
Presentation1: Surry Hills Community Centre and Library
Ar. Raj rewal
F.L. Wright - Architecture
Swiss re building london
Raj rewal
Farnsworth house Construction Details
case study of residential buildings
Modernism in europe auguste perret
Schroder house
Antoni gaudi ppt
CHARLES MOORE
Le corbusier
Darpana academy performing arts, Ahemdabad vernacular ARCHITECTURE
Walter gropius
Qatar National Library
The Gherkin.
Ad

Viewers also liked (20)

PDF
Arm yourself with Domain Driven Security. It's time to slay some security trolls
PPTX
2013 Scrum Gathering Keynote: Buy or build — where did your agile come from?
PPTX
Secrets of Scrum
PDF
Scrum Patterns: The New Defacto Scrum Standard
PDF
2015 09 22 Rivanazzano CRS
PDF
Brochure Institucional Estilo-Web.Net
PDF
Apostila ms project 2007 - pet eng. civil ufpr
PDF
01002254 Chison 8800
PDF
Ziveti sa hiv om vodic
PPT
Marketing Cultural. Gabriel Klein. 2014
PPT
cv viajar por Europa
PPT
The 8 Rules Of E Mail Marketing
PDF
Gatopardo Ecuador Agosto 2012
PDF
Aftm openbooking 20140602 paris vf
PDF
Dec 13th qb d in research tel aviv conference preliminary program v7
DOC
Folleto informativo 2013 seguridad nuclear
PPT
IP MULTIMEDIA SYSTEM
PDF
Arancione Maquila de Nómina - Payrolling 2011
PPTX
Protocolos de cifrado
Arm yourself with Domain Driven Security. It's time to slay some security trolls
2013 Scrum Gathering Keynote: Buy or build — where did your agile come from?
Secrets of Scrum
Scrum Patterns: The New Defacto Scrum Standard
2015 09 22 Rivanazzano CRS
Brochure Institucional Estilo-Web.Net
Apostila ms project 2007 - pet eng. civil ufpr
01002254 Chison 8800
Ziveti sa hiv om vodic
Marketing Cultural. Gabriel Klein. 2014
cv viajar por Europa
The 8 Rules Of E Mail Marketing
Gatopardo Ecuador Agosto 2012
Aftm openbooking 20140602 paris vf
Dec 13th qb d in research tel aviv conference preliminary program v7
Folleto informativo 2013 seguridad nuclear
IP MULTIMEDIA SYSTEM
Arancione Maquila de Nómina - Payrolling 2011
Protocolos de cifrado
Ad

Similar to Introduction to Patterns (miniPLoP@Taipei) (20)

PPTX
introduction of Object oriented programming
PDF
Scalable JavaScript Design Patterns
PPTX
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
PPTX
2009 Dotnet Information Day: More effective c#
PDF
Introduction to object oriented programming
PDF
Symmetry, Scala & Software -- Refresh Dublin October 2013
PPTX
Week 1 Welcome to 3D Vis
PPTX
OOP History and Core Concepts
PDF
Section1 compound data class
PDF
Design patterns in javascript
PPTX
Clean Code - Design Patterns and Best Practices for Bay.NET SF User Group (01...
PDF
PLaNet talk @ LKL Knowledge Seminar, 30 Jan, 2008
PDF
Some perspectives from the Astropy Project
PDF
Extensible RESTful Applications with Apache TinkerPop
PPTX
NUS PhD e-open day 2020
PDF
Build an App with Blindfold - Britt Barak
PPSX
Oop principles
PPTX
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
PDF
ActiveJDBC - ActiveRecord implementation in Java
PDF
Open event (Drupalcamp Sunderland 2015)
introduction of Object oriented programming
Scalable JavaScript Design Patterns
Clean Code - Design Patterns and Best Practices at Silicon Valley Code Camp
2009 Dotnet Information Day: More effective c#
Introduction to object oriented programming
Symmetry, Scala & Software -- Refresh Dublin October 2013
Week 1 Welcome to 3D Vis
OOP History and Core Concepts
Section1 compound data class
Design patterns in javascript
Clean Code - Design Patterns and Best Practices for Bay.NET SF User Group (01...
PLaNet talk @ LKL Knowledge Seminar, 30 Jan, 2008
Some perspectives from the Astropy Project
Extensible RESTful Applications with Apache TinkerPop
NUS PhD e-open day 2020
Build an App with Blindfold - Britt Barak
Oop principles
Big Data Analytics 3: Machine Learning to Engage the Customer, with Apache Sp...
ActiveJDBC - ActiveRecord implementation in Java
Open event (Drupalcamp Sunderland 2015)

More from Hironori Washizaki (20)

PDF
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
PDF
鷲崎弘宜, "AI/LLM時代のソフトウェエンジニアリング", 情報学科・専攻協議会 総会・研究会, 早稲田大学, 2025年7月26日
PDF
AI Software Engineering based on Multi-view Modeling and Engineering Patterns
PDF
SWEBOK Guide and Software Services Engineering Education
PDF
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
PDF
Landscape of Requirements Engineering for/by AI through Literature Review
PDF
鷲崎弘宜, "高品質なAIシステムの開発・運用のための"フレームワーク", eAIシンポジウム 2025年1月16日
PDF
AI/IoTをベースにしたDX人材育成の産学連携育成, 愛媛県デジタル人材育成シンポジウム, 2024年12月20日
PDF
コンピューティングおよびソフトウェア工学の潮流: IEEE-CS技術予測&SWEBOK Guideに基づくAI・アジャイル・サステナビリティの展望
PDF
Impact of IEEE Computer Society in Advancing Software Engineering and Emergin...
PDF
鷲崎弘宜, "機械学習システムの多面的モデリング・パイプライン統合フレームワーク", 第6回 AI/IoTシステム安全性シンポジウム, 2024
PDF
IEEE Software Testing Technology Development Trend
PDF
Opening, 1st International Workshop on Patterns and Practices of Reliable AI ...
PDF
The Global Impact of IEEE Computer Society in Advancing Software Engineering ...
PDF
Overview of ISO/IEC/JTC1 SC7/WG20: Certification of software and systems engi...
PDF
IEEE Computer Society 2025 Vision and Future
PDF
次世代AI時代のトレンドと高信頼AIソフトウェアシステム開発に向けたフレームワーク&パターン
PDF
「スマートエスイー」におけるスマートシステム&サービスおよびDX推進人材の産学連携育成ならびに参照モデルに基づく育成プログラム分析
PDF
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
PDF
SWEBOK and Education at FUSE Okinawa 2024
IEEE-CS Tech Predictions, SWEBOK and Quantum Software: Towards Q-SWEBOK
鷲崎弘宜, "AI/LLM時代のソフトウェエンジニアリング", 情報学科・専攻協議会 総会・研究会, 早稲田大学, 2025年7月26日
AI Software Engineering based on Multi-view Modeling and Engineering Patterns
SWEBOK Guide and Software Services Engineering Education
Impact of IEEE Computer Society in Advancing Emerging Technologies including ...
Landscape of Requirements Engineering for/by AI through Literature Review
鷲崎弘宜, "高品質なAIシステムの開発・運用のための"フレームワーク", eAIシンポジウム 2025年1月16日
AI/IoTをベースにしたDX人材育成の産学連携育成, 愛媛県デジタル人材育成シンポジウム, 2024年12月20日
コンピューティングおよびソフトウェア工学の潮流: IEEE-CS技術予測&SWEBOK Guideに基づくAI・アジャイル・サステナビリティの展望
Impact of IEEE Computer Society in Advancing Software Engineering and Emergin...
鷲崎弘宜, "機械学習システムの多面的モデリング・パイプライン統合フレームワーク", 第6回 AI/IoTシステム安全性シンポジウム, 2024
IEEE Software Testing Technology Development Trend
Opening, 1st International Workshop on Patterns and Practices of Reliable AI ...
The Global Impact of IEEE Computer Society in Advancing Software Engineering ...
Overview of ISO/IEC/JTC1 SC7/WG20: Certification of software and systems engi...
IEEE Computer Society 2025 Vision and Future
次世代AI時代のトレンドと高信頼AIソフトウェアシステム開発に向けたフレームワーク&パターン
「スマートエスイー」におけるスマートシステム&サービスおよびDX推進人材の産学連携育成ならびに参照モデルに基づく育成プログラム分析
COMPSAC 2024 D&I Panel: Charting a Course for Equity: Strategies for Overcomi...
SWEBOK and Education at FUSE Okinawa 2024

Recently uploaded (20)

PPTX
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
PPTX
Why Generative AI is the Future of Content, Code & Creativity?
PDF
top salesforce developer skills in 2025.pdf
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
PDF
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
PDF
Upgrade and Innovation Strategies for SAP ERP Customers
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PPTX
Transform Your Business with a Software ERP System
PPTX
Odoo POS Development Services by CandidRoot Solutions
PDF
How to Choose the Right IT Partner for Your Business in Malaysia
PPTX
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
assetexplorer- product-overview - presentation
PDF
iTop VPN Free 5.6.0.5262 Crack latest version 2025
PDF
Wondershare Filmora 15 Crack With Activation Key [2025
PDF
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Navsoft: AI-Powered Business Solutions & Custom Software Development
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Lecture 3: Operating Systems Introduction to Computer Hardware Systems
Why Generative AI is the Future of Content, Code & Creativity?
top salesforce developer skills in 2025.pdf
Design an Analysis of Algorithms II-SECS-1021-03
SAP S4 Hana Brochure 3 (PTS SYSTEMS AND SOLUTIONS)
Claude Code: Everyone is a 10x Developer - A Comprehensive AI-Powered CLI Tool
Upgrade and Innovation Strategies for SAP ERP Customers
Internet Downloader Manager (IDM) Crack 6.42 Build 41
Transform Your Business with a Software ERP System
Odoo POS Development Services by CandidRoot Solutions
How to Choose the Right IT Partner for Your Business in Malaysia
Agentic AI : A Practical Guide. Undersating, Implementing and Scaling Autono...
Design an Analysis of Algorithms I-SECS-1021-03
assetexplorer- product-overview - presentation
iTop VPN Free 5.6.0.5262 Crack latest version 2025
Wondershare Filmora 15 Crack With Activation Key [2025
Why TechBuilder is the Future of Pickup and Delivery App Development (1).pdf
Computer Software and OS of computer science of grade 11.pptx
Navsoft: AI-Powered Business Solutions & Custom Software Development
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx

Introduction to Patterns (miniPLoP@Taipei)

  • 1. Introduction to Patterns Hironori Washizaki Waseda University Twitter: @Hiro_Washi washizaki@waseda.jp http://www.washi.cs.waseda.ac.jp/
  • 2. Agenda • Patterns and Pattern Languages • Software Patterns • Writing Patterns 2
  • 5. Repetition, and, not a coincidence. • Small public squares • Street cafes • Live! Active! Positive! 5
  • 6. What makes this repetition? 6 • Settings were common – Planning city structure and environment • Problems were common – Open and attractive city – Having places for people gathering and sitting lazily • Considerations were common – Not too large space – Not closed. => Common solution! SolutionSolution ProblemProblem ContextContext ForcesForces
  • 7. Pattern form • Context: when to consider? • Problem: what should be solved and when? • Forces: why the problem is hard? • Solution: what to do to solve problem? • Resulting context: both positive and negative 7 SolutionSolution ProblemProblem ContextContext ForcesForces Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
  • 8. SMALL PUBLIC SQUARES • … this pattern forms the core which makes an ACTIVITY NODE … it can also help to generate a PROMENADE, …, through the action of the people who gather there… • A town needs public squares; they are the largest, most public rooms, that the town has. But when they are too large, they look and feel deserted. • Make a public square much smaller than you would at first imagine… 8 SolutionSolution ProblemProblem ContextContext ForcesForces Christopher Alexander, et al., “A Pattern Language,“ Oxford University Press, 1977
  • 10. Alexander’s definition of patterns • Describes a problem that occurs over and over again in our environment • Describes the core of the solution to that problem • In such a way that you can use this solution a million times over without ever doing it the same way twice. • Both a process and a thing – both a description of a thing which is alive – and a description of the process which will generate that thing 10 Christopher Alexander, et al., “A Pattern Language,“ Oxford University Press, 1977 Christopher Alexander , “The Timeless Way of Building,” Oxford University Press, 1979 Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
  • 11. Quality Without A Name (QWAN) • “There is a central quality which is the root criterion of life and spirit in a man, a town, a building, or a wilderness. This quality is objective and precise, but it cannot be named.” – Christopher Alexander • Message from C. Alexander 11 Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
  • 12. Thinking and communications by patterns … OK, so, to attract many people to our city, SMALL PUBLIC SQUAREs should be located in the center. At the SMALL PUBLIC SQUARE, make STREET CAFES be OPNENING TO THE STREET... 12 BuildingBuilding Street Public square Cafe
  • 13. Pattern Language • “A collection of patterns and the rules to combine them into an architectural style.” – James O. Coplien • “Each pattern then, depends both on the smaller patterns it contains, and on the larger patterns within which it is contained.” – Christopher Alexander 13 SMALL PUBLIC SQUARE STREET CAFES OPENING TO THE STREET DIFFERENT CHAIRS ACTIVITY NODES Adapted from Joseph Yoder, "AsianPLoP Pattern Bootcamp 2011"
  • 15. History of patterns and Japan C. Alexander: A Pattern Language for Building K. Beck and W. Cunningham: Application of pattern language to software at OOPSLA E. Gamma: Doctoral thesis on object-oriented design patterns E. Gamma et al.: Design Patterns PLoP conference started (Many books on patterns) Japan PLoP started as study meetings IPSJ SIGSE Patterns WG 1979 1987 1990 1995 1994 2003 AsianPLoP conference started2010 1999 (OOPSLA workshops) Adapted from Takeshi Inoue, “Introduction to Patterns”, IPSJ SIGSE Patterns WG, 2003
  • 16. 16 Software pattern • A pattern is a proven solution to a problem in a software context. • What software community adopted – Tool for knowledge transfer and communication – Pattern form: context-problem-solution – Pattern catalog (and partially language..) – Especially object-orientation community • What software community did NOT adopt – Common language among stakeholders
  • 17. 17What’s the problem? class Mathematic { public Data sort(Data data){ switch(settings) { case QUICK: return quickSort(data); case BUBBLE: return bubbleSort(data); default: ... } } class Loan { public double capital() { if(expiry == null && maturity != null) return ...; if(expiry != null && maturity == null) { ... }
  • 18. 18 class Mathematic { public Data sort(Data data){ switch(settings) { case QUICK: return quickSort(data); case BUBBLE: return bubbleSort(data); default: ... } } class Loan { public double capital() { if(expiry == null && maturity != null) return ...; if(expiry != null && maturity == null) { ... } class Mathematic { Sorter sorter; public Data sort(Data data){ return sorter.sort(data); } abstract class Sorter { public abstract Data sort(Data); class QuickSorter extends Sorter { public Data sort(Data) { ... } class Loan { CapitalCalc capitalCalc; public double capital(){ return capitalCalc.calc(this); } Interface CapitalCalc { double calc(Loan l); class TermCapital implements ...{ double calc(Loan l) { ... }
  • 19. 19STRATEGY ContextContext StrategyStrategy algorithmInterface()algorithmInterface() ConcreteStrategyAConcreteStrategyA algorithmInterface()algorithmInterface() ConcreteStrategyBConcreteStrategyB algorithmInterface()algorithmInterface() ・・・・・・ ・・・・・・ contextInterface()contextInterface() Structure Motivation If there are hard-wiring line breaking algorithms, clients get bigger and harder to maintain. Moreover it becomes difficult to add new algorithms and vary existing ones… Applicability Many related classes differ only in their behavior. You need different variants of an algorithm… Consequences Benefits: families of algorithms , elimination of conditional statements… Drawbacks: Communication overhead… SolutionSolution ProblemProblem ContextContext ForcesForces E. Gamma, et al. “Design Patterns: Elements of Reusable Object-Oriented Software,” Addison-Wesley, 1994.
  • 20. 20 Applying STRATEGY MathematicMathematic SorterSorter sort(Data)sort(Data) QuickSorterQuickSorter sort(Data)sort(Data) BubbleSorterBubbleSorter sort(Data)sort(Data) ・・・・・・ ・・・・・・ ClientClient sort(Data) setSorter(Sorter) sort(Data) setSorter(Sorter) Context Strategy ConcreteStrategy class Client { Mathematic math; void init() { math.setSorter( new QuickSorter()); } void calc() { data = math.sort(data); } class Mathematic { Sorter sorter; public Data sort(Data data){ return sorter.sort(data); } abstract class Sorter { public abstract Data sort(Data); class QuickSorter extends Sorter { public Data sort(Data) { ... }
  • 21. 21Benefit of patterns and pattern form • Reuse – Solution – Problem • Communication • Understanding • Way of thinking • Generative. New ideas!
  • 22. 22What’s going on? interface MessageStrategy { public class HelloWorld { public void sendMessage();                 public static void main(String[] args) { } MessageBody mb = new MessageBody(); abstract class AbstractStrategyFactory { mb.configure(“Hello World!”); public abstract MessageStrategy createStrategy(MessageBody mb); AbstractStrategyFactory asf = DefaultFactory.getInstance(); class MessageBody { MessageStrategy strategy object payload; = asf.createStrategy(mb); public Object getPayload() { mb.send(strategy); return payload; } } } public void configure(Object obj) { payload obj; } public void send(MessageStrategy ms) { ms.sendMessage(); } } class DefaultFactory extends AbstractStrategyFactory { private DefaultFactory() {} static DefaultFactory instance; public static AbstractStrategyFactory getInstance() { if(instance == null) instance = new DefaultFactory(); return instance; } public MessageStrategy createStrategy(final MessageBody mb) { return new MessageStrategy() { MessageBody body = mb; public void sendMessage() { Object obj = body.getPayload(); System.out.println(obj); }   }; }   } Joshua Kerievsky, "Refactoring to Patterns," Addison-Wesley, 2004.
  • 23. 23 Pitfall of software patterns • “Only solution is important.” – Context, problem and forces are most important! • “Should use as it is.” – There could be variants. • “Always beneficial.” – Misuse leads to bad complexity and defects. • “Should use at the beginning.” – Simple design at the beginning, and refactor it!
  • 24. 24 E.g. Replace Conditional Logic with STRATEGY MathematicMathematic SorterSorter sort(Data)sort(Data) QuickSorterQuickSorter sort(Data)sort(Data) BubbleSorterBubbleSorter sort(Data)sort(Data) ・・・・・・ ・・・・・・ ClientClient sort(Data)sort(Data) Replace Conditional with Polymorphism MathematicMathematicClientClient sort(Data)sort(Data) MathematicMathematicClientClient sort(Data)sort(Data) SorterSorter sort(Data)sort(Data) Move method if ... else ... if ... else ... Joshua Kerievsky, "Refactoring to Patterns," Addison-Wesley, 2004.
  • 25. Pattern catalogs and languages • Product patterns – “Analysis patterns” (M. Fowler) – “Pattern-Oriented Software Architecture” (Bushmann et al) – “Design Patterns: Elements of Reusable Object-Oriented Software” (Gamma et al.) – “Implementation patterns” (Beck) – “xUnit Test Patterns” (Meszaros) – “Object-Oriented Reengineering Patterns” (Nierstrasz et al) • Process and organizational patterns – “EPISODE” (Cunningham) – "A Generative Development-Process Pattern Language” (Coplien) – "Organizational Patterns of Agile Software Development“ (Coplien and Harrison) • Links to catalogs – “Pattern almanac” (Linda Rising) – Portland Pattern Repository (Cunningham http://c2.com/ppr/) 25
  • 26. Network in Portland Pattern Repository Pattern name N. patterns referred by the pattern N. patterns referring to the pattern ModelViewController 11 12 AdapterPattern 6 15 HandleBodyPattern 9 10 SynchronizationStrategies 9 9 VisitorPattern 7 11 SceneGraph 6 11 ValueObject 3 14 ScapeGoat 6 10 CompositePattern 4 12 StrategyPattern 5 11 26 Hironori Washizaki, Masashi Kadoya, Yoshiaki Fukazawa and Takeshi Kawamura, “Network Analysis for Software Patterns including Organizational Patterns in Portland Pattern Repository,” Agile 2014 Conference (to appear)
  • 27. 27 ENGAGE CUSTOMERS • ...an organization is in place, and its Quality Assurance function has been generally shaped and chartered… • It's important that the development organization ensures and maintains customer satisfaction by encouraging communication between customers and key development organization roles… • Closely couple the Customer role to the Developer and Architect, not just to QA or marketing…James O. Coplien, Neil B. Harrison, "Organizational Patterns of Agile Software Development", Prentice Hall, 2004. James O. Coplien, "A Development Process Generative Pattern Language," PLoPD
  • 28. From patterns to Agile development Pattern languageTakeuchi The New New Development Game, 1986 Design patterns OO patterns A Generative Development- Process Pattern Language EPISODE XPScrum Kenji Hiranabe: From Software Patterns to Agile Movements http://www.infoq.com/jp/articles/AlexanderFestaReport
  • 30. Light-weight pattern writing 1. Individual: write down good experiments or important things. 2. Team: brainstorming – Grouping, relating – Add, modify 1. Team: write in pattern form from important groups – (1) Write context and resulting context – (2) Write context, problem and solution – (3) Identify forces – (4) Name it! 30
  • 31. E.g. Self continuing education I can study while commuting because of no interruption.. I always carry short literature for little vacant time… Smartphone for free time… Study group meetings on Fridays… Wake up early to … Plan reading groups in my company… I set concrete goals in 1, 5, 10 years… CARRYING SHORT LITERATURE Context You want to enrich your knowledge in an additional and unfamiliar area by reading some literatures. Problem You are too busy to make time for studying at your home and office. Forces -Making time specific for study will sacrifice your family considerations and business. -There are a number of discrete short times during your commuting… Solution Select short literatures and carry them at all times so that you could read them even in short time during commuting. Resulting Context You are now enriching your knowledge continuously!
  • 32. 32 From patterns to pattern languages • Connect related patterns – X is similar to Y. – X uses Y in its solution. – X can be combined with Y. • Identify surrounding patterns ACCUMULATION OF COMMUTING HOURS SPLITTING FAT BOOKS CARRYING SHORT LITERATURE CARRYING E-BOOK READER BOOK SCANNING
  • 33. 33 Summary • Pattern: a proven solution to a problem in a software context. • Pattern form: context, problem, forces, solution, resulting context • Pattern Language: individual patterns are useful, but they are most powerful when combined into a language. (Alexander) • Benefit and pitfall of patterns • Various software patterns: design patterns and organizational patterns • Writing your own patterns: easy and fun!