SlideShare a Scribd company logo
Design Patterns for 70% of genious programmers Aamir Khan Solution Architect
Design Patterns for 70% of programmers in the world Saurabh Verma Solution Architect  I blog at http://www.domaindrivendesign.info
Agenda Do you OOPs? Design Patterns? Why Design Patterns? What Design Patterns? How I hate my job
Normal Classes vs Abstract Classes vs Interfaces Normal Class:  This is a normal class   Abstract Class:  These cannot be instantiated directly.  They may provide partial implementations and exists solely for the purpose of inheritance.  Interfaces:  Defines a contract. Concrete implementations needs to implement each property and method as per contract. Shut up ! We know all this
Million Dollar Question? What is Why?
Normal Class vs Abstract Class? If a particular class is a entity which is not required to be instantiated by the application directly, go for  Abstract Class Employee can be abstract class
Abstract Class vs Interfaces? If a particular class contains any default behavior, go for  Abstract Class If every concrete class has its own implementation, go for Interfaces Work – Management, Programming
MOVIES & ACTORS Shahrukh Khan Salman Khan riding bike Actors in a Movie
IS-A vs HAS-A vs CAN-DO IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE IS-A  Inheritance Shahrukh Khan is an ACTOR HAS-A  Composition Movie has ACTORS CAN-DO  Interfaces Salman Khan can DRIVE BIKE
What is a Pattern An 'element of reusable software’ A design pattern systematically names, motivates, and explains a  general design  that addresses a recurring design problem in object-oriented systems.  It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context.
History of Software Patterns
What Wikipedia says, A design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code.  Algorithms are not thought of as design patterns.
Let’s understand design patterns by purpose
Let’s understand the purpose + Creational Patterns Structural Patterns Final Product Behavioral Patterns
Let’s understand the purpose
Design Patterns as per their  PURPOSE
Creational Patterns
Factory Method
Factory Method Define an interface for creating an object, but let subclass decide which class to instantiate Prevents creation of any additional instances, while simultaneously allowing global access Creation can be delayed until it is actually required
Factory Method System.Data.SqlClient.SqlClientFactory
Abstract Factory Pattern
Abstract Factory Pattern Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Provides creation of families of related or dependent objects without specifying their concrete class
Abstract Factory Method System.Data.Common.DbProviderFactories
Singleton Pattern
Singleton Pattern Ensure a class has only  one instance, and provide a global point to it. Prevents creation of any additional instances, while simultaneously allowing global access Creation can be delayed until it is actually required
Singleton Pattern System.Data.SqlClient.SqlClientFactory
Structural Patterns
Façade Pattern
Façade Pattern Provide a unified interface to set of interfaces in a subsystem. Is generally one side of the exterior of a building, especially the front Origin from a FRENCH word means “face” or “front”
Façade Pattern Its all about the service
Decorator Pattern
Decorator Pattern Attach additional responsibilities to an object dynamically. Flexible alternative to subclassing for extending functionality Allows dynamic and transparent addition and removal of responsibilities without affecting object simple actress ( act ) in role of modern girl (go out and  act ) in role of homely girl (be in home and  act )
Decorator Pattern System.IO.BufferedStream:Stream
Composite Pattern
Composite Pattern Compose objects into tree structures to represent  part-whole hierarchies When dealing with collections of objects, there are often operations that are appropriate for both a single object and the entire collection Treats individual objects and composition of objects uniformly Example:  Every object “IS-A” shape Every shape “HAS-A” draw behavior
Composite Pattern System.Web.UI.Control   (Render Mechanism)
Composite Pattern
Adapter Pattern
Adapter Pattern Convert the interface of a class into another interface clients expect Lets classes work together that couldn’t work otherwise Works good for making compliance Application Framework Adapter Legacy Component
Adapter Pattern GearsTypelib.HtmlDialogHostClass (Interop.GearsTypelib)
Decorator vs Adapter Decorator looks like Adapter which “decorates” an existing class to make it compatible. Though, Decorator doesn’t wants you to decorate every method in the Adapted class. But who has stopped from doing it. “ Never underestimate the power of a developer”
Decorator vs Façade Façade is a way of hiding a complex system inside a simpler interface, whereas Decorator adds function by wrapping a class.
Behavioural Patterns
Command Pattern
Command Pattern Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests. If all commands can service a specific request, they can be entertained by the invoker Concrete command performs the action on Receiver Encapsulate method invocation One Receiver and Multiple actions
Command Pattern System.ComponentModel.Design.MenuCommand
Command Pattern Saurabh.Learning.DesignPatterns.Patterns.CommandPattern
Strategy Pattern
Strategy Pattern Define strategies for a performing a behavior and change them dynamically as per requirement This lets the algorithm vary independently from clients that uses it It is about choice, which affects outcomes
Strategy Pattern System.Collections.ArrayList
Template Method
Template Method Define the skeleton of an algorithm in an operations, deferring some steps to subclass Main algorithm skeleton is defined in a base class and subclasses can then plug in their own details without affecting the algorithm itself Uses Inheritance – Abstract Class defines the template (algorithm) and Concrete class manages the implementation. Template uses the implementation on demand
Template Method
Strategy Pattern vs Template Method Strategy allows callers to change the algorithm  or order of steps whereas Template method allow steps to be modified Strategy uses Interfaces whereas Template method uses Inheritance
I hate my job
Top 5 ADVICES NOT TO FOLLOW
Reflect when you want  
Answers, anybody?
CONTENT STOLEN FROM   BOOKS: Head First Design Patterns Design Patterns in C# Design Patterns WEBSITES: Wikipedia, MSDN, doFactory and GOOGLE
Learn it all,   at my blog http://www.domaindrivendesign.info Don’t contact  me at, saurabh.net [at] gmail.com Saurabh Verma Solution Architect

