SlideShare a Scribd company logo
1 of 13
Design Pattern

Proxy Pattern
A Structural Pattern


                       Presented by: Hasnaeen Rizvi Rahman




                                     Copyright © Astha
Intent
Provide a surrogate or placeholder for
 another object to control access to it.




                        Copyright © Astha
Motivation
Reduce     the full cost of creation and
 initialization unless we actually need that.




                          Copyright © Astha
Document Editor




                  Copyright © Astha
Applicability
A   remote proxy provides a local representative for
  an object in a different address space.
 A virtual proxy creates expensive objects on demand.
 A protection proxy controls access to the original
  object. Protection proxies are useful when objects
  should have different access rights.
 A smart reference is a replacement for a bare
  pointer that performs additional actions when an object
  is accessed.




                                 Copyright © Astha
Structure




            Copyright © Astha
Object Diagram




                 Copyright © Astha
Participants
Proxy    (ImageProxy)
 ◦ Maintains a reference that lets the proxy
   access the real subject.
 ◦ Provides an interface identical to Subject's so
   that a proxy can by substituted for the real
   subject.
 ◦ Controls access to the real subject and may
   be responsible for creating and deleting it.



                             Copyright © Astha
Participants
 ◦ Other responsibilities depend on the
   kind of proxy.
    Remote proxies. are responsible for encoding a
     request and its arguments and for sending the
     encoded request to the real subject in a different
     address space.
    Virtual proxies may cache additional information
     about the real subject so that they can postpone
     accessing it.
    Protection proxies check that the caller has the
     access permissions required to perform a request.

                                Copyright © Astha
Participants
Subject   (Graphic)
 ◦ Defines the common interface for RealSubject
   and Proxy so that a Proxy can be used
   anywhere a RealSubject is expected.
RealSubject     (Image)
 ◦ Defines the real object that the proxy
   represents.




                            Copyright © Astha
Collaborations
Proxy forwards requests to RealSubject
 when appropriate, depending on the kind
 of proxy.




                       Copyright © Astha
Consequences
A  remote proxy can hide the fact that an
 object resides in a different address
 space.
A virtual proxy can perform
 optimizations such as creating an object
 on demand.
Both protection proxies and smart
 references allow additional housekeeping
 tasks when an object is accessed.
                        Copyright © Astha
Assignment
Some applications allow you to search local-help before searching on-
line help. Local help is naturally faster since it resides on your hard
drive. On-line help on the other hand is more complete and up-to-date,
has undergone greater error-checking based on more users' feedback,
refers to more sources and is more up-to-date. Local help is therefore
like a proxy for the on-line help. Most times the user will be able to find
answers in local-help, but for those really tough problems in
specialized situations, on-line help comes to the rescue.

Solve the problem by using proxy design pattern.




                                              Copyright © Astha

More Related Content

What's hot

What's hot (20)

Prototype Design Pattern
Prototype Design PatternPrototype Design Pattern
Prototype Design Pattern
 
Flyweight pattern
Flyweight patternFlyweight pattern
Flyweight pattern
 
Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)Design pattern (Abstract Factory & Singleton)
Design pattern (Abstract Factory & Singleton)
 
Builder pattern
Builder patternBuilder pattern
Builder pattern
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
Prototype pattern
Prototype patternPrototype pattern
Prototype pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Builder design pattern
Builder design patternBuilder design pattern
Builder design pattern
 
Builder Design Pattern (Generic Construction -Different Representation)
Builder Design Pattern (Generic Construction -Different Representation)Builder Design Pattern (Generic Construction -Different Representation)
Builder Design Pattern (Generic Construction -Different Representation)
 
Design Pattern - Observer Pattern
Design Pattern - Observer PatternDesign Pattern - Observer Pattern
Design Pattern - Observer Pattern
 
Observer pattern
Observer patternObserver pattern
Observer pattern
 
The Singleton Pattern Presentation
The Singleton Pattern PresentationThe Singleton Pattern Presentation
The Singleton Pattern Presentation
 
Design pattern-presentation
Design pattern-presentationDesign pattern-presentation
Design pattern-presentation
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method Pattern
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Observer Pattern
Observer PatternObserver Pattern
Observer Pattern
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Proxy Pattern
Proxy PatternProxy Pattern
Proxy Pattern
 

