SlideShare une entreprise Scribd logo
1  sur  29
Télécharger pour lire hors ligne
Design
Patterns
for Fun &
Profit
David Litvak Bruno
@dlitvakb
Contentful
CoderCruise 2018
I’m David Litvak Bruno
I’ve been working with and teaching
Python and Ruby for the past 10 years
I currently work at Contentful in Berlin
as an Ecosystem Engineer creating
SDKs, tools and example apps using
Python, Ruby and Javascript.
Recent father of Julián
Who am I?
Before we start…
Some stuff we need to know
Static Typing
● Explicit typing contracts,
defined before compilation
time
● Typed references
● Immutable object
interfaces
Type Systems - Differences
Dynamic Typing
● Type defined through
usage, and not definition
● References are just names
for object instances and
don’t contain type
information
● Object interfaces are
mutable and can evolve
They are static
What tools do they provide?
● Strong, compile-time checked, interfaces
● Compile-time type safety (with the exception for null pointers)
● Limited runtime reflection capabilities
Type Systems - Java & C++
They are dynamic
What tools do they provide?
● Duck typing
● Code interception
● Introspection
● Reflection
● Self-modification
Type Systems - Python, Ruby &
Javascript
Dynamic Languages - Features
The features that allow us to “obsolete” traditional design patterns:
● Rich types
● Functions and classes as first-order objects
● Magic methods
○ Interceptors
○ Implementors
○ Introspectors
○ Constructors (Allocators)
● Contexts
● Multiple Inheritance
Late 70’s: Christopher Alexander’s: “A Pattern Language”
A bit of history
A bit of history
10 years later: Kent Beck and Ward Cunningham, started developing
a Pattern Language for Object Oriented Software and presented it at
OOPSLA
A bit of history
In 1994: The book that popularized design patterns
A bit of history
Throughout the following years: other literature started appearing
covering patterns for software architecture, testing, security and
other areas of software
Design Patterns
What’s a pattern?
We often found many problems with similar solutions, by analyzing it
we found that, even though all solutions are different, they all use
similar strategies to solve them.
Therefore, design patterns, are generalizations to those solutions for
common problems while designing software systems.
To explain design patterns, we need to specify 4 key items:
● Problem it solves
● Traditional usage
● Applicability
● Example implementation
A foreword of advise
Design Patterns - Categories
● Structural
○ Affect interaction of objects with the surrounding system
● Behavioural
○ Affect behaviour of objects
● Creational
○ Affect creation (or not) of objects
Proxy
What: Transparently intercepts all methods of an object to add
behaviour surrounding them.
How: Through composition and redefinition of the full interface.
When: An example usage is to add logging to every method call.
Design Patterns - Structural
Abstract Factory
What: Creates children objects of multiple different classes within a
family masking the actual implementation class.
How: Static method on an abstract base class that takes some
configuration and decides which implementation to use based on it. It
will return an instantiated object of a concrete child class.
When: An example usage is for instantiating an ORM which supports
different database engines and decides which one to use based on
the connection string.
Design Patterns - Creational
Iterator
What: Provides an interface for iterating through an object as if it
were a native collection.
How: Through implementation of an Iterable interface, limiting
heavily the scope of what an actual collection provides.
When: It’s typically used when internal structure is not relevant to be
exposed and it’s desired to be treated as a collection.
Design Patterns - Behavioural
Memento
What: Saves intermediate states to allow for replaying an object’s
history.
How: Usually through a persistence layer (in database or in memory)
tightly coupled with the implementation details of the concrete class.
When: When requiring some kind of change log, like a text editor’s
undo/redo, a games replay system or a web-browser’s history.
Design Patterns - Behavioural
Observer
What: Monitors state changes and signals interested object.
Composed of an event emitter (Observable) and an event listener
(Observer).
How: Observable objects register to observers. Observers
need to define a tightly coupled interface on how they are
supposed to trigger the received update event.
When: Commonly used in UI programming and when dealing
with database events and other components need notification
of interaction.
Design Patterns - Behavioural
State and Strategy
What: Runtime swap of object behaviour. Strategy applies to a single
method, while State applies to the whole class behaviour.
How: Object composition on a tightly coupled hierarchy.
When: In cases where objects need to change behaviour
depending on some object state, for example the calculation
formula of taxes on a purchase may differ from place to place.
Or a Person object could behave differently depending on
their age.
Design Patterns - Behavioural
By using dynamic languages, we obtain some superpowers and can
make extremely complex things simple.
Conclusion
Conclusion
Conclusion
Having access to these tools though, will broader your way of
thinking about problems and surface solutions you may not have
thought about before.
Step 1: Apply patterns
Step 2: ???
Step 3: Profit
Questions?
@dlitvakb
david.litvak@contentful.com
http://github.com/dlitvakb

