SlideShare a Scribd company logo
1 of 13
Download to read offline
Singleton is not the only
        pattern
               Seb Rose
Software Architect – Requirements Management
           Rational IBM, Edinburgh
A typical CV
The Gang of Four
● Patterns first popularised by Design
  Patterns
  Erich Gamma, Richard Helm, Ralph
  Johnson, John Vlissides
● Published 1995
More followed …
Where did it all
      start?
● Christopher Alexander (1936 -)
● Chemistry & Physics, Trinity, Cambridge,
  1957
● Ph.D. Architecture, Harvard (1st ever
  awarded)
● Professor Architecture, Berkley, 1963
● “Notes on the synthesis of form”, 1964
● First Gold Medal Research, American
  Institute of Architects, 1972
● “A Pattern Language”, 1977
Alexandrian Form
● Picture – archetypical example
● Introductory paragraph - context
● Headline (in bold) – essence of problem
● Body – background, motivation, variations
● Solution (in bold)
● Diagram (of solution)
● [Smaller] related patterns
The Hillside Group
● Promotes patterns in software community
● Formed 1993 by Ward Cunningham,
  Ralph Johnson, Ken Auer, Hal
  Hildebrand, Grady Booch, Kent Beck and
  Jim Coplien
● Cunningham invented Wiki to discuss
  patterns
● Sponsors PLoP conferences & books
● Hillside Group: www.hillside.net
● WikiWikiWeb: www.c2.com
Canonical [GoF] Form
● Name
● Alias(es) [Also known as]
● Context [Applicability]
● Problem [Intent]
● Forces [Motivation]
● Solution [Participants, Structure,
  Collaborations, Implementation]
● Example (optional) [Sample code]
● Resulting context [Consequences]
● Rationale (optional)
● Known uses
● Related patterns
Pattern Languages
● Structured method of describing good
  design practices within a field of expertise
● A network of patterns that call upon one
  another
● Help the designer move from problem to
  problem in a logical way
● Allow for many different paths through the
  design process
Pattern Sequences
● Pattern languages are played out as
  sequences
● Sequences show paths through a
  language
● Commonly illustrated through stories
● Give rise to common design fragments
● Can be shown diagrammatically, or as a
  list
And so, back to Singleton
● “Ensure a class has only one instance, and
  provide a global point of access to it.” – GoF,
  1995
● “[Singleton] invariably causes problems with
  coupling and execution, and is more than a
  little overused” – Henney, 2005
● “How do you provide global variables in
  languages without global variables? Don't.
  Your programs will thank you for taking the
  time to think about design instead.” – Kent
  Beck, 2003
An Alternative
You have this system...
  ● You try globals... well, probably you don't: the one thing you
    learned in school was no globals.
  ● You try for SINGLETON, it is in the book, it is good... but then you
    find you have these nasty ripples... then someone tells you it's a
    bad thing and it's obvious to you.
  ● So you try passing parameters: they overwhelm you.
  ● You refactor a bit (à la Fowler) and before you know it you've got
    ENCAPSULATED CONTEXT.
  ● You carry on down this path, you get more mileage here, but over
    time it starts to look like Foote's BIG BALL OF MUD.
The solution is to reduce the coupling, improve the cohesion, but how?
                                                         Allan Kelly, 2005
Context Encapsulation
             Pattern Language




“Context Encapsulation: Three Stories, a Language and Some Sequences”
                                                    Kevlin Henney, 2006

http://www.two-sdg.demon.co.uk/curbralan/papers/europlop/ContextEncapsulation.pdf

More Related Content

Similar to Singleton is not_the_only_pattern

downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Hiroshi Ono
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Hiroshi Ono
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Hiroshi Ono
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
Hiroshi Ono
 
Clil theory diapos per mindmap
Clil theory   diapos per mindmapClil theory   diapos per mindmap
Clil theory diapos per mindmap
jalberi2
 
