SlideShare a Scribd company logo
1 of 45
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
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.
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.
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.
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.
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.
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.
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.
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.
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

What's hot

Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patternsLilia Sfaxi
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software EngineeringManish Kumar
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design PrinciplesAndreas Enbohm
 
The Singleton Pattern Presentation
The Singleton Pattern PresentationThe Singleton Pattern Presentation
The Singleton Pattern PresentationJAINIK PATEL
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jspJafar Nesargi
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern11prasoon
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns pptAman Jain
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentationivpol
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design patternMindfire Solutions
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion PrincipleShahriar Hyder
 
Design Pattern - Singleton Pattern
Design Pattern - Singleton PatternDesign Pattern - Singleton Pattern
Design Pattern - Singleton PatternMudasir Qazi
 

What's hot (20)

Dependency Injection
Dependency InjectionDependency Injection
Dependency Injection
 
Software Engineering - chp4- design patterns
Software Engineering - chp4- design patternsSoftware Engineering - chp4- design patterns
Software Engineering - chp4- design patterns
 
Design Pattern in Software Engineering
Design Pattern in Software EngineeringDesign Pattern in Software Engineering
Design Pattern in Software Engineering
 
SOLID Design Principles
SOLID Design PrinciplesSOLID Design Principles
SOLID Design Principles
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
The Singleton Pattern Presentation
The Singleton Pattern PresentationThe Singleton Pattern Presentation
The Singleton Pattern Presentation
 
Model View Controller (MVC)
Model View Controller (MVC)Model View Controller (MVC)
Model View Controller (MVC)
 
Chapter 3 servlet & jsp
Chapter 3 servlet & jspChapter 3 servlet & jsp
Chapter 3 servlet & jsp
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
 
Design patterns ppt
Design patterns pptDesign patterns ppt
Design patterns ppt
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
Uml class-diagram
Uml class-diagramUml class-diagram
Uml class-diagram
 
Association agggregation and composition
Association agggregation and compositionAssociation agggregation and composition
Association agggregation and composition
 
Let us understand design pattern
Let us understand design patternLet us understand design pattern
Let us understand design pattern
 
Dependency Inversion Principle
Dependency Inversion PrincipleDependency Inversion Principle
Dependency Inversion Principle
 
OOP java
OOP javaOOP java
OOP java
 
Design Pattern - Singleton Pattern
Design Pattern - Singleton PatternDesign Pattern - Singleton Pattern
Design Pattern - Singleton Pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 

Similar to Java Design Patterns Tutorial | Edureka

5 Design Patterns Explained
5 Design Patterns Explained5 Design Patterns Explained
5 Design Patterns ExplainedPrabhjit Singh
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxdanhaley45372
 
Gof design pattern
Gof design patternGof design pattern
Gof design patternnaveen kumar
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesUlrich Krause
 
Oops design pattern intro
Oops design pattern intro Oops design pattern intro
Oops design pattern intro anshu_atri
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCUlrich Krause
 
Software Patterns
Software PatternsSoftware Patterns
Software Patternskim.mens
 
Java Design Pattern Interview Questions
Java Design Pattern Interview QuestionsJava Design Pattern Interview Questions
Java Design Pattern Interview Questionsjbashask
 
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 EngineeringProtelo, Inc.
 
Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'Edureka!
 
Design Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for SoftwareDesign Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for SoftwareEdureka!
 
Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCVisual Engineering
 
Software architecture patterns
Software architecture patternsSoftware architecture patterns
Software architecture patternsMd. Sadhan Sarker
 

Similar to Java Design Patterns Tutorial | Edureka (20)

Design patterns
Design patternsDesign patterns
Design patterns
 
5 Design Patterns Explained
5 Design Patterns Explained5 Design Patterns Explained
5 Design Patterns Explained
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
Gof design pattern
Gof design patternGof design pattern
Gof design pattern
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPages
 
Oops design pattern intro
Oops design pattern intro Oops design pattern intro
Oops design pattern intro
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVC
 
Software Patterns
Software PatternsSoftware Patterns
Software Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Java Design Pattern Interview Questions
Java Design Pattern Interview QuestionsJava Design Pattern Interview Questions
Java Design Pattern Interview Questions
 
Design patterns
Design patternsDesign patterns
Design patterns
 
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
 
Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'Webinar on Design Patterns titled 'Dive into Design Patterns'
Webinar on Design Patterns titled 'Dive into Design Patterns'
 
