SlideShare a Scribd company logo
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co
TYPES OF DESIGN PATTERNS
STRUCTURE OF DESIGN PATTERNS
WHAT ARE DESIGN PATTERNS?
WHY DO WE NEED DESIGN PATTERNS IN JAVA?
OVERVIEW OF DESIGN PATTERNS
WHY DO WE NEED DESIGN PATTERNS?
www.edureka.co
WHY DO WE NEED DESIGN PATTERNS?
www.edureka.co
OOP solutions
Easy to Maintain
Efficient
WHAT ARE DESIGN PATTERNS?
www.edureka.co
WHAT ARE DESIGN PATTERNS?
Software Design Pattern can be defined as a software
template or a description to solve a problem that
occurs in multiple instances while designing a Software
Application or a Software Framework.
DESIGNPATTERN
www.edureka.co
STRUCTURE OF DESIGN PATTERNS
www.edureka.co
STRUCTURE OF DESIGN PATTERNS
Structure of Design Patterns can be described as a graphical representation of the classes
involved in the pattern following the notations of Object Modeling Technique (OMT).
Term Description
Pattern Name Describes the essence of the pattern in a short, but expressive name.
Intent Describes what the Pattern Does
Also, known as List any synonyms of the pattern
Motivation Provides an example of the problem and describes the solution to it
Applicability Lists the situations where the pattern is applicable
Structure Set of diagrams of the classes and objects that depict the pattern
Participants Describes the classes and objects that participate in the design
Collaborations Describes the Participants collaboration and their responsibilities.
Consequences Describes the forces that exist with the pattern and the benefits
www.edureka.co
TYPES OF DESIGN PATTERNS
www.edureka.co
TYPES OF DESIGN PATTERNS
Creational Design Patterns
Structural Design Patterns
Behavioral Design Patterns
JEE Design Patterns
www.edureka.co
Creational Design Patterns
Creational Design Patterns are concerned with the method of
creating Objects.
The Creational Design Patterns are classified as follows:
• Factory Design Pattern
• Abstract Factory Pattern
• Singleton Pattern
• Prototype Pattern
• Builder Pattern.
• Object Pool Pattern
www.edureka.co
CREATIONAL DESIGN PATTERNS
Factory Design Pattern
Factory Design Pattern: It follows the principle of “Define an interface or
abstract class for creating an object but let the subclasses decide which
class to instantiate“. The Factory Method Pattern is also known as Virtual
Constructor.
www.edureka.co
CREATIONAL DESIGN PATTERNS
Factory Design Pattern Example
Example: We have three Cellular Network
Plan which describes the call cost per minute.
Here we have three different networks
namely, abcNetwork, pqrNetwork, and
xyzNetwork along with their charges per
minute. Let us find out the cost of a certain
number of minutes on each network.
www.edureka.co
Java Design Patterns Tutorial | Edureka
CREATIONAL DESIGN PATTERNS
Singleton Design Pattern
Singleton Design Pattern: It follows “define a class that has only one
instance and provides a global point of access to it“. The class must ensure
that only a single instance should be created, and a single object can be
used by all other classes.
www.edureka.co
CREATIONAL DESIGN PATTERNS
Singleton Design Pattern Example
www.edureka.co
Example: We have a MySQL Database. Let us
insert data into the database using one single
object instance. Here, we have 4 different
operations that are performed onto the
database and all of those operations use
one single object instance.
Java Design Patterns Tutorial | Edureka
Structural Design Patterns
Structural Design Patterns deal with the composition of classes
and objects which form larger structures.
The Structural Design Patterns are further classified as follows:
• Facade Pattern
• Bridge Pattern
• Composite Pattern
• Decorator Pattern
• Adapter Pattern
• Flyweight Pattern
• Proxy Pattern
• Filter Pattern
www.edureka.co
STRUCTURAL DESIGN PATTERNS
Facade Design Pattern
Facade Design Pattern: Describes a higher-level interface that makes the
subsystem easier to use. Every Abstract Factory is a Facade Design Pattern.
It protects the end-users from the complex sub-system components.
www.edureka.co
STRUCTURAL DESIGN PATTERNS
Facade Design Pattern Example
www.edureka.co
Example: Now, let us use the Facade Design
pattern to find out the cost of the franchise you
wish to buy.
Java Design Patterns Tutorial | Edureka
STRUCTURAL DESIGN PATTERNS
Adapter Design Pattern
Adapter Design Pattern: Provides the interface according to client
requirement while using the services of a class with a different
interface. The Adapter Pattern is also known as Wrapper. It is designed to
enable two or more previously incompatible objects to interact with each
other.
www.edureka.co
STRUCTURAL DESIGN PATTERNS
Adapter Design Pattern Example
www.edureka.co
Example: Here is a simple Library Card example
which is designed to issue a Library card to a
new user of the library which includes all the
details like a book holder ID, Account number
and many more. Let us execute this
using Adapter Design Pattern.
Java Design Patterns Tutorial | Edureka
Behavioural Design Patterns
Behavior Design Patterns are concerned with the responsibility
and interaction between the objects.
The Behavioural Design Patterns are further classified as follows:
• Strategy Pattern
• Iterator Pattern
• Mediator Pattern
• Command Pattern
• State Pattern
• Observer Pattern
• Template Pattern
• Visitor Pattern
www.edureka.co
BEHAVIOURAL DESIGN PATTERNS
Strategy Design Pattern
Strategy Design Pattern: It defines a family of functionality and encapsulates
each one and make them interchangeable. The Strategy Pattern is also known
as Policy.
www.edureka.co
BEHAVIOURAL DESIGN PATTERNS
Strategy Design Pattern Example
www.edureka.co
Example: we are going to consider a simple
example of a calculator. We need to perform five
different operations. We shall encapsulate all
those five operations into Calculator class and
execute the program using the Strategy Design
Pattern.
Java Design Patterns Tutorial | Edureka
BEHAVIOURAL DESIGN PATTERNS
Command Design Pattern
Command Design Pattern: It encapsulates a request under an object as a
command and passes it to the invoker object. Invoker object looks for the
appropriate object which can handle this command and pass the command
to the corresponding object and that object executes the command. It is
also known as Action or Transaction.
www.edureka.co
BEHAVIOURAL DESIGN PATTERNS
Command Design Pattern Example
www.edureka.co
Example: This example demonstrates a simple
command execution cycle where the user
requires to exhibit switching on and off the
various electronic devices in his houses like
a bulb and stereo player. He invokes the
command through an invoker object called
a simple remote control.
Java Design Patterns Tutorial | Edureka
BEHAVIOURAL DESIGN PATTERNS
Observer Design Pattern
Observer Design Pattern: It defines a one-to-one dependency so that
when one object changes state, all its dependents are notified and updated
automatically.
www.edureka.co
BEHAVIOURAL DESIGN PATTERNS
Observer Design Pattern Example
www.edureka.co
Example: We are going to execute a program
using the Observer Design Pattern to display
the current average score and the current
predictable score of a cricket match.
Java Design Patterns Tutorial | Edureka
JEE Design Patterns
JEE Design Patterns are concerned with providing solutions to the
Java EE-based software applications and frameworks.
The JEE Design Patterns are further classified as follows:
• MVC Design Pattern
• Dependency Injection Pattern
• DAO Design Pattern
• Business Delegate Pattern
• Intercepting Filter Pattern
• Service Locator Pattern
• Transfer Object Pattern
www.edureka.co
JEE DESIGN PATTERNS
MVC Design Pattern
MVC Design Pattern: MVC Design Pattern is defined as follows:
• Models are basically objects used as blueprints for all of the objects that
will be used in the application.
• Views are used to represent the presentational aspect of the
information and data located in the models.
• Controllers control and act as both of the Models as well as Views. They
serve as a connection between the Models and Views.
www.edureka.co
JEE DESIGN PATTERNS
MVC Design Pattern Example
www.edureka.co
Example: We are going to use MVC Design
Pattern to set and print the data of the school
students.
Java Design Patterns Tutorial | Edureka
JEE DESIGN PATTERNS
DAO Design Pattern
DAO Design Pattern: DAO is a pattern in which objects are dedicated to the
communication with the Data Layer. These objects instantiate “Session
Factories” and handle all of the logic behind communicating with the
database.
www.edureka.co
JEE DESIGN PATTERNS
DAO Design Pattern Example
www.edureka.co
Example: We are going display the Developer
details of a certain IT company using the DAO
Design Pattern.
Java Design Patterns Tutorial | Edureka
OVERVIEW OF DESIGN PATTERNS
www.edureka.co
OVERVIEW OF DESIGN PATTERNS
• They are designed to be reusable in multiple projects.
• Their solutions help to define system architecture with ease.
• Design Patterns can capture the software engineering experiences.
• They provide transparency to the design of an application.
• Design Patterns are well-proven solutions given by Experts.
• Java Design Patterns provide clarity to the System Architecture
• They provide the possibility of building a better system.
www.edureka.co
Copyright © 2017, edureka and/or its affiliates. All rights reserved.
www.edureka.co

