SlideShare una empresa de Scribd logo
1 de 21
Design Patterns Abhishek Chatterjee
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Introduction ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Coding practices ,[object Object],[object Object],[object Object],[object Object],What is beyond it?
Object Oriented Analysis and Design ,[object Object],[object Object]
Design Patterns – an intro ,[object Object],[object Object],[object Object]
An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() MallardDuck display() RedheadDuck display()  Lots of other types  of ducks
An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() fly() MallardDuck display() RedheadDuck display()  Lots of other types  of ducks
An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() fly() MallardDuck display() RedheadDuck display()  Lots of other types  of ducks
An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() fly() MallardDuck display() RedheadDuck display()  Yay!! I can fly too!!! RubberDuck display()
 
Hey Abbey-Shack…. If you want to try Monster.com’s resume services, now is the time.
Who is going to rescue me now? <<Interfaces>> !!! Yes!!! That’s it! I make an IFlyable interface and RubberDuck doesn’t get to implement it… MallardDuck <<IFlyable>> display() RedheadDuck <<IFlyable>> display()  RubberDuck //You can’t fly! display()  They can’t see me happy  
I… I… I… I have a Question! SimCorp simulates 50 ducks… are you saying you are going to write 50 fly methods? What if there is a change in flying style and it effects 20 ducks… will all 20 ducks change? I am losing money you know…
I thought she was non-technical… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Strategy Pattern in Action Duck quack() swim() abstract display() MallardDuck IFlyBehavior:FlyWithWings display() RubberDuck IFlyBehavior: DontFly  display()  IFlyBehavior fly() FlyWithWings FlyWithRocket DontFly
Inversion of Control – Dependency Injection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
The problem with that is… ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],So you thought I couldn’t fly? Wheeee… Look at my rocket boosters!
Constructor Injection ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Q & A
Thank You

Más contenido relacionado

Similar a Design patterns

Dsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaDsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaUgo Matrangolo
 
Control Structures08
Control Structures08Control Structures08
Control Structures08David Millard
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred CowsKevlin Henney
 
Javascript Memory leaks and Performance & Angular
Javascript Memory leaks and Performance & AngularJavascript Memory leaks and Performance & Angular
Javascript Memory leaks and Performance & AngularErik Guzman
 
New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - GreachHamletDRC
 
Why the Dark Side should use Swift and a SOLID Architecture
Why the Dark Side should use Swift and a SOLID ArchitectureWhy the Dark Side should use Swift and a SOLID Architecture
Why the Dark Side should use Swift and a SOLID ArchitectureJorge Ortiz
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred CowsKevlin Henney
 
Performance #6 threading
Performance #6  threadingPerformance #6  threading
Performance #6 threadingVitali Pekelis
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaKonrad Malawski
 
Does Java Have a Future After Version 8? (Belfast JUG April 2014)
Does Java Have a Future After Version 8? (Belfast JUG April 2014)Does Java Have a Future After Version 8? (Belfast JUG April 2014)
Does Java Have a Future After Version 8? (Belfast JUG April 2014)Garth Gilmour
 
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip CalçadoJustjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip CalçadoPaulo Silveira
 
TWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonTWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonCodemotion
 
Everything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQueryEverything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQueryDave Ross
 
Kotlin in practice
Kotlin in practiceKotlin in practice
Kotlin in practice彥彬 洪
 
When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)Uberto Barbini
 

Similar a Design patterns (20)

Dsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in ScalaDsug 05 02-15 - ScalDI - lightweight DI in Scala
Dsug 05 02-15 - ScalDI - lightweight DI in Scala
 
Control Structures08
Control Structures08Control Structures08
Control Structures08
 
GWT Extreme!
GWT Extreme!GWT Extreme!
GWT Extreme!
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
 
Javascript Memory leaks and Performance & Angular
Javascript Memory leaks and Performance & AngularJavascript Memory leaks and Performance & Angular
Javascript Memory leaks and Performance & Angular
 
New Ideas for Old Code - Greach
New Ideas for Old Code - GreachNew Ideas for Old Code - Greach
New Ideas for Old Code - Greach
 
Clojure And Swing
Clojure And SwingClojure And Swing
Clojure And Swing
 
Why the Dark Side should use Swift and a SOLID Architecture
Why the Dark Side should use Swift and a SOLID ArchitectureWhy the Dark Side should use Swift and a SOLID Architecture
Why the Dark Side should use Swift and a SOLID Architecture
 
Intro to AngularJs
Intro to AngularJsIntro to AngularJs
Intro to AngularJs
 
