SlideShare a Scribd company logo
Design Patterns
                         Introduction and Overview




                                                     By,
                                                      Abhishek Sagi
Monday 5 December 11
Today
                       Introduction to Design Patterns :
                         What are they?

                         Types of Patterns

                         Examples : Commonly used patterns

                         References




Monday 5 December 11
Design Patterns
                             What are they?




Monday 5 December 11
Design Patterns
            Idea originated from Christopher Wolfgang
            Alexander (Austria).

            Architect

            It was initially applied for architecture for
            buildings and towns, But not computer
            programming for writing software.




Monday 5 December 11
"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 way twiceโ€
                         -Christopher Alexander (Architect)
                         โ€œA Pattern Languageโ€,New York,
                          Oxford University Press, 1977.



Monday 5 December 11
Design Patterns
                   Even through he was talking about patterns in
                   buildings and towns, What he says is true about
                   object-oriented design patterns.

                   Solutions are expressed in terms of objects and
                   interfaces instead of walls and doors.

                   At core both patterns is a solution to a problem
                   in a context.

                   Simply, design patterns help a designer to get a
                   right design faster.

Monday 5 December 11
Describes a design pattern as a three-part rule

                       1.) Description of a context

                       2.) A problem

                       3.) A solution

                This is modi๏ฌed for software design patterns which
                consists of four parts




Monday 5 December 11
Four Essential Parts
               Pattern name

                       A handle to brie๏ฌ‚y describe the design
                       problem,but more importantly to provide a common
                       vocabulary for software designers to use.

               Problem

                       A description of the problem that the design
                       pattern is intended to solve.



Monday 5 December 11
Solution

                       Describes what elements are required to make up
                       the design, their relationships and its context.

             Consequences

                       What are the results and trade offs by applying
                       the design pattern.

                       Allows comparison between different design
                       patterns, to see if there is a better ๏ฌt for the
                       actual problem.


Monday 5 December 11
Design Patterns :
              Programming Languages
                       Aimed towards languages that have language
                       level support for Object Oriented
                       Programming
                         Not exclusively , But it would be easier to apply
                         with OOP!

                       Different OOP languages have different
                       mechanisms for applying patterns.



Monday 5 December 11
Types Of Patterns
                       General description of the type of problem the
                       pattern addresses

                         Creational:

                            Concerned with everything about the
                            creation of objects

                         Structural:

                            Concerned with how classes and objects
                            are composed to form larger structures

Monday 5 December 11
Types Of Patterns
              (Continued)
                       Behavioral

                         Concerned with algorithms and the
                         assignment of responsibilities between
                         objects.




Monday 5 December 11
Types Of Patterns (Overview)
               Creational:       Creational patterns are ones that create objects for you,
               rather than having you instantiate objects directly. This gives your program
               more ๏ฌ‚exibility in deciding which objects need to be created for a given
               case.

                       Abstract Factory*: Groups object factories that have a common theme.

                       Builder constructs: Complex objects by separating construction and
                       representation.

                       Factory Method*: Creates objects without specifying the exact class to
                       create.

                       Prototype: Creates objects by cloning an existing object.

                       Singleton*: Restricts object creation for a class to only one instance.

Monday 5 December 11
Types Of Patterns (Contd)
               Structural Patterns:          These concern class and object composition.
               They use inheritance to compose interfaces and de๏ฌne ways to compose
               objects to obtain new functionality.

                       Adapter: Allows classes with incompatible interfaces to work together
                       by wrapping its own interface around that of an already existing class.

                       Bridge*: Decouples an abstraction from its implementation so that the
                       two can vary independently.

                       Composite: Composes zero-or-more similar objects so that they can be
                       manipulated as one object.

                       Decorator: Dynamically adds/overrides behavior in an existing method of
                       an object.