More Related Content

PDF
Solid principles
Kumaresh Chandra Baruri
 
PDF
Gof design pattern
naveen kumar
 
PPTX
Let us understand design pattern
Mindfire Solutions
 
PPTX
Creational pattern
Himanshu
 
PPT
Introduction to design patterns
Amit Kabra
 
PPTX
Gof design patterns
Srikanth R Vaka
 
PPT
Design patterns ppt
Aman Jain
 
PPTX
SOLID - Principles of Object Oriented Design
Riccardo Cardin
 
Solid principles
Kumaresh Chandra Baruri
 
Gof design pattern
naveen kumar
 
Let us understand design pattern
Mindfire Solutions
 
Creational pattern
Himanshu
 
Introduction to design patterns
Amit Kabra
 
Gof design patterns
Srikanth R Vaka
 
Design patterns ppt
Aman Jain
 
SOLID - Principles of Object Oriented Design
Riccardo Cardin
 

What's hot (20)

PPTX
Event Handling in java
Google
 
PPTX
Java 8 Lambda and Streams
Venkata Naga Ravi
 
PPT
Developing an ASP.NET Web Application
Rishi Kothari
 
PPTX
Packages in java
Elizabeth alexander
 
PPTX
Java Server Pages(jsp)
Manisha Keim
 
