SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Adapter & Proxy Pattern
Philip zhong Feb, 2014
Agenda
•
•

•
•
•
•
•
•
•
•

Pattern Taxonomy
What’s Adapter?

Adapter Motivation
When To Use Adapter?
Adaptor Examples
What’s Proxy?
Proxy Motivation
When To Use Proxy?
Proxy Types
Proxy Example
Pattern Taxonomy
 Structural Patterns

Adapters, Bridges, Facades, and Proxies are
variations on a single theme:

They reduce the coupling between two or more classes.
They introduce an abstract class to enable future
extensions.
They encapsulate complex structures.
What’s Adapter
Convert the Interface of a class into
Target
another interface clients expect. Client uses.
Defines the domain-specific interface that
• Adapter
 Also Known As Wrapper
•


Adapts the interface Adaptee to the Target interface.


Adaptee
Defines an existing interface that needs adapting.



Client
Collaborates with objects conforming to the Target interface.
Adapter Motivation
• Sometimes a toolkit or class library can
not be used because its interface is
incompatible with the interface required by
an application
• We can not change the library interface,
since we may not have its source code
• Even if we did have the source code, we
probably should not change the library for
each domain-specific application
Adapter Example
• Media Player
Client

Uses

VlcPlay er
+ playVlc()
+ playMp4()

MediaPlay er
Implements

Implements

Implements

AudioPlay er
+ play()

Uses

MediaAdapt er
+ play()

Uses
Adv anceMediaPlay er
Implements

Mp4Play er
+ playVlc()
+ playMp4()
Adapter Examples
OracleSt ore

MessageSt at em ent s

Message
Dat abasePersist enceAdapt er

+ long messageId
+ String message
+ Timestamp timestamp
+ String client

I Dat abasePersist ence Implements

Uses
Implements
MessagePersist ence
I MessagePersist ence

Uses

Client

Abst ract Dat abaseSt ore

Uses

Implements

MysqlSt ore
What’s Proxy
• Provide a surrogate or placeholder for
 Proxy

another object to that lets the proxy it.
Maintains a referencecontrol access toaccess
• the real subject. Surrogate
Also Known As
 Subject Interface
Defines the common interface for RealSubject and
proxy so that a Proxy can be used anywhere a
RealSubject is expected.
 RealSubject
Defines the real object that proxy represents.
Proxy Motivation
• There are situations in which a client does
not or can not reference an object directly,
but wants to still interact with the object.
• The proxy object has the same interface as
the target object.
• The proxy holds a reference to the target
object and can forward requests to the target
as required (delegation!).
• In effect, the proxy object has the authority
the act on behalf of the client to interact with
the target object.
Proxy Types
• Virtual Proxy :Allows the creation of a memory intensive object on
•

demand. The object will not be created until it is really needed.
Cache Proxy :Provides temporary storage of the results of expensive
target operations so that multiple clients can share the results.

• Protection (Access) Proxy: Provides different clients with

different levels of access to a target object, we can through
java dynamic proxy API to do.

• Remote Proxy :Provides a reference to an object located in a different
•
•
•
•

address space on the same or different machine. e.g.: RMI & CORBA
Synchronization Proxy :Provides multiple accesses to a target
object.
Copy-On-Write Proxy :Defers copying (cloning) a target object until
required by client actions. Really a form of virtual proxy.
Smart Reference Proxy :Provides additional actions whenever a
target object is referenced such as counting the number of references to the
object.
Firewall Proxy :Protects targets from bad clients (or vice versa).
Virtual Proxy Example
RealI m age

Implements
I m age
Delegates
Uses
Implements
Client

Pr ox y I m age
Cache Proxy Example
Cust om er Dao

Implements
Delegates
I Cust om er Dao
Implements
Cust om er CachedPr ox y

+ Uses

Google Cache
Dynamic Proxy Example
Dynamic Proxy Example
Remote Proxy Example
• Java RMI(Remote Method Invocation)
Synchronization Proxy Example
Table

Implements
I Table

Delegates
Implements
Row Lock TablePr ox y
Q & A

Weitere ähnliche Inhalte

Andere mochten auch

Mff715 w1 2_generating_researchideas_fall11
Mff715 w1 2_generating_researchideas_fall11Mff715 w1 2_generating_researchideas_fall11
Mff715 w1 2_generating_researchideas_fall11Rachel Chung
 
Our GBU bioepistemological educational project (BEEMP)
Our GBU bioepistemological educational project (BEEMP)Our GBU bioepistemological educational project (BEEMP)
Our GBU bioepistemological educational project (BEEMP)gbgupresentations
 
Early national literature
Early national literatureEarly national literature
Early national literaturems_faris
 