Making Steaks from Sacred Cows
Making Steaks from Sacred CowsMaking Steaks from Sacred Cows
Making Steaks from Sacred Cows
 
Performance #6 threading
Performance #6  threadingPerformance #6  threading
Performance #6 threading
 
The things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and AkkaThe things we don't see – stories of Software, Scala and Akka
The things we don't see – stories of Software, Scala and Akka
 
Does Java Have a Future After Version 8? (Belfast JUG April 2014)
Does Java Have a Future After Version 8? (Belfast JUG April 2014)Does Java Have a Future After Version 8? (Belfast JUG April 2014)
Does Java Have a Future After Version 8? (Belfast JUG April 2014)
 
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip CalçadoJustjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
Justjava 2007 Arquitetura Java EE Paulo Silveira, Phillip Calçado
 
Robots in Swift
Robots in SwiftRobots in Swift
Robots in Swift
 
TWINS: OOP and FP - Warburton
TWINS: OOP and FP - WarburtonTWINS: OOP and FP - Warburton
TWINS: OOP and FP - Warburton
 
Everything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQueryEverything You Need to Know in Order to Start Using jQuery
Everything You Need to Know in Order to Start Using jQuery
 
Kotlin in practice
Kotlin in practiceKotlin in practice
Kotlin in practice
 
When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)When Tdd Goes Awry (IAD 2013)
When Tdd Goes Awry (IAD 2013)
 
Anti Object-Oriented Design Patterns
Anti Object-Oriented Design PatternsAnti Object-Oriented Design Patterns
Anti Object-Oriented Design Patterns
 

Más de InfoBeans Technologies Ltd.

InfoBeans Mobile Practice Capabilities Presentation
InfoBeans Mobile Practice Capabilities PresentationInfoBeans Mobile Practice Capabilities Presentation
InfoBeans Mobile Practice Capabilities PresentationInfoBeans Technologies Ltd.
 
Cost of iPhone Apps - InfoBeans iPhone app development practice
Cost of iPhone Apps - InfoBeans iPhone app development practiceCost of iPhone Apps - InfoBeans iPhone app development practice
Cost of iPhone Apps - InfoBeans iPhone app development practiceInfoBeans Technologies Ltd.
 

Más de InfoBeans Technologies Ltd. (20)

InfoBeans - Star Performers of the Month
InfoBeans - Star Performers of the MonthInfoBeans - Star Performers of the Month
InfoBeans - Star Performers of the Month
 
InfoBeans - Star Performers of the Month
InfoBeans - Star Performers of the MonthInfoBeans - Star Performers of the Month
InfoBeans - Star Performers of the Month
 
Infobeansstarperformers 2017-18-19
Infobeansstarperformers 2017-18-19Infobeansstarperformers 2017-18-19
Infobeansstarperformers 2017-18-19
 
InfoBeans Star Performers 2017-18
InfoBeans Star Performers 2017-18InfoBeans Star Performers 2017-18
InfoBeans Star Performers 2017-18
 
InfoBeans Star Performers
InfoBeans Star PerformersInfoBeans Star Performers
InfoBeans Star Performers
 
InfoBeans corporate flyer
InfoBeans corporate flyerInfoBeans corporate flyer
InfoBeans corporate flyer
 
Info beans corporate flyer fourth cut
Info beans corporate flyer   fourth cutInfo beans corporate flyer   fourth cut
Info beans corporate flyer fourth cut
 
iPad design ideas by InfoBeans
iPad design ideas by InfoBeansiPad design ideas by InfoBeans
iPad design ideas by InfoBeans
 
InfoBeans corporate presentation for slideshare
InfoBeans corporate presentation for slideshareInfoBeans corporate presentation for slideshare
InfoBeans corporate presentation for slideshare
 
Mitesh interview at wharton
Mitesh interview at whartonMitesh interview at wharton
Mitesh interview at wharton
 
InfoBeans IBuzz 2010 Skit Competition
InfoBeans IBuzz 2010 Skit CompetitionInfoBeans IBuzz 2010 Skit Competition
InfoBeans IBuzz 2010 Skit Competition
 
iPhone as a marketing tool
iPhone as a marketing tooliPhone as a marketing tool
iPhone as a marketing tool
 
US Sales Manager Job Description
US Sales Manager Job DescriptionUS Sales Manager Job Description
US Sales Manager Job Description
 
iPhone Apps FAQ
iPhone Apps FAQiPhone Apps FAQ
iPhone Apps FAQ
 
InfoBeans Mobile Practice Capabilities Presentation
InfoBeans Mobile Practice Capabilities PresentationInfoBeans Mobile Practice Capabilities Presentation
InfoBeans Mobile Practice Capabilities Presentation
 