PPT
Singleton design pattern
11prasoon
 
PPTX
Design pattern-presentation
Rana Muhammad Asif
 
PPTX
JAVA AWT
shanmuga rajan
 
PPTX
Servlets
Akshay Ballarpure
 
PDF
Java Thread Synchronization
Benj Del Mundo
 
PPTX
Spring Boot Tutorial
Naphachara Rattanawilai
 
PDF
Asp.net state management
priya Nithya
 
PDF
jQuery for beginners
Arulmurugan Rajaraman
 
PPTX
Design Pattern - Singleton Pattern
Mudasir Qazi
 
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
PPTX
Introduction to React JS
Arnold Asllani
 
PPTX
Java - Generic programming
Riccardo Cardin
 
PPTX
Introduction to Spring Framework
Serhat Can
 
PPTX
PHP FUNCTIONS
Zeeshan Ahmed
 
Event Handling in java
Google
 
Java 8 Lambda and Streams
Venkata Naga Ravi
 
Developing an ASP.NET Web Application
Rishi Kothari
 
Packages in java
Elizabeth alexander
 
Java Server Pages(jsp)
Manisha Keim
 
Singleton design pattern
11prasoon
 
Design pattern-presentation
Rana Muhammad Asif
 
JAVA AWT
shanmuga rajan
 
Java Thread Synchronization
Benj Del Mundo
 
Spring Boot Tutorial
Naphachara Rattanawilai
 
Asp.net state management
priya Nithya
 
jQuery for beginners
Arulmurugan Rajaraman
 
Design Pattern - Singleton Pattern
Mudasir Qazi
 
Basic Concepts of OOPs (Object Oriented Programming in Java)
Michelle Anne Meralpis
 
Introduction to React JS
Arnold Asllani
 
Java - Generic programming
Riccardo Cardin
 
Introduction to Spring Framework
Serhat Can
 