REDD+ (Transforming Development for Sustainability)
REDD+ (Transforming Development for Sustainability)REDD+ (Transforming Development for Sustainability)
REDD+ (Transforming Development for Sustainability)Tomislav Korman
 
Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...
Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...
Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...Kouluterveyskysely
 
長野市のふるさと納税、小泉提案でようやくここまで来た!!
 長野市のふるさと納税、小泉提案でようやくここまで来た!! 長野市のふるさと納税、小泉提案でようやくここまで来た!!
長野市のふるさと納税、小泉提案でようやくここまで来た!!長野市議会議員小泉一真
 
Pec do Teto de Gastos - o que é?
Pec do Teto de Gastos - o que é?Pec do Teto de Gastos - o que é?
Pec do Teto de Gastos - o que é?Miguel Rosario
 
FUM Belize Friends School
FUM Belize Friends SchoolFUM Belize Friends School
FUM Belize Friends SchoolKelly Kellum
 
Post new korean cinema
Post new korean cinemaPost new korean cinema
Post new korean cinema문정 최
 
Продукция ТРАДО для вашего здоровья
Продукция ТРАДО для вашего здоровьяПродукция ТРАДО для вашего здоровья
Продукция ТРАДО для вашего здоровьяЕлена Шальнова
 
Bio-vision_Kerala quiz 2016
Bio-vision_Kerala quiz 2016Bio-vision_Kerala quiz 2016
Bio-vision_Kerala quiz 2016Subhash Soman
 
Ports For Future Offshore Wind-Event Brochure
Ports For Future Offshore Wind-Event BrochurePorts For Future Offshore Wind-Event Brochure
Ports For Future Offshore Wind-Event Brochuregm330
 
Perfil losa deportiva
Perfil losa deportivaPerfil losa deportiva
Perfil losa deportivaApuhen
 

Andere mochten auch (20)

Mff715 w1 2_generating_researchideas_fall11
Mff715 w1 2_generating_researchideas_fall11Mff715 w1 2_generating_researchideas_fall11
Mff715 w1 2_generating_researchideas_fall11
 
Our GBU bioepistemological educational project (BEEMP)
Our GBU bioepistemological educational project (BEEMP)Our GBU bioepistemological educational project (BEEMP)
Our GBU bioepistemological educational project (BEEMP)
 
The Implementation of CSR in European Football by Geoff Walters
The Implementation of CSR in European Football by Geoff WaltersThe Implementation of CSR in European Football by Geoff Walters
The Implementation of CSR in European Football by Geoff Walters
 
SEO再入門
SEO再入門SEO再入門
SEO再入門
 
Early national literature
Early national literatureEarly national literature
Early national literature
 
Guión ingles
Guión inglesGuión ingles
Guión ingles
 
World Renaissance Nov 2011
World Renaissance Nov 2011World Renaissance Nov 2011
World Renaissance Nov 2011
 
REDD+ (Transforming Development for Sustainability)
REDD+ (Transforming Development for Sustainability)REDD+ (Transforming Development for Sustainability)
REDD+ (Transforming Development for Sustainability)
 
Empowering Marketing
Empowering MarketingEmpowering Marketing
Empowering Marketing
 
Arbitros
ArbitrosArbitros
Arbitros
 
Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...
Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...
Silvennoinen: Digitaalisen pelaamisen koukut - tavoitteita, sosiaalisuutta ja...
 
長野市のふるさと納税、小泉提案でようやくここまで来た!!
 長野市のふるさと納税、小泉提案でようやくここまで来た!! 長野市のふるさと納税、小泉提案でようやくここまで来た!!
長野市のふるさと納税、小泉提案でようやくここまで来た!!
 
Pec do Teto de Gastos - o que é?
Pec do Teto de Gastos - o que é?Pec do Teto de Gastos - o que é?
Pec do Teto de Gastos - o que é?
 
C 3
C 3C 3
C 3
 
FUM Belize Friends School
FUM Belize Friends SchoolFUM Belize Friends School
FUM Belize Friends School
 
Post new korean cinema
Post new korean cinemaPost new korean cinema
Post new korean cinema
 
Продукция ТРАДО для вашего здоровья
Продукция ТРАДО для вашего здоровьяПродукция ТРАДО для вашего здоровья
Продукция ТРАДО для вашего здоровья
 
Bio-vision_Kerala quiz 2016
Bio-vision_Kerala quiz 2016Bio-vision_Kerala quiz 2016
Bio-vision_Kerala quiz 2016
 
Ports For Future Offshore Wind-Event Brochure
Ports For Future Offshore Wind-Event BrochurePorts For Future Offshore Wind-Event Brochure
Ports For Future Offshore Wind-Event Brochure
 
Perfil losa deportiva
Perfil losa deportivaPerfil losa deportiva
Perfil losa deportiva
 