Clil theory
Clil theoryClil theory
Clil theory
jalberi2
 
EPFL - PxS, week 3 - creative design
EPFL - PxS, week 3 - creative designEPFL - PxS, week 3 - creative design
EPFL - PxS, week 3 - creative design
hendrikknoche
 
Using corpora in instruction
Using corpora in instructionUsing corpora in instruction
Using corpora in instruction
Jonathan Smart
 

Similar to Singleton is not_the_only_pattern (20)

Discovering patterns
Discovering patternsDiscovering patterns
Discovering patterns
 
Design Patterns.ppt
Design Patterns.pptDesign Patterns.ppt
Design Patterns.ppt
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
 
downey08semaphores.pdf
downey08semaphores.pdfdowney08semaphores.pdf
downey08semaphores.pdf
 
Prewriting techniques
Prewriting techniquesPrewriting techniques
Prewriting techniques
 
A Timeless Way of Communicating: Alexandrian Pattern Languages
A Timeless Way of Communicating: Alexandrian Pattern LanguagesA Timeless Way of Communicating: Alexandrian Pattern Languages
A Timeless Way of Communicating: Alexandrian Pattern Languages
 
Design Patterns (by Joel Funu at DevCongress 2013)
Design Patterns (by Joel Funu at DevCongress 2013)Design Patterns (by Joel Funu at DevCongress 2013)
Design Patterns (by Joel Funu at DevCongress 2013)
 
How2research
How2researchHow2research
How2research
 
Academic writing
Academic writingAcademic writing
Academic writing
 
Clil theory diapos per mindmap
Clil theory   diapos per mindmapClil theory   diapos per mindmap
Clil theory diapos per mindmap
 
Clil theory
Clil theoryClil theory
Clil theory
 
Ontology Design Patterns for Linked Data Tutorial at ISWC2016 - Introduction
Ontology Design Patterns for Linked Data Tutorial at ISWC2016 - IntroductionOntology Design Patterns for Linked Data Tutorial at ISWC2016 - Introduction
Ontology Design Patterns for Linked Data Tutorial at ISWC2016 - Introduction
 
Design Patterns Story
Design Patterns StoryDesign Patterns Story
Design Patterns Story
 
EPFL - PxS, week 3 - creative design
EPFL - PxS, week 3 - creative designEPFL - PxS, week 3 - creative design
EPFL - PxS, week 3 - creative design
 
Using corpora in instruction
Using corpora in instructionUsing corpora in instruction
Using corpora in instruction
 
Let's study literature with IT! ideas, projects and tasks.
Let's study literature with IT! ideas, projects and tasks.Let's study literature with IT! ideas, projects and tasks.
Let's study literature with IT! ideas, projects and tasks.
 
Instructions: Student mini-projects - F.Flöck - ESWC SS 2014
Instructions: Student mini-projects - F.Flöck - ESWC SS 2014 Instructions: Student mini-projects - F.Flöck - ESWC SS 2014
Instructions: Student mini-projects - F.Flöck - ESWC SS 2014
 
Design Patterns in Swift ch0 Introduction
Design Patterns in Swift ch0 IntroductionDesign Patterns in Swift ch0 Introduction
Design Patterns in Swift ch0 Introduction
 

More from Seb Rose

Software testing - learning to walk again (expoQA22)
Software testing - learning to walk again (expoQA22)Software testing - learning to walk again (expoQA22)
Software testing - learning to walk again (expoQA22)
Seb Rose
 
Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...
Seb Rose
 

More from Seb Rose (20)

Software contracts - Global Enterprise Agile 2023.pdf
Software contracts - Global Enterprise Agile 2023.pdfSoftware contracts - Global Enterprise Agile 2023.pdf
Software contracts - Global Enterprise Agile 2023.pdf
 
Micro-service delivery - without the pitfalls
Micro-service delivery - without the pitfallsMicro-service delivery - without the pitfalls
Micro-service delivery - without the pitfalls
 