Contenu connexe

Similaire à Design patterns for fun & profit - CoderCruise 2018

Benefits of using software design patterns and when to use design pattern
Benefits of using software design patterns and when to use design patternBenefits of using software design patterns and when to use design pattern
Benefits of using software design patterns and when to use design patternBeroza Paul
 
Modular Web Design With Components
Modular Web Design With ComponentsModular Web Design With Components
Modular Web Design With ComponentsNadal Soler
 
12266422.ppt
12266422.ppt12266422.ppt
12266422.pptCSEC5
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cfloraaluoch3
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityShubham Narkhede
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxanguraju1
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being DrivenAntonio Terreno
 
Nicholas Gustilo "Clean Android: building great mobile apps"
Nicholas Gustilo "Clean Android: building great mobile apps"Nicholas Gustilo "Clean Android: building great mobile apps"
Nicholas Gustilo "Clean Android: building great mobile apps"IT Event
 
Object Oriented Analysis
Object Oriented AnalysisObject Oriented Analysis
Object Oriented AnalysisAMITJain879
 
Design Patterns
Design PatternsDesign Patterns
Design Patternsimedo.de
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxDrYogeshDeshmukh1
 

Similaire à Design patterns for fun & profit - CoderCruise 2018 (20)

Benefits of using software design patterns and when to use design pattern
Benefits of using software design patterns and when to use design patternBenefits of using software design patterns and when to use design pattern
Benefits of using software design patterns and when to use design pattern
 
Modular Web Design With Components
Modular Web Design With ComponentsModular Web Design With Components
Modular Web Design With Components
 
Design patterns
Design patternsDesign patterns
Design patterns
 
12266422.ppt
12266422.ppt12266422.ppt
12266422.ppt
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in c
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
L05 Design Patterns
L05 Design PatternsL05 Design Patterns
L05 Design Patterns
 
Design Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur UniversityDesign Pattern Notes: Nagpur University
Design Pattern Notes: Nagpur University
 
Design Patterns in Ruby
Design Patterns in RubyDesign Patterns in Ruby
Design Patterns in Ruby
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
UNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptxUNIT IV DESIGN PATTERNS.pptx
UNIT IV DESIGN PATTERNS.pptx
 
L03 Design Patterns
L03 Design PatternsL03 Design Patterns
L03 Design Patterns
 
Design_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.pptDesign_Patterns_Dr.CM.ppt
Design_Patterns_Dr.CM.ppt
 
Importance Of Being Driven
Importance Of Being DrivenImportance Of Being Driven
Importance Of Being Driven
 
Nicholas Gustilo "Clean Android: building great mobile apps"
Nicholas Gustilo "Clean Android: building great mobile apps"Nicholas Gustilo "Clean Android: building great mobile apps"
Nicholas Gustilo "Clean Android: building great mobile apps"
 
Object Oriented Analysis
Object Oriented AnalysisObject Oriented Analysis
Object Oriented Analysis
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptx
 

Dernier

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationkaushalgiri8080
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...kellynguyen01
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number SystemsJheuzeDellosa
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfkalichargn70th171
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 

Dernier (20)

Project Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanationProject Based Learning (A.I).pptx detail explanation
Project Based Learning (A.I).pptx detail explanation
 
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
Short Story: Unveiling the Reasoning Abilities of Large Language Models by Ke...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
What is Binary Language? Computer Number Systems
What is Binary Language?  Computer Number SystemsWhat is Binary Language?  Computer Number Systems
What is Binary Language? Computer Number Systems
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdfLearn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
Learn the Fundamentals of XCUITest Framework_ A Beginner's Guide.pdf
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