More Related Content

What's hot (20)

PDF
Styled Components & React.js
Grayson Hicks
 
PPTX
Ajax presentation
Bharat_Kumawat
 
PDF
Non access modifiers
Muthukumaran Subramanian
 
PDF
Javascript and DOM
Brian Moschel
 
PPT
Server Controls of ASP.Net
Hitesh Santani
 
PPTX
How Hashmap works internally in java
Ramakrishna Joshi
 
PPTX
Introduction to php
shanmukhareddy dasi
 
PPTX
HTML 5 Canvas & SVG
Ofir's Fridman
 
PPT
IIS
Giritharan V
 
PPTX
Java script
Abhishek Kesharwani
 
PDF
JavaScript Promises
Derek Willian Stavis
 
PPTX
Responsive web designing ppt(1)
admecindia1
 
PPTX
HTML Block and Inline Elements
Webtech Learning
 
PPTX
What is an API?
Muhammad Zuhdi
 
PPTX
Java script
Shyam Khant
 
PPTX
Front end web development
viveksewa
 
PDF
JavaScript Programming
Sehwan Noh
 
PPTX
CA API Gateway: Web API and Application Security
CA Technologies
 
PDF
Android notification
Krazy Koder
 
Styled Components & React.js
Grayson Hicks
 
Ajax presentation
Bharat_Kumawat
 
Non access modifiers
Muthukumaran Subramanian
 
Javascript and DOM
Brian Moschel
 
Server Controls of ASP.Net
Hitesh Santani
 
How Hashmap works internally in java
Ramakrishna Joshi
 
Introduction to php
shanmukhareddy dasi
 
HTML 5 Canvas & SVG
Ofir's Fridman
 
Java script
Abhishek Kesharwani
 
JavaScript Promises
Derek Willian Stavis
 
Responsive web designing ppt(1)
admecindia1
 
HTML Block and Inline Elements
Webtech Learning
 
What is an API?
Muhammad Zuhdi
 
Java script
Shyam Khant
 
Front end web development
viveksewa
 
JavaScript Programming
Sehwan Noh
 
CA API Gateway: Web API and Application Security
CA Technologies
 
Android notification
Krazy Koder
 

Viewers also liked (20)

PPT
Enercept Power Point[1]
cezitelli
 
PPTX
Energy resource management
Riddhima Kartik
 
PDF
Crude-Oil Scheduling Technology: moving from simulation to optimization
Brenno Menezes
 
DOCX
Steel building Graded Unit Civil Engineering Project HND Project Glasgow Kel...
Tehmas Saeed
 
PDF
Crude-Oil Blend Scheduling Optimization: An Application with Multi-Million D...
Alkis Vazacopoulos
 