Monday 5 December 11
Types Of Patterns (Contd)
                   Facade: Provides a simpli๏ฌed interface to a large body of code.

                   Flyweight: Reduces the cost of creating and manipulating a large number
                   of similar objects.

                   Proxy: Provides a placeholder for another object to control access,
                   reduce cost, and reduce complexity.


             Behavioral Patterns:        Most of these design patterns are speci๏ฌcally
             concerned with communication between objects.

                   Chain of responsibility: Delegates commands to a chain of processing
                   objects.

                   Command: Creates objects which encapsulate actions and parameters.

                   Interpreter: Implements a specialized language.

Monday 5 December 11
Types Of Patterns (Contd)
                       Iterator*: Accesses the elements of an object sequentially without
                       exposing its underlying representation.

                       Mediator: Allows loose coupling between classes by being the only class
                       that has detailed knowledge of their methods.

                       Memento: Provides the ability to restore an object to its previous state
                       (undo).

                       Observer: Is a publish/subscribe pattern which allows a number of
                       observer objects to see an event.

                       State*: Allows an object to alter its behavior when its internal state
                       changes.

                       Strategy: Allows one of a family of algorithms to be selected on-the-๏ฌ‚y
                       at runtime.
Monday 5 December 11
Design Pattern
                         Example 1: The Singleton




Monday 5 December 11
Singleton
                   Creational category of design patterns

                   Intent: Ensure that a class has only once
                   instance, And provide global point of access to it.

                   Motivation: Important for some classes to have
                   no more than one instance.

                   Examples:

                       Console in a game; Logging utility; An
                       Application Class; A Window Manager.

Monday 5 December 11
Singleton
                         Code Example




Monday 5 December 11
Design Pattern
                         Example 2: State Pattern




Monday 5 December 11
State Pattern
                 Behavioral category of design patterns
                       Provides behavior to an object so that it can be changed
                       during runtime.

                 Very similar to bridge pattern but intention is
                 different

                       Bridge is structural :

                          Hide data from client

                          client only aware of the handle

                       State is behavioral :

                          Provides ๏ฌ‚exible behavior of owning object and client would be
                          aware of both owning object and state objects.
Monday 5 December 11
State Pattern: Approaches
               Application decide
                       Requires state transition

                       Implies constraints, And less ๏ฌ‚exible

                       states are unaware of each other

               States decide
                       Most ๏ฌ‚exible approach

                       States are aware of each other

                       Implementation dependencies between state code

Monday 5 December 11
State creation/destruction:
            2 Approaches:
               As Needed
                       States are created on the ๏ฌ‚y

                       Destroyed when no longer need - can be expensive

                       Conserves memory

                       Preferable where state changes are infrequent

               States created in advance (Compile time)
                       Destroyed only when application terminates - CHEAP!

                       Memory usage - COSTLY! (all data stored in states are created upfront)

                       Preferable where state changes are frequent
Monday 5 December 11
State Pattern
                             Code Example




Monday 5 December 11
Recommended Books
      Design Patterns: Elements of Reusable Object-Oriented Software
      Authors: โ€œGang of fourโ€
      Hardback: 416 pages
      Publisher: Addison Wesley (14 Mar 1995)
                                                           C++
      ISBN-10: 0201633612
      ISBN-13: 978-0201633610




       Head First: Design Patterns
       Authors: Several
       Paperback: 688 pages
       Publisher: O'Reilly Media (25 Oct 2004)            Java
       ISBN-10: 0596007124
       ISBN-13: 978-0596007126



Monday 5 December 11
Questions?

                       Contact: Sharat Chandra (or) Tushar Goswami



                       Email: abhishek.sagi@ymail.com




Monday 5 December 11
References
                Design Patterns: Introduction To Design Patterns;
                Steven Mead , Senior Programming Lecturer ,
                University Of Teesside ; 2010 .

                Design Patterns: Elements of Reusable Object-
                Oriented Software; Erich Gamma et al; Addison-
                Wesley; 1995; 978-0201633610.

                http://en.wikipedia.org/wiki/Design_Patterns

                Big C++ (2nd edition); Cay Horstmann; Timothy
                Budd; John Wiley & Sons; January 2009; 978-
                0470383285.