DevSecOps - Agile Get-Together 2022.pdf
DevSecOps - Agile Get-Together 2022.pdfDevSecOps - Agile Get-Together 2022.pdf
DevSecOps - Agile Get-Together 2022.pdf
 
Contract testing - Sealights 2022.pdf
Contract testing - Sealights 2022.pdfContract testing - Sealights 2022.pdf
Contract testing - Sealights 2022.pdf
 
Example mapping - slice any story into testable examples - SoCraTes 2022.pdf
Example mapping - slice any story into testable examples - SoCraTes 2022.pdfExample mapping - slice any story into testable examples - SoCraTes 2022.pdf
Example mapping - slice any story into testable examples - SoCraTes 2022.pdf
 
Software testing - learning to walk again (expoQA22)
Software testing - learning to walk again (expoQA22)Software testing - learning to walk again (expoQA22)
Software testing - learning to walk again (expoQA22)
 
DevSecOps - Unicom Agile and DevOps Expo (Adaptive Challenges) 2021
DevSecOps - Unicom Agile and DevOps Expo (Adaptive Challenges) 2021DevSecOps - Unicom Agile and DevOps Expo (Adaptive Challenges) 2021
DevSecOps - Unicom Agile and DevOps Expo (Adaptive Challenges) 2021
 
A brief history of requirements - Unicom 2022
A brief history of requirements  - Unicom 2022A brief history of requirements  - Unicom 2022
A brief history of requirements - Unicom 2022
 
Example mapping (with builds) - ProductWorld 2022
Example mapping (with builds)  - ProductWorld 2022Example mapping (with builds)  - ProductWorld 2022
Example mapping (with builds) - ProductWorld 2022
 
Example mapping - ProductWorld 2022
Example mapping - ProductWorld 2022Example mapping - ProductWorld 2022
Example mapping - ProductWorld 2022
 
No code, low code, machine code QA ATL 2021
No code, low code, machine code   QA ATL 2021No code, low code, machine code   QA ATL 2021
No code, low code, machine code QA ATL 2021
 
No code, low code, machine code QA ATL 2021
No code, low code, machine code   QA ATL 2021No code, low code, machine code   QA ATL 2021
No code, low code, machine code QA ATL 2021
 
No code, low code, machine code - Unicom 2021
No code, low code, machine code -  Unicom 2021No code, low code, machine code -  Unicom 2021
No code, low code, machine code - Unicom 2021
 
BDD: from soup to nuts - The Future of Work Scotland 2021
BDD: from soup to nuts  - The Future of Work Scotland 2021BDD: from soup to nuts  - The Future of Work Scotland 2021
BDD: from soup to nuts - The Future of Work Scotland 2021
 
Contrasting test automation and BDD - 2020
Contrasting test automation and BDD - 2020Contrasting test automation and BDD - 2020
Contrasting test automation and BDD - 2020
 
Are BDD and test automation the same thing? Automation Guild 2021
Are BDD and test automation the same thing?   Automation Guild 2021Are BDD and test automation the same thing?   Automation Guild 2021
Are BDD and test automation the same thing? Automation Guild 2021
 
"Our BDDs are broken!" Lean Agile Exchange 2020
"Our BDDs are broken!"   Lean Agile Exchange 2020"Our BDDs are broken!"   Lean Agile Exchange 2020
"Our BDDs are broken!" Lean Agile Exchange 2020
 
User stories: from good intentions to bad advice - Agile Scotland 2019
User stories: from good intentions to bad advice - Agile Scotland 2019User stories: from good intentions to bad advice - Agile Scotland 2019
User stories: from good intentions to bad advice - Agile Scotland 2019
 
User stories: from good intentions to bad advice - Lean Agile Scotland 2019
User stories: from good intentions to bad advice - Lean Agile Scotland 2019User stories: from good intentions to bad advice - Lean Agile Scotland 2019
User stories: from good intentions to bad advice - Lean Agile Scotland 2019
 
Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...Software contracts or: how I learned to stop worrying and love releasing. Agi...
Software contracts or: how I learned to stop worrying and love releasing. Agi...
 