PDF
Oil-Refinery Planning & Scheduling Optimization
Alkis Vazacopoulos
 
PPTX
Fnbe0115 Integrated - awesome
Muhammad Nazmi
 
PPT
Architectural Professional Practice - Construction Documents
Galala University
 
PDF
Distillation Blending and Cutpoint Temperature Optimization in Scheduling Ope...
Brenno Menezes
 
PDF
Distillation Blending and Cutpoint Temperature Optimization (DBCTO) in Schedu...
Brenno Menezes
 
PDF
Schedule Development
Chris Carson
 
PDF
CRUDE-OIL BLEND SCHEDULING OPTIMIZATION OF AN INDUSTRIAL-SIZED REFINERY: A DI...
Brenno Menezes
 
PDF
Schedule Design PMI
Chris Carson
 
PPTX
5case
Riddhima Kartik
 
PPTX
Strategic brand management
Riddhima Kartik
 
PPTX
Design and analasys of a g+2 residential building
=> No nEEd FoH WoRk , Um gOod cOnsUMer oF PArentx MOnEy
 
PPT
Design and analasys of a g+3 residential building using staad
gopichand's
 
PPTX
Profit Impact of Market Strategies (PIMS)
Nurul Aqilah
 
PPTX
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
Ali Meer
 
PPT
Multistorey building
Rahul
 
Enercept Power Point[1]
cezitelli
 
Energy resource management
Riddhima Kartik
 
Crude-Oil Scheduling Technology: moving from simulation to optimization
Brenno Menezes
 
Steel building Graded Unit Civil Engineering Project HND Project Glasgow Kel...
Tehmas Saeed
 
Crude-Oil Blend Scheduling Optimization: An Application with Multi-Million D...
Alkis Vazacopoulos
 
Oil-Refinery Planning & Scheduling Optimization
Alkis Vazacopoulos
 
Fnbe0115 Integrated - awesome
Muhammad Nazmi
 
Architectural Professional Practice - Construction Documents
Galala University
 
Distillation Blending and Cutpoint Temperature Optimization in Scheduling Ope...
Brenno Menezes
 
Distillation Blending and Cutpoint Temperature Optimization (DBCTO) in Schedu...
Brenno Menezes
 
Schedule Development
Chris Carson
 
CRUDE-OIL BLEND SCHEDULING OPTIMIZATION OF AN INDUSTRIAL-SIZED REFINERY: A DI...
Brenno Menezes
 
Schedule Design PMI
Chris Carson
 
Strategic brand management
Riddhima Kartik
 
Design and analasys of a g+2 residential building
=> No nEEd FoH WoRk , Um gOod cOnsUMer oF PArentx MOnEy
 
Design and analasys of a g+3 residential building using staad
gopichand's
 
Profit Impact of Market Strategies (PIMS)
Nurul Aqilah
 
DESIGN AND ANALAYSIS OF MULTI STOREY BUILDING USING STAAD PRO
Ali Meer
 
Multistorey building
Rahul
 
Ad

Similar to Design Patterns For 70% Of Programmers In The World (20)

PPTX
Software Patterns
bonej010
 
PPT
5 Design Patterns Explained
Prabhjit Singh
 
