SlideShare uma empresa 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

Mais conteúdo relacionado

Destaque

Artificial Intelligence 02 uninformed search
Artificial Intelligence 02 uninformed searchArtificial Intelligence 02 uninformed search
Artificial Intelligence 02 uninformed searchAndres Mendez-Vazquez
 
9.6 El modelado Glaciar
9.6 El modelado Glaciar9.6 El modelado Glaciar
9.6 El modelado GlaciarRaquel Zalba
 
Xtext project and PhDs in Gemany
Xtext project and PhDs in GemanyXtext project and PhDs in Gemany
Xtext project and PhDs in GemanyTech Talks @NSU
 
2014 Best Sports Cars
2014 Best Sports Cars2014 Best Sports Cars
2014 Best Sports CarsEason Chan
 
رهبری تیمهای نوآور
رهبری تیمهای نوآوررهبری تیمهای نوآور
رهبری تیمهای نوآورSina Bagherinezhad
 
Music video audience profile
Music video audience profileMusic video audience profile
Music video audience profileChloé
 
9 einfache Ideen für individuelle Bildmotive
9 einfache Ideen für individuelle Bildmotive9 einfache Ideen für individuelle Bildmotive
9 einfache Ideen für individuelle BildmotiveWebdesign Journal
 
Artificial Intelligence 06.01 introduction bayesian_networks
Artificial Intelligence 06.01 introduction bayesian_networksArtificial Intelligence 06.01 introduction bayesian_networks
Artificial Intelligence 06.01 introduction bayesian_networksAndres Mendez-Vazquez
 

Destaque (12)

Artificial Intelligence 02 uninformed search
Artificial Intelligence 02 uninformed searchArtificial Intelligence 02 uninformed search
Artificial Intelligence 02 uninformed search
 
9.6 El modelado Glaciar
9.6 El modelado Glaciar9.6 El modelado Glaciar
9.6 El modelado Glaciar
 
Xtext project and PhDs in Gemany
Xtext project and PhDs in GemanyXtext project and PhDs in Gemany
Xtext project and PhDs in Gemany
 
2014 Best Sports Cars
2014 Best Sports Cars2014 Best Sports Cars
2014 Best Sports Cars
 
رهبری تیمهای نوآور
رهبری تیمهای نوآوررهبری تیمهای نوآور
رهبری تیمهای نوآور
 
Music video audience profile
Music video audience profileMusic video audience profile
Music video audience profile
 
How to Look at Art
How to Look at ArtHow to Look at Art
How to Look at Art
 
9 einfache Ideen für individuelle Bildmotive
9 einfache Ideen für individuelle Bildmotive9 einfache Ideen für individuelle Bildmotive
9 einfache Ideen für individuelle Bildmotive
 
Pn learning takmin
Pn learning takminPn learning takmin
Pn learning takmin
 
ATA CP-MAT program highlights
ATA CP-MAT program highlightsATA CP-MAT program highlights
ATA CP-MAT program highlights
 
Artificial Intelligence 06.01 introduction bayesian_networks
Artificial Intelligence 06.01 introduction bayesian_networksArtificial Intelligence 06.01 introduction bayesian_networks
Artificial Intelligence 06.01 introduction bayesian_networks
 
Jeff Krongaard - RAYTHEON
Jeff Krongaard - RAYTHEONJeff Krongaard - RAYTHEON
Jeff Krongaard - RAYTHEON
 

Semelhante a Introduction to 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彥彬 洪
 

Semelhante a Introduction to Design Patterns (20)

L04 Software Design Examples
L04 Software Design ExamplesL04 Software Design Examples
L04 Software Design Examples
 
10 strategy pattern
10 strategy pattern10 strategy pattern
10 strategy pattern
 
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
 

Último

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessPixlogix Infotech
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Último (20)

Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Introduction to 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