Design patterns for fun & profit - CoderCruise 2018

  • 1. Design Patterns for Fun & Profit David Litvak Bruno @dlitvakb Contentful CoderCruise 2018
  • 2. I’m David Litvak Bruno I’ve been working with and teaching Python and Ruby for the past 10 years I currently work at Contentful in Berlin as an Ecosystem Engineer creating SDKs, tools and example apps using Python, Ruby and Javascript. Recent father of Julián Who am I?
  • 3. Before we start… Some stuff we need to know
  • 4. Static Typing ● Explicit typing contracts, defined before compilation time ● Typed references ● Immutable object interfaces Type Systems - Differences Dynamic Typing ● Type defined through usage, and not definition ● References are just names for object instances and don’t contain type information ● Object interfaces are mutable and can evolve
  • 5. They are static What tools do they provide? ● Strong, compile-time checked, interfaces ● Compile-time type safety (with the exception for null pointers) ● Limited runtime reflection capabilities Type Systems - Java & C++
  • 6.
  • 7. They are dynamic What tools do they provide? ● Duck typing ● Code interception ● Introspection ● Reflection ● Self-modification Type Systems - Python, Ruby & Javascript
  • 8.
  • 9. Dynamic Languages - Features The features that allow us to “obsolete” traditional design patterns: ● Rich types ● Functions and classes as first-order objects ● Magic methods ○ Interceptors ○ Implementors ○ Introspectors ○ Constructors (Allocators) ● Contexts ● Multiple Inheritance
  • 10. Late 70’s: Christopher Alexander’s: “A Pattern Language” A bit of history
  • 11. A bit of history 10 years later: Kent Beck and Ward Cunningham, started developing a Pattern Language for Object Oriented Software and presented it at OOPSLA
  • 12. A bit of history In 1994: The book that popularized design patterns
  • 13. A bit of history Throughout the following years: other literature started appearing covering patterns for software architecture, testing, security and other areas of software
  • 14. Design Patterns What’s a pattern? We often found many problems with similar solutions, by analyzing it we found that, even though all solutions are different, they all use similar strategies to solve them. Therefore, design patterns, are generalizations to those solutions for common problems while designing software systems. To explain design patterns, we need to specify 4 key items: ● Problem it solves ● Traditional usage ● Applicability ● Example implementation
  • 15.
  • 16. A foreword of advise
  • 17.
  • 18. Design Patterns - Categories ● Structural ○ Affect interaction of objects with the surrounding system ● Behavioural ○ Affect behaviour of objects ● Creational ○ Affect creation (or not) of objects
  • 19. Proxy What: Transparently intercepts all methods of an object to add behaviour surrounding them. How: Through composition and redefinition of the full interface. When: An example usage is to add logging to every method call. Design Patterns - Structural
  • 20. Abstract Factory What: Creates children objects of multiple different classes within a family masking the actual implementation class. How: Static method on an abstract base class that takes some configuration and decides which implementation to use based on it. It will return an instantiated object of a concrete child class. When: An example usage is for instantiating an ORM which supports different database engines and decides which one to use based on the connection string. Design Patterns - Creational
  • 21. Iterator What: Provides an interface for iterating through an object as if it were a native collection. How: Through implementation of an Iterable interface, limiting heavily the scope of what an actual collection provides. When: It’s typically used when internal structure is not relevant to be exposed and it’s desired to be treated as a collection. Design Patterns - Behavioural
  • 22. Memento What: Saves intermediate states to allow for replaying an object’s history. How: Usually through a persistence layer (in database or in memory) tightly coupled with the implementation details of the concrete class. When: When requiring some kind of change log, like a text editor’s undo/redo, a games replay system or a web-browser’s history. Design Patterns - Behavioural
  • 23. Observer What: Monitors state changes and signals interested object. Composed of an event emitter (Observable) and an event listener (Observer). How: Observable objects register to observers. Observers need to define a tightly coupled interface on how they are supposed to trigger the received update event. When: Commonly used in UI programming and when dealing with database events and other components need notification of interaction. Design Patterns - Behavioural
  • 24. State and Strategy What: Runtime swap of object behaviour. Strategy applies to a single method, while State applies to the whole class behaviour. How: Object composition on a tightly coupled hierarchy. When: In cases where objects need to change behaviour depending on some object state, for example the calculation formula of taxes on a purchase may differ from place to place. Or a Person object could behave differently depending on their age. Design Patterns - Behavioural
  • 25. By using dynamic languages, we obtain some superpowers and can make extremely complex things simple. Conclusion
  • 27. Conclusion Having access to these tools though, will broader your way of thinking about problems and surface solutions you may not have thought about before.
  • 28. Step 1: Apply patterns Step 2: ??? Step 3: Profit