Similar to Proxy pattern

Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy PatternPhilip Zhong
 
Gang of four Proxy Design Pattern
 Gang of four Proxy Design Pattern Gang of four Proxy Design Pattern
Gang of four Proxy Design PatternMainak Goswami
 
Stable proxies it's type and advantages
Stable proxies it's type and advantagesStable proxies it's type and advantages
Stable proxies it's type and advantagesstableproxies
 
Webscarab demo @ OWASP Belgium
Webscarab demo @ OWASP BelgiumWebscarab demo @ OWASP Belgium
Webscarab demo @ OWASP BelgiumPhilippe Bogaerts
 
Deploying End to End Website on Azure
Deploying End to End Website on AzureDeploying End to End Website on Azure
Deploying End to End Website on AzureIntellipaat
 
Book Widget -- Embedding automated photo-document publication on the web and ...
Book Widget -- Embedding automated photo-document publication on the web and ...Book Widget -- Embedding automated photo-document publication on the web and ...
Book Widget -- Embedding automated photo-document publication on the web and ...Eamonn O'Brien-Strain
 
Keeping the Noisy Neighbors Happy
Keeping the Noisy Neighbors HappyKeeping the Noisy Neighbors Happy
Keeping the Noisy Neighbors HappyEran Stiller
 
2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docxshruti533256
 
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...Brian Campbell
 

Similar to Proxy pattern (20)

Stoop 437-proxy
Stoop 437-proxyStoop 437-proxy
Stoop 437-proxy
 
Adapter Poxy Pattern
Adapter Poxy PatternAdapter Poxy Pattern
Adapter Poxy Pattern
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
Gang of four Proxy Design Pattern
 Gang of four Proxy Design Pattern Gang of four Proxy Design Pattern
Gang of four Proxy Design Pattern
 
Proxy Server
Proxy ServerProxy Server
Proxy Server
 
Uses of proxies
Uses of proxiesUses of proxies
Uses of proxies
 
week14
week14week14
week14
 
Reverse proxy
Reverse proxyReverse proxy
Reverse proxy
 
Stable proxies it's type and advantages
Stable proxies it's type and advantagesStable proxies it's type and advantages
Stable proxies it's type and advantages
 
Webscarab demo @ OWASP Belgium
Webscarab demo @ OWASP BelgiumWebscarab demo @ OWASP Belgium
Webscarab demo @ OWASP Belgium
 
Deploying End to End Website on Azure
Deploying End to End Website on AzureDeploying End to End Website on Azure
Deploying End to End Website on Azure
 
Book Widget -- Embedding automated photo-document publication on the web and ...
Book Widget -- Embedding automated photo-document publication on the web and ...Book Widget -- Embedding automated photo-document publication on the web and ...
Book Widget -- Embedding automated photo-document publication on the web and ...
 
Proxies
ProxiesProxies
Proxies
 
Reverse proxy
Reverse proxyReverse proxy
Reverse proxy
 
Keeping the Noisy Neighbors Happy
Keeping the Noisy Neighbors HappyKeeping the Noisy Neighbors Happy
Keeping the Noisy Neighbors Happy
 
Proxies
ProxiesProxies
Proxies
 
2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx2-Virtualization in Cloud Computing and Types.docx
2-Virtualization in Cloud Computing and Types.docx
 
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
OAuth 2.0 and Mobile Devices: Is that a token in your phone in your pocket or...
 
Midterm Review
Midterm ReviewMidterm Review
Midterm Review
 

More from Shakil Ahmed

More from Shakil Ahmed (18)

Algorithm
AlgorithmAlgorithm
Algorithm
 
B-tree & R-tree
B-tree & R-treeB-tree & R-tree
B-tree & R-tree
 
Advanced data structure
Advanced data structureAdvanced data structure
Advanced data structure
 
Mediator pattern
Mediator patternMediator pattern
Mediator pattern
 
Facade pattern
Facade patternFacade pattern
Facade pattern
 
Composite pattern
Composite patternComposite pattern
Composite pattern
 
Command pattern
Command patternCommand pattern
Command pattern
 