Design Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for SoftwareDesign Patterns : The Ultimate Blueprint for Software
Design Patterns : The Ultimate Blueprint for Software
 
Workshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVCWorkshop 9: BackboneJS y patrones MVC
Workshop 9: BackboneJS y patrones MVC
 
Sda 8
Sda   8Sda   8
Sda 8
 
Software architecture patterns
Software architecture patternsSoftware architecture patterns
Software architecture patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 

More from Edureka!

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

More from Edureka! (20)

What to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | EdurekaWhat to learn during the 21 days Lockdown | Edureka
What to learn during the 21 days Lockdown | Edureka
 
Top 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | EdurekaTop 10 Dying Programming Languages in 2020 | Edureka
Top 10 Dying Programming Languages in 2020 | Edureka
 
Top 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | EdurekaTop 5 Trending Business Intelligence Tools | Edureka
Top 5 Trending Business Intelligence Tools | Edureka
 
Tableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | EdurekaTableau Tutorial for Data Science | Edureka
Tableau Tutorial for Data Science | Edureka
 
Python Programming Tutorial | Edureka
Python Programming Tutorial | EdurekaPython Programming Tutorial | Edureka
Python Programming Tutorial | Edureka
 
Top 5 PMP Certifications | Edureka
Top 5 PMP Certifications | EdurekaTop 5 PMP Certifications | Edureka
Top 5 PMP Certifications | Edureka
 
Top Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | EdurekaTop Maven Interview Questions in 2020 | Edureka
Top Maven Interview Questions in 2020 | Edureka
 
Linux Mint Tutorial | Edureka
Linux Mint Tutorial | EdurekaLinux Mint Tutorial | Edureka
Linux Mint Tutorial | Edureka
 
How to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| EdurekaHow to Deploy Java Web App in AWS| Edureka
How to Deploy Java Web App in AWS| Edureka
 
Importance of Digital Marketing | Edureka
Importance of Digital Marketing | EdurekaImportance of Digital Marketing | Edureka
Importance of Digital Marketing | Edureka
 
RPA in 2020 | Edureka
RPA in 2020 | EdurekaRPA in 2020 | Edureka
RPA in 2020 | Edureka
 
Email Notifications in Jenkins | Edureka
Email Notifications in Jenkins | EdurekaEmail Notifications in Jenkins | Edureka
Email Notifications in Jenkins | Edureka
 
EA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | EdurekaEA Algorithm in Machine Learning | Edureka
EA Algorithm in Machine Learning | Edureka
 
Cognitive AI Tutorial | Edureka
Cognitive AI Tutorial | EdurekaCognitive AI Tutorial | Edureka
Cognitive AI Tutorial | Edureka
 
AWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | EdurekaAWS Cloud Practitioner Tutorial | Edureka
AWS Cloud Practitioner Tutorial | Edureka
 
Blue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | EdurekaBlue Prism Top Interview Questions | Edureka
Blue Prism Top Interview Questions | Edureka
 
Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka Big Data on AWS Tutorial | Edureka
Big Data on AWS Tutorial | Edureka
 
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | EdurekaA star algorithm | A* Algorithm in Artificial Intelligence | Edureka
A star algorithm | A* Algorithm in Artificial Intelligence | Edureka
 
Kubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | EdurekaKubernetes Installation on Ubuntu | Edureka
Kubernetes Installation on Ubuntu | Edureka
 
Introduction to DevOps | Edureka
Introduction to DevOps | EdurekaIntroduction to DevOps | Edureka
Introduction to DevOps | Edureka
 

Recently uploaded

AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetEnjoy Anytime
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxOnBoard
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 

Recently uploaded (20)

E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your BudgetHyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
Hyderabad Call Girls Khairatabad ✨ 7001305949 ✨ Cheap Price Your Budget
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
Maximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptxMaximizing Board Effectiveness 2024 Webinar.pptx
Maximizing Board Effectiveness 2024 Webinar.pptx
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 

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
  • 14.
  • 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.
  • 17.
  • 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.
  • 21.
  • 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.
  • 24.
  • 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.
  • 28.
  • 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.
  • 31.
  • 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.
  • 34.
  • 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.
  • 38.
  • 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.
  • 41.
  • 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.