PHP FUNCTIONS
Zeeshan Ahmed
 
Ad

Similar to Java Design Patterns Tutorial | Edureka (20)

PPTX
Design patterns
Kolade Ibrahim Arowolo
 
PPTX
Design Pattern - Introduction
Mudasir Qazi
 
PPT
Design patterns
Mobicules Technologies
 
PDF
Webinar: Design Patterns : Tailor-made solutions for Software Development
Edureka!
 
PDF
Design Patterns Java programming language.pdf
totallyrealmail420
 
PPT
5 Design Patterns Explained
Prabhjit Singh
 
PPS
Design Patterns For 70% Of Programmers In The World
Saurabh Moody
 
PDF
Design Patterns - The Ultimate Blueprint for Software
Edureka!
 
PDF
Java Design Patterns Interview Questions PDF By ScholarHat
Scholarhat
 
PPTX
Design patterns Structural
UMAR ALI
 
PPTX
Design patterns
Akhilesh Gupta
 
PPTX
C# Design Patterns | Design Pattern Tutorial For Beginners | C# Programming T...
Simplilearn
 
PPTX
Sofwear deasign and need of design pattern
chetankane
 
PPTX
Design Patterns - General Introduction
Asma CHERIF
 
PPTX
ap assignmnet presentation.pptx
AwanAdhikari
 
PPTX
sample Pattern Design explaine .pptx
mbabaqi2020
 
PPTX
Design pattern of software words computer .pptx
muslimpari2503
 
PDF
software engineering Design Patterns.pdf
mulugetaberihun3
 
PPTX
Design patterns
F(x) Data Labs Pvt Ltd
 
PPT
Oops design pattern intro
anshu_atri
 
Design patterns
Kolade Ibrahim Arowolo
 
Design Pattern - Introduction
Mudasir Qazi
 
Design patterns
Mobicules Technologies
 
Webinar: Design Patterns : Tailor-made solutions for Software Development
Edureka!
 
Design Patterns Java programming language.pdf
totallyrealmail420
 
5 Design Patterns Explained
Prabhjit Singh
 
Design Patterns For 70% Of Programmers In The World
Saurabh Moody
 
Design Patterns - The Ultimate Blueprint for Software
Edureka!
 
Java Design Patterns Interview Questions PDF By ScholarHat
Scholarhat
 
Design patterns Structural
UMAR ALI
 
Design patterns
Akhilesh Gupta
 
C# Design Patterns | Design Pattern Tutorial For Beginners | C# Programming T...
Simplilearn
 
Sofwear deasign and need of design pattern
chetankane
 
Design Patterns - General Introduction
Asma CHERIF
 
ap assignmnet presentation.pptx
AwanAdhikari
 
sample Pattern Design explaine .pptx
mbabaqi2020
 
Design pattern of software words computer .pptx
muslimpari2503
 
software engineering Design Patterns.pdf
mulugetaberihun3
 
Design patterns
F(x) Data Labs Pvt Ltd
 
Oops design pattern intro
anshu_atri
 
Ad

More from Edureka! (20)

PDF
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
PDF
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
PDF
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
PDF
Tableau Tutorial for Data Science | Edureka
Edureka!
 
PDF
Python Programming Tutorial | Edureka
Edureka!
 
PDF
Top 5 PMP Certifications | Edureka
Edureka!
 
PDF
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
PDF
Linux Mint Tutorial | Edureka
Edureka!
 
PDF
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
PDF
Importance of Digital Marketing | Edureka
Edureka!
 
PDF
RPA in 2020 | Edureka
Edureka!
 
PDF
Email Notifications in Jenkins | Edureka
Edureka!
 
PDF
EA Algorithm in Machine Learning | Edureka
Edureka!
 
PDF
Cognitive AI Tutorial | Edureka
Edureka!
 
PDF
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
PDF
Blue Prism Top Interview Questions | Edureka
Edureka!
 
PDF
Big Data on AWS Tutorial | Edureka
Edureka!
 
PDF
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
PDF
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
PDF
Introduction to DevOps | Edureka
Edureka!
 
What to learn during the 21 days Lockdown | Edureka
Edureka!
 
