SlideShare una empresa de Scribd logo
1 de 13
Presentation
        on
Design Patterns



             By
    Samundra Shrestha
Patterns
Each pattern describes a problem which occurs over and
over again in our environment and then describes the core
of the solution to that problem, in such a way that you can
use this solution a million times over, without ever doing it
the same twice.




                             - Christopher Alexander, The
                             Timeless Way of Building, 1979



          So what are patterns?
What are Patterns, really?

            Patterns catalog solutions to
            categories of problems

            They consist of
            A name
            A solution to a problem
            A description of the solution
            An assessment of the pros and
            cons of the pattern
What are Patterns Not?

1. An algorithm.
2. An implementation.
3. The same every time you see them.
Introduction to Design Patterns
Gang of Four (GOF)

    Erich Gamma, Richard Helm, Ralph Johnson,
and John Vlissides

    Authors of the original Design Patterns book


Problem in software design

    What – business and functionality requirements

    How – particular design to meet the requirements

    Work – Actual implementation, How put into practice.
Principal and Strategies
      
           Open Closed Principle
      
           Dependency Inversion
      
           Single Responsibility Policy


Why ?


  
          improve abilities as analyst and designer.
  
          tackle situation in which no design pattern can be
          applied or design pattern has not been discovered yet.
Contextual Design
Open Closed Principle (OCP)


   "Modules, methods, classes should be open for extension,
   while closed for modifications."


    
        Loose Coupling


    
        Encapsulation
Dependency Inversion Principle

    Depend on the abstractions



    Higher level module should not depend on lower
    level module. Both high and low level should depend
    on abstractions



    Abstraction should not depend on details. Details
    should depend on abstractions.
Categorization
Creational Patterns

     Abstract Factory, Builder, Factory Method,
     Prototype, Singleton

Behavioral Patterns

     Adapter, Bridge, Composite, Decorator,
     Facade, Flyweight, Proxy

Structural Patterns

     Chain of Responsibility, Command,
     Interpreter, Iterator, Mediator, Memento,
     Observer, State, Strategy, Template,
     Method, Visitor

                          Single instance in the whole application/platform
Singleton Patterns                                Patterns by Examples

Problem : Ensure a class has only one instance available in the system anytime.



                                                   Output:

                                                   Design Patterns Example
Factory Pattern                                   Patterns by Examples

dynamically create instances of multiple classes based on runtime input.




                                                  Output:

                                                  This is system generated
                                                  messageThis is console
                                                  generated message
Decorator Pattern                                     Patterns by Examples
best suited for altering or decorating portions of an existing object’s content or
functionality without modifying the structure of the original object.




                                           Output :

                                           The CD contains the following tracks:
                                           1) what-it-means. 2) brr. 3) good-bye.
Thank you :)

Más contenido relacionado

Similar a Design patterns

P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)
stanbridge
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr
 

Similar a Design patterns (20)

Design patterns
Design patternsDesign patterns
Design patterns
 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
 
Why Design Patterns Are Important In Software Engineering
Why Design Patterns Are Important In Software EngineeringWhy Design Patterns Are Important In Software Engineering
Why Design Patterns Are Important In Software Engineering
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Patterns Overview
Patterns OverviewPatterns Overview
Patterns Overview
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The World
 
Introduction to Design Patterns
Introduction to Design PatternsIntroduction to Design Patterns
Introduction to Design Patterns
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)Cs 1023 lec 9 design pattern (week 2)
Cs 1023 lec 9 design pattern (week 2)
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
 
Oops design pattern intro
Oops design pattern intro Oops design pattern intro
Oops design pattern intro
 
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
dotnet stuff.com tutorials-design-patterns_exploring-net-design-patterns-in-s...
 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categories
 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
 

Más de Prawesh Shrestha

Business plan and presentation iii - financials and risk
Business plan and presentation   iii - financials and riskBusiness plan and presentation   iii - financials and risk
Business plan and presentation iii - financials and risk
Prawesh Shrestha
 
Business plan and presentation ii - marketing and operations
Business plan and presentation   ii - marketing and operationsBusiness plan and presentation   ii - marketing and operations
Business plan and presentation ii - marketing and operations
Prawesh Shrestha
 
Scooba talk about your apps - vol 2
Scooba   talk about your apps - vol 2Scooba   talk about your apps - vol 2
Scooba talk about your apps - vol 2
Prawesh Shrestha
 
Software quality and mobile apps
Software quality and mobile appsSoftware quality and mobile apps
Software quality and mobile apps
Prawesh Shrestha
 

Más de Prawesh Shrestha (20)

Presentation: Follow up on hackathon - FightVAW
Presentation: Follow up on hackathon - FightVAWPresentation: Follow up on hackathon - FightVAW
Presentation: Follow up on hackathon - FightVAW
 
Company registration, conduction and renewal
Company registration, conduction and renewalCompany registration, conduction and renewal
Company registration, conduction and renewal
 
