SlideShare a Scribd company logo
Deep Dive Design pattern
Rajeev Gupta
rgupta.mtech@gmail.com
Java Trainer & consultant
@rajeev_gupta76
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
Pillors of OO
● Abstraction
● Encapsulation
● Modularity
● Hierarchy
Abstraction
Encapsulation
● Changing data in organized way, by using data
hiding and appying business constraints
● Encapsulation= data hiding + constraints
Abstraction vs Abstraction
Modularity
Hierarchy
UML 101
GOF Design pattern with java
We write code that is ...
GOF Design pattern with java
So WHY SOLID?
It helps us to write code that is ...
● Loosely coupled
● Highly cohesive
● Easily composable
● Reusable
SOLID
SOLID
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
GOF Design pattern with java
Design pattern
• Proven way of doing
things
• Gang of 4 design
patterns ???
• total 23 patterns
• Classification patterns
1. Creational
2. Structural
3. Behavioral
GOF Design pattern with java
GOF Design pattern with java
Patterns classification
• Creational patterns?
 What is the best way to create object as per requirment
• Structural patterns?
 Structural Patterns describe how objects and classes can
be combined to form larger structures
• Behavioral Patterns?
 Behavioral patterns are those which are concerned with
interactions between the objects ( talking to each other
still loosely coupled)
GOF Design pattern with java
Singleton Design Pattern
Singleton Design Consideration
# Eager initialization
# Static block initialization
# Lazy Initialization
# Thread Safe Singleton
# Serialization issue
# Cloning issue
# Using Reflection to destroy Singleton Pattern
# Enum Singleton
# Best programming practices
Factory design pattern
Abstract Factory
Builder Pattern
The Builder pattern can be used to ease the
construction of a complex object from simple objects.
java.lang.StringBuilder#append() (unsynchronized)
java.lang.StringBuffer#append() (synchronized)
Prototype Pattern
Cloning of an object to avoid creation. If the cost of creating
a new object is large and creation is resource intensive, we
clone the object.
GOF Design pattern with java
Adapter Pattern
The Adapter pattern is used so that two unrelated interfaces can
work together.
Decorator design pattern
Series of wrapper class that define functionality, In the Decorator
pattern, a decorator object is wrapped around the original object.
Proxy design pattern
Facade pattern
GOF Design pattern with java
Iterator design pattern
Strategy pattern /policy pattern
Chain of Responsibility
Chain of responsibility pattern is used to achieve loose
coupling in software design where a request from client is
passed to a chain of objects to process them.
Observer Design pattern
Observer design pattern is useful when you are interested in
the state of an object and want to get notified whenever there
is any change.
Template Design Pattern
GOF Design pattern with java
Library vs Framework

More Related Content

PDF
Gof design pattern
PPTX
Gof design patterns
PDF
Basic design pattern interview questions
PDF
Lecture 5 Software Engineering and Design Design Patterns
PPT
JAVA design patterns and Basic OOp concepts
PPTX
DOCX
Java Design Pattern Interview Questions
PDF
Design patterns difference between interview questions
Gof design pattern
Gof design patterns
Basic design pattern interview questions
Lecture 5 Software Engineering and Design Design Patterns
JAVA design patterns and Basic OOp concepts
Java Design Pattern Interview Questions
Design patterns difference between interview questions

What's hot (20)

PPTX
Let us understand design pattern
PDF
Gof Design Pattern
PPT
Software Design Patterns
PPT
Design Pattern For C# Part 1
PPTX
GoF Design patterns I: Introduction + Structural Patterns
PDF
Design patterns
PPTX
Design patterns
PDF
Software Design Patterns. Part I :: Structural Patterns
PPT
Design patterns ppt
PPTX
How I Learned To Apply Design Patterns
PPT
Design Patterns
PPTX
PATTERNS04 - Structural Design Patterns
PPT
Design patterns
PDF
Design patterns tutorials
PPT
Design Patterns (Examples in .NET)
PDF
Introduction to Design Pattern
PPTX
Behavioral pattern By:-Priyanka Pradhan
PPTX
Composite design pattern
PDF
Creational Design Patterns
Let us understand design pattern
Gof Design Pattern
Software Design Patterns
Design Pattern For C# Part 1
GoF Design patterns I: Introduction + Structural Patterns
Design patterns
Design patterns
Software Design Patterns. Part I :: Structural Patterns
Design patterns ppt
How I Learned To Apply Design Patterns
Design Patterns
PATTERNS04 - Structural Design Patterns
Design patterns
Design patterns tutorials
Design Patterns (Examples in .NET)
Introduction to Design Pattern
Behavioral pattern By:-Priyanka Pradhan
Composite design pattern
Creational Design Patterns
Ad

Similar to GOF Design pattern with java (20)