Top 10 Dying Programming Languages in 2020 | Edureka
Edureka!
 
Top 5 Trending Business Intelligence Tools | Edureka
Edureka!
 
Tableau Tutorial for Data Science | Edureka
Edureka!
 
Python Programming Tutorial | Edureka
Edureka!
 
Top 5 PMP Certifications | Edureka
Edureka!
 
Top Maven Interview Questions in 2020 | Edureka
Edureka!
 
Linux Mint Tutorial | Edureka
Edureka!
 
How to Deploy Java Web App in AWS| Edureka
Edureka!
 
Importance of Digital Marketing | Edureka
Edureka!
 
RPA in 2020 | Edureka
Edureka!
 
Email Notifications in Jenkins | Edureka
Edureka!
 
EA Algorithm in Machine Learning | Edureka
Edureka!
 
Cognitive AI Tutorial | Edureka
Edureka!
 
AWS Cloud Practitioner Tutorial | Edureka
Edureka!
 
Blue Prism Top Interview Questions | Edureka
Edureka!
 
Big Data on AWS Tutorial | Edureka
Edureka!
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
Edureka!
 
Kubernetes Installation on Ubuntu | Edureka
Edureka!
 
Introduction to DevOps | Edureka
Edureka!
 

Recently uploaded (20)

PDF
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
PPTX
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
PDF
Software Development Methodologies in 2025
KodekX
 
PDF
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
PDF
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
PPTX
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
PDF
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
PDF
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
PPT
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PDF
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
PDF
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
PDF
Software Development Company | KodekX
KodekX
 
PDF
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
PDF
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
PDF
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
PDF
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
PPTX
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
PPTX
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
PDF
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 
Event Presentation Google Cloud Next Extended 2025
minhtrietgect
 
Dev Dives: Automate, test, and deploy in one place—with Unified Developer Exp...
AndreeaTom
 
Software Development Methodologies in 2025
KodekX
 
Automating ArcGIS Content Discovery with FME: A Real World Use Case
Safe Software
 
Data_Analytics_vs_Data_Science_vs_BI_by_CA_Suvidha_Chaplot.pdf
CA Suvidha Chaplot
 
IoT Sensor Integration 2025 Powering Smart Tech and Industrial Automation.pptx
Rejig Digital
 
How-Cloud-Computing-Impacts-Businesses-in-2025-and-Beyond.pdf
Artjoker Software Development Company
 
Research-Fundamentals-and-Topic-Development.pdf
ayesha butalia
 
Coupa-Kickoff-Meeting-Template presentai
annapureddyn
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
MASTERDECK GRAPHSUMMIT SYDNEY (Public).pdf
Neo4j
 