Monday 5 December 11
Thank you J๏Š




Monday 5 December 11
Ad

More Related Content

What's hot (20)

Design Patterns
Design PatternsDesign Patterns
Design Patterns
Anuja Arosha
ย 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
Srikanth R Vaka
ย 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Pattern
eprafulla
ย 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
Lilia Sfaxi
ย 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
Mindfire Solutions
ย 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
Amit Kabra
ย 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
11prasoon
ย 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
Rana Muhammad Asif
ย 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software Engineering
Manish Kumar
ย 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
soms_1
ย 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
Aman Jain
ย 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
Chetan Gole
ย 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
Anton Keks
ย 
CS8592-OOAD Lecture Notes Unit-1
CS8592-OOAD Lecture Notes Unit-1CS8592-OOAD Lecture Notes Unit-1
CS8592-OOAD Lecture Notes Unit-1
Gobinath Subramaniam
ย 
Design patterns tutorials
Design patterns tutorialsDesign patterns tutorials
Design patterns tutorials
University of Technology
ย 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns ppt
mkruthika
ย 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
Manish Kumar
ย 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
naveen kumar
ย 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categories
Himanshu
ย 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
Shakil Ahmed
ย 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
Anuja Arosha
ย 
Gof design patterns
Gof design patternsGof design patterns
Gof design patterns
Srikanth R Vaka
ย 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Pattern
eprafulla
ย 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
Lilia Sfaxi
ย 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
Mindfire Solutions
ย 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
Amit Kabra
ย 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
11prasoon
ย 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
Rana Muhammad Asif
ย 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software Engineering
Manish Kumar
ย 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
soms_1
ย 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
Aman Jain
ย 
Design Patterns Presentation - Chetan Gole
Design Patterns Presentation -  Chetan GoleDesign Patterns Presentation -  Chetan Gole
Design Patterns Presentation - Chetan Gole
Chetan Gole
ย 
Java Course 11: Design Patterns
Java Course 11: Design PatternsJava Course 11: Design Patterns
Java Course 11: Design Patterns
Anton Keks
ย 
CS8592-OOAD Lecture Notes Unit-1
CS8592-OOAD Lecture Notes Unit-1CS8592-OOAD Lecture Notes Unit-1
CS8592-OOAD Lecture Notes Unit-1
Gobinath Subramaniam
ย 
Software design patterns ppt
Software design patterns pptSoftware design patterns ppt
Software design patterns ppt
mkruthika
ย 
Overview of UML Diagrams
Overview of UML DiagramsOverview of UML Diagrams
Overview of UML Diagrams
Manish Kumar
ย 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
naveen kumar
ย 
Design pattern & categories
Design pattern & categoriesDesign pattern & categories
Design pattern & categories
Himanshu
ย 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
Shakil Ahmed
ย 

Viewers also liked (11)