Ähnlich wie Adapter Poxy Pattern

Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method InvocationSabiha M
 
Proxy Design Patterns
Proxy Design PatternsProxy Design Patterns
Proxy Design PatternsZafer Genc
 
Design patterns
Design patternsDesign patterns
Design patternsAlok Guha
 
Linking Data and Actions on the Web
Linking Data and Actions on the WebLinking Data and Actions on the Web
Linking Data and Actions on the WebStuart Charlton
 
Web Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureWeb Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureToru Kawamura
 
Portal and Intranets
Portal and Intranets Portal and Intranets
Portal and Intranets Redar Ismail
 
Hibernate introduction
Hibernate introductionHibernate introduction
Hibernate introductionSagar Verma
 
Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2
Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2
Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2Richard Esplin
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)stanbridge
 
Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Sameer Rathoud
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Wen-Tien Chang
 
Design Pattern lecture 4
Design Pattern lecture 4Design Pattern lecture 4
Design Pattern lecture 4Julie Iskander
 
Polaris presentation ioc - code conference
Polaris presentation   ioc - code conferencePolaris presentation   ioc - code conference
Polaris presentation ioc - code conferenceSteven Contos
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns StructuralUMAR ALI
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternNitin Bhide
 

Ähnlich wie Adapter Poxy Pattern (20)

Remote Method Invocation
Remote Method InvocationRemote Method Invocation
Remote Method Invocation
 
Proxy Design Patterns
Proxy Design PatternsProxy Design Patterns
Proxy Design Patterns
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Linking Data and Actions on the Web
Linking Data and Actions on the WebLinking Data and Actions on the Web
Linking Data and Actions on the Web
 
Web Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the futureWeb Clients for Ruby and What they should be in the future
Web Clients for Ruby and What they should be in the future
 
Adapter Pattern
Adapter PatternAdapter Pattern
Adapter Pattern
 
Portal and Intranets
Portal and Intranets Portal and Intranets
Portal and Intranets
 
Hibernate introduction
Hibernate introductionHibernate introduction
Hibernate introduction
 
Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2
Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2
Alfresco Tech Talk Live (Episode 70): Customizing Alfresco Share 4.2
 
Django course
Django courseDjango course
Django course
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)Proxy design pattern (Class Ambassador)
Proxy design pattern (Class Ambassador)
 
Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3Service-Oriented Design and Implement with Rails3
Service-Oriented Design and Implement with Rails3
 
Design Pattern lecture 4
Design Pattern lecture 4Design Pattern lecture 4
Design Pattern lecture 4
 
Polaris presentation ioc - code conference
Polaris presentation   ioc - code conferencePolaris presentation   ioc - code conference
Polaris presentation ioc - code conference
 
Microservices
MicroservicesMicroservices
Microservices
 
Design patterns Structural
Design patterns StructuralDesign patterns Structural
Design patterns Structural
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
Proxy pattern
Proxy patternProxy pattern
Proxy pattern
 
Iterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design patternIterator - a powerful but underappreciated design pattern
Iterator - a powerful but underappreciated design pattern
 

Mehr von Philip Zhong

Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignPhilip Zhong
 
How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store Philip Zhong
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge ShareingPhilip Zhong
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_costPhilip Zhong
 
Mongo db program_installation_guide
Mongo db program_installation_guideMongo db program_installation_guide
Mongo db program_installation_guidePhilip Zhong
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guidePhilip Zhong
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012Philip Zhong
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_SystemPhilip Zhong
 
Mysql performance tuning
Mysql performance tuningMysql performance tuning
Mysql performance tuningPhilip Zhong
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testingPhilip Zhong
 
How to write_language_compiler
How to write_language_compilerHow to write_language_compiler
How to write_language_compilerPhilip Zhong
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Philip Zhong
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socketPhilip Zhong
 
Mysql architecture&parameters
Mysql architecture&parametersMysql architecture&parameters
Mysql architecture&parametersPhilip Zhong
 

Mehr von Philip Zhong (14)

Cisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store DesignCisco Webex Distributed Framework and Data Store Design
Cisco Webex Distributed Framework and Data Store Design
 
How to Implement Distributed Data Store
How to Implement Distributed Data Store How to Implement Distributed Data Store
How to Implement Distributed Data Store
 
MongoDB Knowledge Shareing
MongoDB Knowledge ShareingMongoDB Knowledge Shareing
MongoDB Knowledge Shareing
 
How to estimate_oracle_cost
How to estimate_oracle_costHow to estimate_oracle_cost
How to estimate_oracle_cost
 
Mongo db program_installation_guide
Mongo db program_installation_guideMongo db program_installation_guide
Mongo db program_installation_guide
 
Mongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guideMongo db sharding_cluster_installation_guide
Mongo db sharding_cluster_installation_guide
 