Chain of responsibility
Chain of responsibilityChain of responsibility
Chain of responsibility
 
Bridge pattern
Bridge patternBridge pattern
Bridge pattern
 
iOS 5
iOS 5iOS 5
iOS 5
 
Ios development
Ios developmentIos development
Ios development
 
Graph
GraphGraph
Graph
 
Lowest common ancestor
Lowest common ancestorLowest common ancestor
Lowest common ancestor
 
Segment tree
Segment treeSegment tree
Segment tree
 
Tree & bst
Tree & bstTree & bst
Tree & bst
 
Trie tree
Trie treeTrie tree
Trie tree
 
Dynamic programming
Dynamic programmingDynamic programming
Dynamic programming
 
Advanced Search Techniques
Advanced Search TechniquesAdvanced Search Techniques
Advanced Search Techniques
 

Recently uploaded

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...Nguyen Thanh Tu Collection
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsMebane Rash
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the ClassroomPooky Knightsmith
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.MaryamAhmad92
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxAreebaZafar22
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfSherif Taha
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structuredhanjurrannsibayan2
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...Poonam Aher Patil
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxJisc
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSCeline George
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibitjbellavia9
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Pooja Bhuva
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17Celine George
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.christianmathematics
 

Recently uploaded (20)

80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
80 ĐỀ THI THỬ TUYỂN SINH TIẾNG ANH VÀO 10 SỞ GD – ĐT THÀNH PHỐ HỒ CHÍ MINH NĂ...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
Sensory_Experience_and_Emotional_Resonance_in_Gabriel_Okaras_The_Piano_and_Th...
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 

Proxy pattern

  • 1. Design Pattern Proxy Pattern A Structural Pattern Presented by: Hasnaeen Rizvi Rahman Copyright © Astha
  • 2. Intent Provide a surrogate or placeholder for another object to control access to it. Copyright © Astha
  • 3. Motivation Reduce the full cost of creation and initialization unless we actually need that. Copyright © Astha
  • 4. Document Editor Copyright © Astha
  • 5. Applicability A remote proxy provides a local representative for an object in a different address space.  A virtual proxy creates expensive objects on demand.  A protection proxy controls access to the original object. Protection proxies are useful when objects should have different access rights.  A smart reference is a replacement for a bare pointer that performs additional actions when an object is accessed. Copyright © Astha
  • 6. Structure Copyright © Astha
  • 7. Object Diagram Copyright © Astha
  • 8. Participants Proxy (ImageProxy) ◦ Maintains a reference that lets the proxy access the real subject. ◦ Provides an interface identical to Subject's so that a proxy can by substituted for the real subject. ◦ Controls access to the real subject and may be responsible for creating and deleting it. Copyright © Astha
  • 9. Participants ◦ Other responsibilities depend on the kind of proxy.  Remote proxies. are responsible for encoding a request and its arguments and for sending the encoded request to the real subject in a different address space.  Virtual proxies may cache additional information about the real subject so that they can postpone accessing it.  Protection proxies check that the caller has the access permissions required to perform a request. Copyright © Astha
  • 10. Participants Subject (Graphic) ◦ Defines the common interface for RealSubject and Proxy so that a Proxy can be used anywhere a RealSubject is expected. RealSubject (Image) ◦ Defines the real object that the proxy represents. Copyright © Astha
  • 11. Collaborations Proxy forwards requests to RealSubject when appropriate, depending on the kind of proxy. Copyright © Astha
  • 12. Consequences A remote proxy can hide the fact that an object resides in a different address space. A virtual proxy can perform optimizations such as creating an object on demand. Both protection proxies and smart references allow additional housekeeping tasks when an object is accessed. Copyright © Astha
  • 13. Assignment Some applications allow you to search local-help before searching on- line help. Local help is naturally faster since it resides on your hard drive. On-line help on the other hand is more complete and up-to-date, has undergone greater error-checking based on more users' feedback, refers to more sources and is more up-to-date. Local help is therefore like a proxy for the on-line help. Most times the user will be able to find answers in local-help, but for those really tough problems in specialized situations, on-line help comes to the rescue. Solve the problem by using proxy design pattern. Copyright © Astha