Linux process management
Linux process managementLinux process management
Linux process management
Raghu nath
ย 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr
ย 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
koolkampus
ย 
Loving & Hating Christopher Alexander
Loving & Hating Christopher AlexanderLoving & Hating Christopher Alexander
Loving & Hating Christopher Alexander
Molly Steenson
ย 
Christopher Alexander: Elements Of Style
Christopher Alexander: Elements Of StyleChristopher Alexander: Elements Of Style
Christopher Alexander: Elements Of Style
Matthias Mueller-Prove
ย 
Traditional Serial Vision Excerpt
Traditional Serial Vision ExcerptTraditional Serial Vision Excerpt
Traditional Serial Vision Excerpt
sstannard
ย 
Townscape - Gordon Cullen V2
Townscape - Gordon Cullen V2Townscape - Gordon Cullen V2
Townscape - Gordon Cullen V2
Proyectar Ciudad
ย 
Townscape - Gordon Cullen
Townscape - Gordon CullenTownscape - Gordon Cullen
Townscape - Gordon Cullen
Proyectar Ciudad
ย 
Christopher alexander
Christopher alexanderChristopher alexander
Christopher alexander
krishnakanth mallikarjun
ย 
Analytical approach on design theories of christopher alexander
Analytical approach on design theories of christopher alexanderAnalytical approach on design theories of christopher alexander
Analytical approach on design theories of christopher alexander
Shabnam Golkarian
ย 
serial vision
serial visionserial vision
serial vision
Alshimaa Aboelmakarem Farag
ย 
Linux process management
Linux process managementLinux process management
Linux process management
Raghu nath
ย 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr
ย 
Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12Object Oriented Design in Software Engineering SE12
Object Oriented Design in Software Engineering SE12
koolkampus
ย 
Loving & Hating Christopher Alexander
Loving & Hating Christopher AlexanderLoving & Hating Christopher Alexander
Loving & Hating Christopher Alexander
Molly Steenson
ย 
Christopher Alexander: Elements Of Style
Christopher Alexander: Elements Of StyleChristopher Alexander: Elements Of Style
Christopher Alexander: Elements Of Style
Matthias Mueller-Prove
ย 
Traditional Serial Vision Excerpt
Traditional Serial Vision ExcerptTraditional Serial Vision Excerpt
Traditional Serial Vision Excerpt
sstannard
ย 
Townscape - Gordon Cullen V2
Townscape - Gordon Cullen V2Townscape - Gordon Cullen V2
Townscape - Gordon Cullen V2
Proyectar Ciudad
ย 
Townscape - Gordon Cullen
Townscape - Gordon CullenTownscape - Gordon Cullen
Townscape - Gordon Cullen
Proyectar Ciudad
ย 
Analytical approach on design theories of christopher alexander
Analytical approach on design theories of christopher alexanderAnalytical approach on design theories of christopher alexander
Analytical approach on design theories of christopher alexander
Shabnam Golkarian
ย 
Ad

Similar to Design patterns (20)