PDF
Why Design Patterns Are Important In Software Engineering
PDF
Gang of Four in Java
DOCX
Patterns (contd)Software Development ProcessDesign patte.docx
PDF
Java Design Patterns Interview Questions PDF By ScholarHat
PPT
P Training Presentation
PPTX
Software Architecture and Design Patterns Notes.pptx
PPTX
OOPSDesign PPT ( introduction to opps and design (
PPTX
How to design an application correctly ?
PPT
Design Patterns
PDF
software engineering Design Patterns.pdf
PPTX
note2_DesignPatterns (1).pptx
PPT
Introduction to design_patterns
PDF
Design Patterns Java programming language.pdf
PPTX
Creational Design Patterns.pptx
PDF
Java Design Patterns Tutorial | Edureka
PDF
Design Patterns - GOF
PPTX
Design Patterns
PPTX
Software design and Architecture.pptx
PPT
Oops design pattern intro
PDF
Mastering Design Patterns in Java: A Comprehensive Guide
Why Design Patterns Are Important In Software Engineering
Gang of Four in Java
Patterns (contd)Software Development ProcessDesign patte.docx
Java Design Patterns Interview Questions PDF By ScholarHat
P Training Presentation
Software Architecture and Design Patterns Notes.pptx
OOPSDesign PPT ( introduction to opps and design (
How to design an application correctly ?
Design Patterns
software engineering Design Patterns.pdf
note2_DesignPatterns (1).pptx
Introduction to design_patterns
Design Patterns Java programming language.pdf
Creational Design Patterns.pptx
Java Design Patterns Tutorial | Edureka
Design Patterns - GOF
Design Patterns
Software design and Architecture.pptx
Oops design pattern intro
Mastering Design Patterns in Java: A Comprehensive Guide
Ad

More from Rajiv Gupta (18)

PDF
Spring5 hibernate5 security5 lab step by step
PPTX
1. java script language fundamentals
PDF
Introduction to jsf2
PDF
Hibernate 3
PDF
Weblogic 11g admin basic with screencast
PDF
Struts2
PDF
jsf2 Notes
PDF
Java 7
PDF
Struts2 notes
PDF
Lab work servlets and jsp
PPT
Java Servlet
PDF
Spring aop with aspect j
PDF
Spring 3.0 dependancy injection
PDF
Java spring framework
TXT
Jsp Notes
PDF
Java Logging discussion Log4j,Slf4j
TXT
Advance C++notes
PDF
Core java 5 days workshop stuff
Spring5 hibernate5 security5 lab step by step
1. java script language fundamentals
Introduction to jsf2
Hibernate 3
Weblogic 11g admin basic with screencast
Struts2
jsf2 Notes
Java 7
Struts2 notes
Lab work servlets and jsp
Java Servlet
Spring aop with aspect j
Spring 3.0 dependancy injection
Java spring framework
Jsp Notes
Java Logging discussion Log4j,Slf4j
Advance C++notes
Core java 5 days workshop stuff

Recently uploaded (20)

PDF
Structs to JSON How Go Powers REST APIs.pdf
PDF
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
PPTX
TE-AI-Unit VI notes using planning model
PDF
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
PPTX
AgentX UiPath Community Webinar series - Delhi
PDF
Top 10 read articles In Managing Information Technology.pdf
PDF
dse_final_merit_2025_26 gtgfffffcjjjuuyy
PDF
July 2025: Top 10 Read Articles Advanced Information Technology
PPTX
Lesson 3_Tessellation.pptx finite Mathematics
PPTX
Security-Responsibilities-in-the-Cloud-Azure-Shared-Responsibility-Model.pptx
PDF
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
PPTX
Chapter----five---Resource Recovery.pptx
PPT
Chapter 6 Design in software Engineeing.ppt
PPTX
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
PDF
International Journal of Information Technology Convergence and Services (IJI...
PDF
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
PPT
High Data Link Control Protocol in Data Link Layer
PPTX
24AI201_AI_Unit_4 (1).pptx Artificial intelligence
Structs to JSON How Go Powers REST APIs.pdf
Traditional Exams vs Continuous Assessment in Boarding Schools.pdf
TE-AI-Unit VI notes using planning model
algorithms-16-00088-v2hghjjnjnhhhnnjhj.pdf
AgentX UiPath Community Webinar series - Delhi
Top 10 read articles In Managing Information Technology.pdf
dse_final_merit_2025_26 gtgfffffcjjjuuyy
July 2025: Top 10 Read Articles Advanced Information Technology
Lesson 3_Tessellation.pptx finite Mathematics
Security-Responsibilities-in-the-Cloud-Azure-Shared-Responsibility-Model.pptx
A Framework for Securing Personal Data Shared by Users on the Digital Platforms
Chapter----five---Resource Recovery.pptx
Chapter 6 Design in software Engineeing.ppt
KTU 2019 -S7-MCN 401 MODULE 2-VINAY.pptx
International Journal of Information Technology Convergence and Services (IJI...
Monitoring Global Terrestrial Surface Water Height using Remote Sensing - ARS...
High Data Link Control Protocol in Data Link Layer
24AI201_AI_Unit_4 (1).pptx Artificial intelligence

GOF Design pattern with java