Orbitly Pitch Deck|A Mission-Driven Platform for Side Project Collaboration (...
zz41354899
 
Software Development Company | KodekX
KodekX
 
SparkLabs Primer on Artificial Intelligence 2025
SparkLabs Group
 
Presentation about Hardware and Software in Computer
snehamodhawadiya
 
Cloud-Migration-Best-Practices-A-Practical-Guide-to-AWS-Azure-and-Google-Clou...
Artjoker Software Development Company
 
Accelerating Oracle Database 23ai Troubleshooting with Oracle AHF Fleet Insig...
Sandesh Rao
 
Applied-Statistics-Mastering-Data-Driven-Decisions.pptx
parmaryashparmaryash
 
AI and Robotics for Human Well-being.pptx
JAYMIN SUTHAR
 
Oracle AI Vector Search- Getting Started and what's new in 2025- AIOUG Yatra ...
Sandesh Rao
 

Java Design Patterns Tutorial | Edureka

  • 1. Copyright © 2017, edureka and/or its affiliates. All rights reserved.
  • 2. www.edureka.co TYPES OF DESIGN PATTERNS STRUCTURE OF DESIGN PATTERNS WHAT ARE DESIGN PATTERNS? WHY DO WE NEED DESIGN PATTERNS IN JAVA? OVERVIEW OF DESIGN PATTERNS
  • 3. WHY DO WE NEED DESIGN PATTERNS? www.edureka.co
  • 4. WHY DO WE NEED DESIGN PATTERNS? www.edureka.co OOP solutions Easy to Maintain Efficient
  • 5. WHAT ARE DESIGN PATTERNS? www.edureka.co
  • 6. WHAT ARE DESIGN PATTERNS? Software Design Pattern can be defined as a software template or a description to solve a problem that occurs in multiple instances while designing a Software Application or a Software Framework. DESIGNPATTERN www.edureka.co
  • 7. STRUCTURE OF DESIGN PATTERNS www.edureka.co
  • 8. STRUCTURE OF DESIGN PATTERNS Structure of Design Patterns can be described as a graphical representation of the classes involved in the pattern following the notations of Object Modeling Technique (OMT). Term Description Pattern Name Describes the essence of the pattern in a short, but expressive name. Intent Describes what the Pattern Does Also, known as List any synonyms of the pattern Motivation Provides an example of the problem and describes the solution to it Applicability Lists the situations where the pattern is applicable Structure Set of diagrams of the classes and objects that depict the pattern Participants Describes the classes and objects that participate in the design Collaborations Describes the Participants collaboration and their responsibilities. Consequences Describes the forces that exist with the pattern and the benefits www.edureka.co
  • 9. TYPES OF DESIGN PATTERNS www.edureka.co
  • 10. TYPES OF DESIGN PATTERNS Creational Design Patterns Structural Design Patterns Behavioral Design Patterns JEE Design Patterns www.edureka.co
  • 11. Creational Design Patterns Creational Design Patterns are concerned with the method of creating Objects. The Creational Design Patterns are classified as follows: • Factory Design Pattern • Abstract Factory Pattern • Singleton Pattern • Prototype Pattern • Builder Pattern. • Object Pool Pattern www.edureka.co
  • 12. CREATIONAL DESIGN PATTERNS Factory Design Pattern Factory Design Pattern: It follows the principle of “Define an interface or abstract class for creating an object but let the subclasses decide which class to instantiate“. The Factory Method Pattern is also known as Virtual Constructor. www.edureka.co
  • 13. CREATIONAL DESIGN PATTERNS Factory Design Pattern Example Example: We have three Cellular Network Plan which describes the call cost per minute. Here we have three different networks namely, abcNetwork, pqrNetwork, and xyzNetwork along with their charges per minute. Let us find out the cost of a certain number of minutes on each network. www.edureka.co
  • 15. CREATIONAL DESIGN PATTERNS Singleton Design Pattern Singleton Design Pattern: It follows “define a class that has only one instance and provides a global point of access to it“. The class must ensure that only a single instance should be created, and a single object can be used by all other classes. www.edureka.co
  • 16. CREATIONAL DESIGN PATTERNS Singleton Design Pattern Example www.edureka.co Example: We have a MySQL Database. Let us insert data into the database using one single object instance. Here, we have 4 different operations that are performed onto the database and all of those operations use one single object instance.
  • 18. Structural Design Patterns Structural Design Patterns deal with the composition of classes and objects which form larger structures. The Structural Design Patterns are further classified as follows: • Facade Pattern • Bridge Pattern • Composite Pattern • Decorator Pattern • Adapter Pattern • Flyweight Pattern • Proxy Pattern • Filter Pattern www.edureka.co
  • 19. STRUCTURAL DESIGN PATTERNS Facade Design Pattern Facade Design Pattern: Describes a higher-level interface that makes the subsystem easier to use. Every Abstract Factory is a Facade Design Pattern. It protects the end-users from the complex sub-system components. www.edureka.co
  • 20. STRUCTURAL DESIGN PATTERNS Facade Design Pattern Example www.edureka.co Example: Now, let us use the Facade Design pattern to find out the cost of the franchise you wish to buy.
  • 22. STRUCTURAL DESIGN PATTERNS Adapter Design Pattern Adapter Design Pattern: Provides the interface according to client requirement while using the services of a class with a different interface. The Adapter Pattern is also known as Wrapper. It is designed to enable two or more previously incompatible objects to interact with each other. www.edureka.co
  • 23. STRUCTURAL DESIGN PATTERNS Adapter Design Pattern Example www.edureka.co Example: Here is a simple Library Card example which is designed to issue a Library card to a new user of the library which includes all the details like a book holder ID, Account number and many more. Let us execute this using Adapter Design Pattern.
  • 25. Behavioural Design Patterns Behavior Design Patterns are concerned with the responsibility and interaction between the objects. The Behavioural Design Patterns are further classified as follows: • Strategy Pattern • Iterator Pattern • Mediator Pattern • Command Pattern • State Pattern • Observer Pattern • Template Pattern • Visitor Pattern www.edureka.co
  • 26. BEHAVIOURAL DESIGN PATTERNS Strategy Design Pattern Strategy Design Pattern: It defines a family of functionality and encapsulates each one and make them interchangeable. The Strategy Pattern is also known as Policy. www.edureka.co
  • 27. BEHAVIOURAL DESIGN PATTERNS Strategy Design Pattern Example www.edureka.co Example: we are going to consider a simple example of a calculator. We need to perform five different operations. We shall encapsulate all those five operations into Calculator class and execute the program using the Strategy Design Pattern.
  • 29. BEHAVIOURAL DESIGN PATTERNS Command Design Pattern Command Design Pattern: It encapsulates a request under an object as a command and passes it to the invoker object. Invoker object looks for the appropriate object which can handle this command and pass the command to the corresponding object and that object executes the command. It is also known as Action or Transaction. www.edureka.co
  • 30. BEHAVIOURAL DESIGN PATTERNS Command Design Pattern Example www.edureka.co Example: This example demonstrates a simple command execution cycle where the user requires to exhibit switching on and off the various electronic devices in his houses like a bulb and stereo player. He invokes the command through an invoker object called a simple remote control.
  • 32. BEHAVIOURAL DESIGN PATTERNS Observer Design Pattern Observer Design Pattern: It defines a one-to-one dependency so that when one object changes state, all its dependents are notified and updated automatically. www.edureka.co
  • 33. BEHAVIOURAL DESIGN PATTERNS Observer Design Pattern Example www.edureka.co Example: We are going to execute a program using the Observer Design Pattern to display the current average score and the current predictable score of a cricket match.
  • 35. JEE Design Patterns JEE Design Patterns are concerned with providing solutions to the Java EE-based software applications and frameworks. The JEE Design Patterns are further classified as follows: • MVC Design Pattern • Dependency Injection Pattern • DAO Design Pattern • Business Delegate Pattern • Intercepting Filter Pattern • Service Locator Pattern • Transfer Object Pattern www.edureka.co
  • 36. JEE DESIGN PATTERNS MVC Design Pattern MVC Design Pattern: MVC Design Pattern is defined as follows: • Models are basically objects used as blueprints for all of the objects that will be used in the application. • Views are used to represent the presentational aspect of the information and data located in the models. • Controllers control and act as both of the Models as well as Views. They serve as a connection between the Models and Views. www.edureka.co
  • 37. JEE DESIGN PATTERNS MVC Design Pattern Example www.edureka.co Example: We are going to use MVC Design Pattern to set and print the data of the school students.
  • 39. JEE DESIGN PATTERNS DAO Design Pattern DAO Design Pattern: DAO is a pattern in which objects are dedicated to the communication with the Data Layer. These objects instantiate “Session Factories” and handle all of the logic behind communicating with the database. www.edureka.co
  • 40. JEE DESIGN PATTERNS DAO Design Pattern Example www.edureka.co Example: We are going display the Developer details of a certain IT company using the DAO Design Pattern.
  • 42. OVERVIEW OF DESIGN PATTERNS
  • 43. www.edureka.co OVERVIEW OF DESIGN PATTERNS • They are designed to be reusable in multiple projects. • Their solutions help to define system architecture with ease. • Design Patterns can capture the software engineering experiences. • They provide transparency to the design of an application. • Design Patterns are well-proven solutions given by Experts. • Java Design Patterns provide clarity to the System Architecture • They provide the possibility of building a better system. www.edureka.co
  • 44. Copyright © 2017, edureka and/or its affiliates. All rights reserved.