7494607
74946077494607
7494607
Luis Daniel Abelaira Huertos
ย 
Up to speed in domain driven design
Up to speed in domain driven designUp to speed in domain driven design
Up to speed in domain driven design
Rick van der Arend
ย 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
Ankit Dubey
ย 
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...
Anil Sharma
ย 
Gang of Four in Java
Gang of Four in Java Gang of Four in Java
Gang of Four in Java
Mina Tafreshi
ย 
OOP design patterns
OOP design patternsOOP design patterns
OOP design patterns
Igor Talevski
ย 
Oops design pattern_amitgupta
Oops design pattern_amitguptaOops design pattern_amitgupta
Oops design pattern_amitgupta
Amit Gupta, MCSD TOGAF
ย 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design Patterns
Michael Heron
ย 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
ZubairAhmedKHUSHK
ย 
Design Pattern - Introduction
Design Pattern - IntroductionDesign Pattern - Introduction
Design Pattern - Introduction
Mudasir Qazi
ย 
Unit iii design patterns 9
Unit iii design patterns 9Unit iii design patterns 9
Unit iii design patterns 9
kiruthikamurugesan2628
ย 
What is design pattern
What is design patternWhat is design pattern
What is design pattern
Md.Shohel Rana ( M.Sc in CSE Khulna University of Engineering & Technology (KUET))
ย 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns Course
Ahmed Soliman
ย 
Dino Esposito. Polyglot Persistence: From Architecture to Solutions
Dino Esposito. Polyglot Persistence: From Architecture to SolutionsDino Esposito. Polyglot Persistence: From Architecture to Solutions
Dino Esposito. Polyglot Persistence: From Architecture to Solutions
CodeFest
ย 
Design Patterns.ppt
Design Patterns.pptDesign Patterns.ppt
Design Patterns.ppt
TanishaKochak
ย 
11 ooad uml-14
11 ooad uml-1411 ooad uml-14
11 ooad uml-14
Niit Care
ย 
Design in construction
Design in constructionDesign in construction
Design in construction
Asha Sari
ย 
Design in construction
Design in constructionDesign in construction
Design in construction
Asha Sari
ย 
Design patterns
Design patternsDesign patterns
Design patterns
Oksana Demediuk
ย 
Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...
Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...
Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...
yashikanigam1
ย 
Up to speed in domain driven design
Up to speed in domain driven designUp to speed in domain driven design
Up to speed in domain driven design
Rick van der Arend
ย 
Module 2 design patterns-2
Module 2   design patterns-2Module 2   design patterns-2
Module 2 design patterns-2
Ankit Dubey
ย 
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...
Anil Sharma
ย 
Gang of Four in Java
Gang of Four in Java Gang of Four in Java
Gang of Four in Java
Mina Tafreshi
ย 
OOP design patterns
OOP design patternsOOP design patterns
OOP design patterns
Igor Talevski
ย 
Oops design pattern_amitgupta
Oops design pattern_amitguptaOops design pattern_amitgupta
Oops design pattern_amitgupta
Amit Gupta, MCSD TOGAF
ย 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design Patterns
Michael Heron
ย 
Design Pattern - Introduction
Design Pattern - IntroductionDesign Pattern - Introduction
Design Pattern - Introduction
Mudasir Qazi
ย 
Design Patterns Course
Design Patterns CourseDesign Patterns Course
Design Patterns Course
Ahmed Soliman
ย 
Dino Esposito. Polyglot Persistence: From Architecture to Solutions
Dino Esposito. Polyglot Persistence: From Architecture to SolutionsDino Esposito. Polyglot Persistence: From Architecture to Solutions
Dino Esposito. Polyglot Persistence: From Architecture to Solutions
CodeFest
ย 
Design Patterns.ppt
Design Patterns.pptDesign Patterns.ppt
Design Patterns.ppt
TanishaKochak
ย 
11 ooad uml-14
11 ooad uml-1411 ooad uml-14
11 ooad uml-14
Niit Care
ย 
Design in construction
Design in constructionDesign in construction
Design in construction
Asha Sari
ย 
Design in construction
Design in constructionDesign in construction
Design in construction
Asha Sari
ย 
Design patterns
Design patternsDesign patterns
Design patterns
Oksana Demediuk
ย 
Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...
Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...
Cracking Low-Level Design Interviews with Tutort Academy: Your Gateway to Tec...
yashikanigam1
ย 
Ad

Recently uploaded (20)

Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
ย 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
ย 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
ย 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
ย 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
ย 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
ย 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
ย 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
ย 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
ย 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
ย 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
ย 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
ย 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
ย 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
ย 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
ย 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
ย 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
ย 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
ย 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
ย 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
ย 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
ย 
Technology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data AnalyticsTechnology Trends in 2025: AI and Big Data Analytics
Technology Trends in 2025: AI and Big Data Analytics
InData Labs
ย 
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc Webinar: Consumer Expectations vs Corporate Realities on Data Broker...
TrustArc
ย 
Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025Splunk Security Update | Public Sector Summit Germany 2025
Splunk Security Update | Public Sector Summit Germany 2025
Splunk
ย 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
ย 
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager APIUiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPath Community Berlin: Orchestrator API, Swagger, and Test Manager API
UiPathCommunity
ย 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
ย 
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath MaestroDev Dives: Automate and orchestrate your processes with UiPath Maestro
Dev Dives: Automate and orchestrate your processes with UiPath Maestro
UiPathCommunity
ย 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
ย 
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdfThe Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
The Evolution of Meme Coins A New Era for Digital Currency ppt.pdf
Abi john
ย 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
ย 
Heap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and DeletionHeap, Types of Heap, Insertion and Deletion
Heap, Types of Heap, Insertion and Deletion
Jaydeep Kale
ย 
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
IEDM 2024 Tutorial2_Advances in CMOS Technologies and Future Directions for C...
organizerofv
ย 
Build Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For DevsBuild Your Own Copilot & Agents For Devs
Build Your Own Copilot & Agents For Devs
Brian McKeiver
ย 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
ย 
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptxIncreasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Increasing Retail Store Efficiency How can Planograms Save Time and Money.pptx
Anoop Ashok
ย 
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Massive Power Outage Hits Spain, Portugal, and France: Causes, Impact, and On...
Aqusag Technologies
ย 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
ย 
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdfSAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
SAP Modernization: Maximizing the Value of Your SAP S/4HANA Migration.pdf
Precisely
ย 
TrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business ConsultingTrsLabs - Fintech Product & Business Consulting
TrsLabs - Fintech Product & Business Consulting
Trs Labs
ย 