Orientation to Pivot Nepal Finalists
Orientation to Pivot Nepal FinalistsOrientation to Pivot Nepal Finalists
Orientation to Pivot Nepal Finalists
 
Business plan and presentation iii - financials and risk
Business plan and presentation   iii - financials and riskBusiness plan and presentation   iii - financials and risk
Business plan and presentation iii - financials and risk
 
Business plan and presentation ii - marketing and operations
Business plan and presentation   ii - marketing and operationsBusiness plan and presentation   ii - marketing and operations
Business plan and presentation ii - marketing and operations
 
Business plan and presentation i - concept-growth-risk
Business plan and presentation   i - concept-growth-riskBusiness plan and presentation   i - concept-growth-risk
Business plan and presentation i - concept-growth-risk
 
Technology Entrepreneurship - Making Business Sense
Technology Entrepreneurship - Making Business SenseTechnology Entrepreneurship - Making Business Sense
Technology Entrepreneurship - Making Business Sense
 
Pivot Nepal - Presentation
Pivot Nepal - PresentationPivot Nepal - Presentation
Pivot Nepal - Presentation
 
Swktm gdg presentation v1.0
Swktm gdg presentation v1.0Swktm gdg presentation v1.0
Swktm gdg presentation v1.0
 
I os 101:basic training rajan
I os 101:basic training   rajanI os 101:basic training   rajan
I os 101:basic training rajan
 
GSMA mWomen design challenge 2012
GSMA mWomen design challenge 2012GSMA mWomen design challenge 2012
GSMA mWomen design challenge 2012
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
N locate - market perspective
N locate - market perspectiveN locate - market perspective
N locate - market perspective
 
Nepal load shedding apps
Nepal load shedding appsNepal load shedding apps
Nepal load shedding apps
 
Introduction to android
Introduction to androidIntroduction to android
Introduction to android
 
Ncell's scheme
Ncell's schemeNcell's scheme
Ncell's scheme
 
Android trainingforbeginners
Android trainingforbeginnersAndroid trainingforbeginners
Android trainingforbeginners
 
Scooba talk about your apps - vol 2
Scooba   talk about your apps - vol 2Scooba   talk about your apps - vol 2
Scooba talk about your apps - vol 2
 
Software quality and mobile apps
Software quality and mobile appsSoftware quality and mobile apps
Software quality and mobile apps
 
Mvc - Titanium
Mvc - TitaniumMvc - Titanium
Mvc - Titanium
 

Último

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
Earley Information Science
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
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
Enterprise Knowledge
 

Último (20)

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
 
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
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
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?
 
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
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
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
 
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
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
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
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
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...
 

Design patterns

  • 1. Presentation on Design Patterns By Samundra Shrestha
  • 2. Patterns Each pattern describes a problem which occurs over and over again in our environment and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same twice. - Christopher Alexander, The Timeless Way of Building, 1979 So what are patterns?
  • 3. What are Patterns, really? Patterns catalog solutions to categories of problems They consist of A name A solution to a problem A description of the solution An assessment of the pros and cons of the pattern
  • 4. What are Patterns Not? 1. An algorithm. 2. An implementation. 3. The same every time you see them.
  • 5. Introduction to Design Patterns Gang of Four (GOF)  Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides  Authors of the original Design Patterns book Problem in software design  What – business and functionality requirements  How – particular design to meet the requirements  Work – Actual implementation, How put into practice.
  • 6. Principal and Strategies  Open Closed Principle  Dependency Inversion  Single Responsibility Policy Why ?  improve abilities as analyst and designer.  tackle situation in which no design pattern can be applied or design pattern has not been discovered yet.
  • 7. Contextual Design Open Closed Principle (OCP) "Modules, methods, classes should be open for extension, while closed for modifications."  Loose Coupling  Encapsulation
  • 8. Dependency Inversion Principle  Depend on the abstractions  Higher level module should not depend on lower level module. Both high and low level should depend on abstractions  Abstraction should not depend on details. Details should depend on abstractions.
  • 9. Categorization Creational Patterns Abstract Factory, Builder, Factory Method, Prototype, Singleton Behavioral Patterns Adapter, Bridge, Composite, Decorator, Facade, Flyweight, Proxy Structural Patterns Chain of Responsibility, Command, Interpreter, Iterator, Mediator, Memento, Observer, State, Strategy, Template, Method, Visitor Single instance in the whole application/platform
  • 10. Singleton Patterns Patterns by Examples Problem : Ensure a class has only one instance available in the system anytime. Output: Design Patterns Example
  • 11. Factory Pattern Patterns by Examples dynamically create instances of multiple classes based on runtime input. Output: This is system generated messageThis is console generated message
  • 12. Decorator Pattern Patterns by Examples best suited for altering or decorating portions of an existing object’s content or functionality without modifying the structure of the original object. Output : The CD contains the following tracks: 1) what-it-means. 2) brr. 3) good-bye.