PDF
[DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
DevDay Da Nang
 
PPTX
Sofwear deasign and need of design pattern
chetankane
 
PPT
Introduction To Design Patterns
sukumarraju6
 
PPT
Design Patterns
Rafael Coutinho
 
PPTX
Design patterns
Binu Bhasuran
 
PDF
Java Design Patterns Tutorial | Edureka
Edureka!
 
PPTX
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
 
ODP
Design Patterns Part1
Tom Chen
 
PPTX
Design patterns Structural
UMAR ALI
 
PPT
Bartlesville Dot Net User Group Design Patterns
Jason Townsend, MBA
 
PPTX
Let us understand design pattern
Mindfire Solutions
 
PPTX
Introduction to Design Patterns
Prageeth Sandakalum
 
PPTX
Sda 8
AmberMughal5
 
PDF
The maze of Design Patterns & SOLID Principles
Muhammad Raza
 
PPT
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
 
PPT
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
 
PPTX
Final sdp ppt
nancy_17
 
PPT
Software Design Patterns
Satheesh Sukumaran
 
Software Patterns
bonej010
 
5 Design Patterns Explained
Prabhjit Singh
 
[DevDay 2016] Design Pattern at a glance - Speaker: Tuan Do – Scrum Master a...
DevDay Da Nang
 
Sofwear deasign and need of design pattern
chetankane
 
Introduction To Design Patterns
sukumarraju6
 
Design Patterns
Rafael Coutinho
 
Design patterns
Binu Bhasuran
 
Java Design Patterns Tutorial | Edureka
Edureka!
 
Women Who Code Belfast: Introduction to Design patterns
Jackie Pollock
 
Design Patterns Part1
Tom Chen
 
Design patterns Structural
UMAR ALI
 
Bartlesville Dot Net User Group Design Patterns
Jason Townsend, MBA
 
Let us understand design pattern
Mindfire Solutions
 
Introduction to Design Patterns
Prageeth Sandakalum
 
The maze of Design Patterns & SOLID Principles
Muhammad Raza
 
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane1
 
Chapter 4_Introduction to Patterns.ppt
RushikeshChikane2
 
Final sdp ppt
nancy_17
 
Software Design Patterns
Satheesh Sukumaran
 
Ad

Recently uploaded (20)

PDF
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PDF
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
PPTX
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
PDF
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
PDF
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
PDF
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
PDF
Open Source Milvus Vector Database v 2.6
Zilliz
 
PDF
The Growing Value and Application of FME & GenAI
Safe Software
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
PPTX
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PPTX
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
PPTX
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
PDF
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 
Unlocking FME Flow’s Potential: Architecture Design for Modern Enterprises
Safe Software
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Database Benchmarking for Performance Masterclass: Session 1 - Benchmarking F...
ScyllaDB
 
Curietech AI in action - Accelerate MuleSoft development
shyamraj55
 
Cracking the Code - Unveiling Synergies Between Open Source Security and AI.pdf
Priyanka Aash
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
Database Benchmarking for Performance Masterclass: Session 2 - Data Modeling ...
ScyllaDB
 
Hello I'm "AI" Your New _________________
Dr. Tathagat Varma
 
FME as an Orchestration Tool with Principles From Data Gravity
Safe Software
 
Open Source Milvus Vector Database v 2.6
Zilliz
 
The Growing Value and Application of FME & GenAI
Safe Software
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
EIS-Webinar-Engineering-Retail-Infrastructure-06-16-2025.pdf
Earley Information Science
 
UserCon Belgium: Honey, VMware increased my bill
stijn40
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
𝙳𝚘𝚠𝚗𝚕𝚘𝚊𝚍—Wondershare Filmora Crack 14.0.7 + Key Download 2025
sebastian aliya
 
Simplifica la seguridad en la nube y la detección de amenazas con FortiCNAPP
Cristian Garcia G.
 
My Journey from CAD to BIM: A True Underdog Story
Safe Software
 

Design Patterns For 70% Of Programmers In The World

  • 1. Design Patterns for 70% of genious programmers Aamir Khan Solution Architect
  • 2. Design Patterns for 70% of programmers in the world Saurabh Verma Solution Architect I blog at http://www.domaindrivendesign.info
  • 3. Agenda Do you OOPs? Design Patterns? Why Design Patterns? What Design Patterns? How I hate my job
  • 4. Normal Classes vs Abstract Classes vs Interfaces Normal Class: This is a normal class  Abstract Class: These cannot be instantiated directly. They may provide partial implementations and exists solely for the purpose of inheritance. Interfaces: Defines a contract. Concrete implementations needs to implement each property and method as per contract. Shut up ! We know all this
  • 6. Normal Class vs Abstract Class? If a particular class is a entity which is not required to be instantiated by the application directly, go for Abstract Class Employee can be abstract class
  • 7. Abstract Class vs Interfaces? If a particular class contains any default behavior, go for Abstract Class If every concrete class has its own implementation, go for Interfaces Work – Management, Programming
  • 8. MOVIES & ACTORS Shahrukh Khan Salman Khan riding bike Actors in a Movie
  • 9. IS-A vs HAS-A vs CAN-DO IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE IS-A Inheritance Shahrukh Khan is an ACTOR HAS-A Composition Movie has ACTORS CAN-DO Interfaces Salman Khan can DRIVE BIKE
  • 10. What is a Pattern An 'element of reusable software’ A design pattern systematically names, motivates, and explains a general design that addresses a recurring design problem in object-oriented systems. It describes the problem, the solution, when to apply the solution, and its consequences. It also gives implementation hints and examples. The solution is a general arrangement of objects and classes that solve the problem. The solution is customized and implemented to solve the problem in a particular context.
  • 12. What Wikipedia says, A design pattern is a general repeatable solution to a commonly occurring problem in software design. A design pattern is not a finished design that can be transformed directly into code. Algorithms are not thought of as design patterns.
  • 13. Let’s understand design patterns by purpose
  • 14. Let’s understand the purpose + Creational Patterns Structural Patterns Final Product Behavioral Patterns
  • 16. Design Patterns as per their PURPOSE
  • 19. Factory Method Define an interface for creating an object, but let subclass decide which class to instantiate Prevents creation of any additional instances, while simultaneously allowing global access Creation can be delayed until it is actually required
  • 22. Abstract Factory Pattern Provide an interface for creating families of related or dependent objects without specifying their concrete classes. Provides creation of families of related or dependent objects without specifying their concrete class
  • 23. Abstract Factory Method System.Data.Common.DbProviderFactories
  • 25. Singleton Pattern Ensure a class has only one instance, and provide a global point to it. Prevents creation of any additional instances, while simultaneously allowing global access Creation can be delayed until it is actually required
  • 29. Façade Pattern Provide a unified interface to set of interfaces in a subsystem. Is generally one side of the exterior of a building, especially the front Origin from a FRENCH word means “face” or “front”
  • 30. Façade Pattern Its all about the service
  • 32. Decorator Pattern Attach additional responsibilities to an object dynamically. Flexible alternative to subclassing for extending functionality Allows dynamic and transparent addition and removal of responsibilities without affecting object simple actress ( act ) in role of modern girl (go out and act ) in role of homely girl (be in home and act )
  • 35. Composite Pattern Compose objects into tree structures to represent part-whole hierarchies When dealing with collections of objects, there are often operations that are appropriate for both a single object and the entire collection Treats individual objects and composition of objects uniformly Example: Every object “IS-A” shape Every shape “HAS-A” draw behavior
  • 39. Adapter Pattern Convert the interface of a class into another interface clients expect Lets classes work together that couldn’t work otherwise Works good for making compliance Application Framework Adapter Legacy Component
  • 41. Decorator vs Adapter Decorator looks like Adapter which “decorates” an existing class to make it compatible. Though, Decorator doesn’t wants you to decorate every method in the Adapted class. But who has stopped from doing it. “ Never underestimate the power of a developer”
  • 42. Decorator vs Façade Façade is a way of hiding a complex system inside a simpler interface, whereas Decorator adds function by wrapping a class.
  • 45. Command Pattern Encapsulate a request as an object, thereby letting you parameterize clients with different requests, queue or log requests. If all commands can service a specific request, they can be entertained by the invoker Concrete command performs the action on Receiver Encapsulate method invocation One Receiver and Multiple actions
  • 49. Strategy Pattern Define strategies for a performing a behavior and change them dynamically as per requirement This lets the algorithm vary independently from clients that uses it It is about choice, which affects outcomes
  • 52. Template Method Define the skeleton of an algorithm in an operations, deferring some steps to subclass Main algorithm skeleton is defined in a base class and subclasses can then plug in their own details without affecting the algorithm itself Uses Inheritance – Abstract Class defines the template (algorithm) and Concrete class manages the implementation. Template uses the implementation on demand
  • 54. Strategy Pattern vs Template Method Strategy allows callers to change the algorithm or order of steps whereas Template method allow steps to be modified Strategy uses Interfaces whereas Template method uses Inheritance
  • 55. I hate my job
  • 56. Top 5 ADVICES NOT TO FOLLOW
  • 57. Reflect when you want 
  • 59. CONTENT STOLEN FROM  BOOKS: Head First Design Patterns Design Patterns in C# Design Patterns WEBSITES: Wikipedia, MSDN, doFactory and GOOGLE
  • 60. Learn it all, at my blog http://www.domaindrivendesign.info Don’t contact me at, saurabh.net [at] gmail.com Saurabh Verma Solution Architect