Design patterns

  • 1. Design Patterns Introduction and Overview By, Abhishek Sagi Monday 5 December 11
  • 2. Today Introduction to Design Patterns : What are they? Types of Patterns Examples : Commonly used patterns References Monday 5 December 11
  • 3. Design Patterns What are they? Monday 5 December 11
  • 4. Design Patterns Idea originated from Christopher Wolfgang Alexander (Austria). Architect It was initially applied for architecture for buildings and towns, But not computer programming for writing software. Monday 5 December 11
  • 5. "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 way twiceโ€ -Christopher Alexander (Architect) โ€œA Pattern Languageโ€,New York, Oxford University Press, 1977. Monday 5 December 11
  • 6. Design Patterns Even through he was talking about patterns in buildings and towns, What he says is true about object-oriented design patterns. Solutions are expressed in terms of objects and interfaces instead of walls and doors. At core both patterns is a solution to a problem in a context. Simply, design patterns help a designer to get a right design faster. Monday 5 December 11
  • 7. Describes a design pattern as a three-part rule 1.) Description of a context 2.) A problem 3.) A solution This is modi๏ฌed for software design patterns which consists of four parts Monday 5 December 11
  • 8. Four Essential Parts Pattern name A handle to brie๏ฌ‚y describe the design problem,but more importantly to provide a common vocabulary for software designers to use. Problem A description of the problem that the design pattern is intended to solve. Monday 5 December 11
  • 9. Solution Describes what elements are required to make up the design, their relationships and its context. Consequences What are the results and trade offs by applying the design pattern. Allows comparison between different design patterns, to see if there is a better ๏ฌt for the actual problem. Monday 5 December 11
  • 10. Design Patterns : Programming Languages Aimed towards languages that have language level support for Object Oriented Programming Not exclusively , But it would be easier to apply with OOP! Different OOP languages have different mechanisms for applying patterns. Monday 5 December 11
  • 11. Types Of Patterns General description of the type of problem the pattern addresses Creational: Concerned with everything about the creation of objects Structural: Concerned with how classes and objects are composed to form larger structures Monday 5 December 11
  • 12. Types Of Patterns (Continued) Behavioral Concerned with algorithms and the assignment of responsibilities between objects. Monday 5 December 11
  • 13. Types Of Patterns (Overview) Creational: Creational patterns are ones that create objects for you, rather than having you instantiate objects directly. This gives your program more ๏ฌ‚exibility in deciding which objects need to be created for a given case. Abstract Factory*: Groups object factories that have a common theme. Builder constructs: Complex objects by separating construction and representation. Factory Method*: Creates objects without specifying the exact class to create. Prototype: Creates objects by cloning an existing object. Singleton*: Restricts object creation for a class to only one instance. Monday 5 December 11
  • 14. Types Of Patterns (Contd) Structural Patterns: These concern class and object composition. They use inheritance to compose interfaces and de๏ฌne ways to compose objects to obtain new functionality. Adapter: Allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class. Bridge*: Decouples an abstraction from its implementation so that the two can vary independently. Composite: Composes zero-or-more similar objects so that they can be manipulated as one object. Decorator: Dynamically adds/overrides behavior in an existing method of an object. Monday 5 December 11
  • 15. Types Of Patterns (Contd) Facade: Provides a simpli๏ฌed interface to a large body of code. Flyweight: Reduces the cost of creating and manipulating a large number of similar objects. Proxy: Provides a placeholder for another object to control access, reduce cost, and reduce complexity. Behavioral Patterns: Most of these design patterns are speci๏ฌcally concerned with communication between objects. Chain of responsibility: Delegates commands to a chain of processing objects. Command: Creates objects which encapsulate actions and parameters. Interpreter: Implements a specialized language. Monday 5 December 11
  • 16. Types Of Patterns (Contd) Iterator*: Accesses the elements of an object sequentially without exposing its underlying representation. Mediator: Allows loose coupling between classes by being the only class that has detailed knowledge of their methods. Memento: Provides the ability to restore an object to its previous state (undo). Observer: Is a publish/subscribe pattern which allows a number of observer objects to see an event. State*: Allows an object to alter its behavior when its internal state changes. Strategy: Allows one of a family of algorithms to be selected on-the-๏ฌ‚y at runtime. Monday 5 December 11
  • 17. Design Pattern Example 1: The Singleton Monday 5 December 11
  • 18. Singleton Creational category of design patterns Intent: Ensure that a class has only once instance, And provide global point of access to it. Motivation: Important for some classes to have no more than one instance. Examples: Console in a game; Logging utility; An Application Class; A Window Manager. Monday 5 December 11
  • 19. Singleton Code Example Monday 5 December 11
  • 20. Design Pattern Example 2: State Pattern Monday 5 December 11
  • 21. State Pattern Behavioral category of design patterns Provides behavior to an object so that it can be changed during runtime. Very similar to bridge pattern but intention is different Bridge is structural : Hide data from client client only aware of the handle State is behavioral : Provides ๏ฌ‚exible behavior of owning object and client would be aware of both owning object and state objects. Monday 5 December 11
  • 22. State Pattern: Approaches Application decide Requires state transition Implies constraints, And less ๏ฌ‚exible states are unaware of each other States decide Most ๏ฌ‚exible approach States are aware of each other Implementation dependencies between state code Monday 5 December 11
  • 23. State creation/destruction: 2 Approaches: As Needed States are created on the ๏ฌ‚y Destroyed when no longer need - can be expensive Conserves memory Preferable where state changes are infrequent States created in advance (Compile time) Destroyed only when application terminates - CHEAP! Memory usage - COSTLY! (all data stored in states are created upfront) Preferable where state changes are frequent Monday 5 December 11
  • 24. State Pattern Code Example Monday 5 December 11
  • 25. Recommended Books Design Patterns: Elements of Reusable Object-Oriented Software Authors: โ€œGang of fourโ€ Hardback: 416 pages Publisher: Addison Wesley (14 Mar 1995) C++ ISBN-10: 0201633612 ISBN-13: 978-0201633610 Head First: Design Patterns Authors: Several Paperback: 688 pages Publisher: O'Reilly Media (25 Oct 2004) Java ISBN-10: 0596007124 ISBN-13: 978-0596007126 Monday 5 December 11
  • 26. Questions? Contact: Sharat Chandra (or) Tushar Goswami Email: [email protected] Monday 5 December 11
  • 27. References Design Patterns: Introduction To Design Patterns; Steven Mead , Senior Programming Lecturer , University Of Teesside ; 2010 . Design Patterns: Elements of Reusable Object- Oriented Software; Erich Gamma et al; Addison- Wesley; 1995; 978-0201633610. http://en.wikipedia.org/wiki/Design_Patterns Big C++ (2nd edition); Cay Horstmann; Timothy Budd; John Wiley & Sons; January 2009; 978- 0470383285. Monday 5 December 11
  • 28. Thank you J๏Š Monday 5 December 11