Recently uploaded

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
WSO2
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Victor Rentea
 

Recently uploaded (20)

Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf[BuildWithAI] Introduction to Gemini.pdf
[BuildWithAI] Introduction to Gemini.pdf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
AI+A11Y 11MAY2024 HYDERBAD GAAD 2024 - HelloA11Y (11 May 2024)
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
Modular Monolith - a Practical Alternative to Microservices @ Devoxx UK 2024
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

Singleton is not_the_only_pattern

  • 1. Singleton is not the only pattern Seb Rose Software Architect – Requirements Management Rational IBM, Edinburgh
  • 3. The Gang of Four ● Patterns first popularised by Design Patterns Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides ● Published 1995
  • 5. Where did it all start? ● Christopher Alexander (1936 -) ● Chemistry & Physics, Trinity, Cambridge, 1957 ● Ph.D. Architecture, Harvard (1st ever awarded) ● Professor Architecture, Berkley, 1963 ● “Notes on the synthesis of form”, 1964 ● First Gold Medal Research, American Institute of Architects, 1972 ● “A Pattern Language”, 1977
  • 6. Alexandrian Form ● Picture – archetypical example ● Introductory paragraph - context ● Headline (in bold) – essence of problem ● Body – background, motivation, variations ● Solution (in bold) ● Diagram (of solution) ● [Smaller] related patterns
  • 7. The Hillside Group ● Promotes patterns in software community ● Formed 1993 by Ward Cunningham, Ralph Johnson, Ken Auer, Hal Hildebrand, Grady Booch, Kent Beck and Jim Coplien ● Cunningham invented Wiki to discuss patterns ● Sponsors PLoP conferences & books ● Hillside Group: www.hillside.net ● WikiWikiWeb: www.c2.com
  • 8. Canonical [GoF] Form ● Name ● Alias(es) [Also known as] ● Context [Applicability] ● Problem [Intent] ● Forces [Motivation] ● Solution [Participants, Structure, Collaborations, Implementation] ● Example (optional) [Sample code] ● Resulting context [Consequences] ● Rationale (optional) ● Known uses ● Related patterns
  • 9. Pattern Languages ● Structured method of describing good design practices within a field of expertise ● A network of patterns that call upon one another ● Help the designer move from problem to problem in a logical way ● Allow for many different paths through the design process
  • 10. Pattern Sequences ● Pattern languages are played out as sequences ● Sequences show paths through a language ● Commonly illustrated through stories ● Give rise to common design fragments ● Can be shown diagrammatically, or as a list
  • 11. And so, back to Singleton ● “Ensure a class has only one instance, and provide a global point of access to it.” – GoF, 1995 ● “[Singleton] invariably causes problems with coupling and execution, and is more than a little overused” – Henney, 2005 ● “How do you provide global variables in languages without global variables? Don't. Your programs will thank you for taking the time to think about design instead.” – Kent Beck, 2003
  • 12. An Alternative You have this system... ● You try globals... well, probably you don't: the one thing you learned in school was no globals. ● You try for SINGLETON, it is in the book, it is good... but then you find you have these nasty ripples... then someone tells you it's a bad thing and it's obvious to you. ● So you try passing parameters: they overwhelm you. ● You refactor a bit (à la Fowler) and before you know it you've got ENCAPSULATED CONTEXT. ● You carry on down this path, you get more mileage here, but over time it starts to look like Foote's BIG BALL OF MUD. The solution is to reduce the coupling, improve the cohesion, but how? Allan Kelly, 2005
  • 13. Context Encapsulation Pattern Language “Context Encapsulation: Three Stories, a Language and Some Sequences” Kevlin Henney, 2006 http://www.two-sdg.demon.co.uk/curbralan/papers/europlop/ContextEncapsulation.pdf