Vitess percona 2012
Vitess percona 2012Vitess percona 2012
Vitess percona 2012
 
Distributed_Database_System
Distributed_Database_SystemDistributed_Database_System
Distributed_Database_System
 
Mysql performance tuning
Mysql performance tuningMysql performance tuning
Mysql performance tuning
 
Mysql5.1 character set testing
Mysql5.1 character set testingMysql5.1 character set testing
Mysql5.1 character set testing
 
How to write_language_compiler
How to write_language_compilerHow to write_language_compiler
How to write_language_compiler
 
Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8Compare mysql5.1.50 mysql5.5.8
Compare mysql5.1.50 mysql5.5.8
 
Mysql handle socket
Mysql handle socketMysql handle socket
Mysql handle socket
 
Mysql architecture&parameters
Mysql architecture&parametersMysql architecture&parameters
Mysql architecture&parameters
 

Kürzlich hochgeladen

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 

Kürzlich hochgeladen (20)

Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
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
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 

Adapter Poxy Pattern

  • 1. Adapter & Proxy Pattern Philip zhong Feb, 2014
  • 2. Agenda • • • • • • • • • • Pattern Taxonomy What’s Adapter? Adapter Motivation When To Use Adapter? Adaptor Examples What’s Proxy? Proxy Motivation When To Use Proxy? Proxy Types Proxy Example
  • 3. Pattern Taxonomy  Structural Patterns Adapters, Bridges, Facades, and Proxies are variations on a single theme: They reduce the coupling between two or more classes. They introduce an abstract class to enable future extensions. They encapsulate complex structures.
  • 4. What’s Adapter Convert the Interface of a class into Target another interface clients expect. Client uses. Defines the domain-specific interface that • Adapter  Also Known As Wrapper •  Adapts the interface Adaptee to the Target interface.  Adaptee Defines an existing interface that needs adapting.  Client Collaborates with objects conforming to the Target interface.
  • 5.
  • 6. Adapter Motivation • Sometimes a toolkit or class library can not be used because its interface is incompatible with the interface required by an application • We can not change the library interface, since we may not have its source code • Even if we did have the source code, we probably should not change the library for each domain-specific application
  • 7. Adapter Example • Media Player Client Uses VlcPlay er + playVlc() + playMp4() MediaPlay er Implements Implements Implements AudioPlay er + play() Uses MediaAdapt er + play() Uses Adv anceMediaPlay er Implements Mp4Play er + playVlc() + playMp4()
  • 8. Adapter Examples OracleSt ore MessageSt at em ent s Message Dat abasePersist enceAdapt er + long messageId + String message + Timestamp timestamp + String client I Dat abasePersist ence Implements Uses Implements MessagePersist ence I MessagePersist ence Uses Client Abst ract Dat abaseSt ore Uses Implements MysqlSt ore
  • 9. What’s Proxy • Provide a surrogate or placeholder for  Proxy another object to that lets the proxy it. Maintains a referencecontrol access toaccess • the real subject. Surrogate Also Known As  Subject Interface Defines the common interface for RealSubject and proxy so that a Proxy can be used anywhere a RealSubject is expected.  RealSubject Defines the real object that proxy represents.
  • 10. Proxy Motivation • There are situations in which a client does not or can not reference an object directly, but wants to still interact with the object. • The proxy object has the same interface as the target object. • The proxy holds a reference to the target object and can forward requests to the target as required (delegation!). • In effect, the proxy object has the authority the act on behalf of the client to interact with the target object.
  • 11. Proxy Types • Virtual Proxy :Allows the creation of a memory intensive object on • demand. The object will not be created until it is really needed. Cache Proxy :Provides temporary storage of the results of expensive target operations so that multiple clients can share the results. • Protection (Access) Proxy: Provides different clients with different levels of access to a target object, we can through java dynamic proxy API to do. • Remote Proxy :Provides a reference to an object located in a different • • • • address space on the same or different machine. e.g.: RMI & CORBA Synchronization Proxy :Provides multiple accesses to a target object. Copy-On-Write Proxy :Defers copying (cloning) a target object until required by client actions. Really a form of virtual proxy. Smart Reference Proxy :Provides additional actions whenever a target object is referenced such as counting the number of references to the object. Firewall Proxy :Protects targets from bad clients (or vice versa).
  • 12. Virtual Proxy Example RealI m age Implements I m age Delegates Uses Implements Client Pr ox y I m age
  • 13. Cache Proxy Example Cust om er Dao Implements Delegates I Cust om er Dao Implements Cust om er CachedPr ox y + Uses Google Cache
  • 16. Remote Proxy Example • Java RMI(Remote Method Invocation)
  • 17. Synchronization Proxy Example Table Implements I Table Delegates Implements Row Lock TablePr ox y
  • 18. Q & A