Reviving Crystal It Park Indore It Companies
Reviving Crystal It Park Indore   It CompaniesReviving Crystal It Park Indore   It Companies
Reviving Crystal It Park Indore It Companies
 
Cost of iPhone Apps - InfoBeans iPhone app development practice
Cost of iPhone Apps - InfoBeans iPhone app development practiceCost of iPhone Apps - InfoBeans iPhone app development practice
Cost of iPhone Apps - InfoBeans iPhone app development practice
 
Director of Delivery - job description
Director of Delivery - job descriptionDirector of Delivery - job description
Director of Delivery - job description
 
A Journey Called Info Beans
A Journey Called Info BeansA Journey Called Info Beans
A Journey Called Info Beans
 
InfoBeans CMS Capabilities Presentation
InfoBeans CMS Capabilities PresentationInfoBeans CMS Capabilities Presentation
InfoBeans CMS Capabilities Presentation
 

Último

AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesMd Hossain Ali
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopBachir Benyammi
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfDianaGray10
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxMatsuo Lab
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1DianaGray10
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6DianaGray10
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Will Schroeder
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarPrecisely
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7DianaGray10
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Adtran
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintMahmoud Rabie
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UbiTrack UK
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-pyJamie (Taka) Wang
 

Último (20)

AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just MinutesAI Fame Rush Review – Virtual Influencer Creation In Just Minutes
AI Fame Rush Review – Virtual Influencer Creation In Just Minutes
 
NIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 WorkshopNIST Cybersecurity Framework (CSF) 2.0 Workshop
NIST Cybersecurity Framework (CSF) 2.0 Workshop
 
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdfUiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
UiPath Solutions Management Preview - Northern CA Chapter - March 22.pdf
 
Introduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptxIntroduction to Matsuo Laboratory (ENG).pptx
Introduction to Matsuo Laboratory (ENG).pptx
 
Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1Secure your environment with UiPath and CyberArk technologies - Session 1
Secure your environment with UiPath and CyberArk technologies - Session 1
 
UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6UiPath Studio Web workshop series - Day 6
UiPath Studio Web workshop series - Day 6
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
Apres-Cyber - The Data Dilemma: Bridging Offensive Operations and Machine Lea...
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
AI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity WebinarAI You Can Trust - Ensuring Success with Data Integrity Webinar
AI You Can Trust - Ensuring Success with Data Integrity Webinar
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7UiPath Studio Web workshop series - Day 7
UiPath Studio Web workshop series - Day 7
 
Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™Meet the new FSP 3000 M-Flex800™
Meet the new FSP 3000 M-Flex800™
 
Empowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership BlueprintEmpowering Africa's Next Generation: The AI Leadership Blueprint
Empowering Africa's Next Generation: The AI Leadership Blueprint
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
UWB Technology for Enhanced Indoor and Outdoor Positioning in Physiological M...
 
20230202 - Introduction to tis-py
20230202 - Introduction to tis-py20230202 - Introduction to tis-py
20230202 - Introduction to tis-py
 

Design patterns

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7. An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() MallardDuck display() RedheadDuck display() Lots of other types of ducks
  • 8. An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() fly() MallardDuck display() RedheadDuck display() Lots of other types of ducks
  • 9. An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() fly() MallardDuck display() RedheadDuck display() Lots of other types of ducks
  • 10. An Orientation Example – Strategy Pattern Duck quack() swim() abstract display() fly() MallardDuck display() RedheadDuck display() Yay!! I can fly too!!! RubberDuck display()
  • 11.  
  • 12. Hey Abbey-Shack…. If you want to try Monster.com’s resume services, now is the time.
  • 13. Who is going to rescue me now? <<Interfaces>> !!! Yes!!! That’s it! I make an IFlyable interface and RubberDuck doesn’t get to implement it… MallardDuck <<IFlyable>> display() RedheadDuck <<IFlyable>> display() RubberDuck //You can’t fly! display() They can’t see me happy 
  • 14. I… I… I… I have a Question! SimCorp simulates 50 ducks… are you saying you are going to write 50 fly methods? What if there is a change in flying style and it effects 20 ducks… will all 20 ducks change? I am losing money you know…
  • 15.
  • 16. Strategy Pattern in Action Duck quack() swim() abstract display() MallardDuck IFlyBehavior:FlyWithWings display() RubberDuck IFlyBehavior: DontFly display() IFlyBehavior fly() FlyWithWings FlyWithRocket DontFly
  • 17.
  • 18.
  • 19.
  • 20. Q & A