SlideShare a Scribd company logo
1 of 15
Download to read offline
READING GROUP - 	

FACADE, ADAPTER
Presenter: Vincent Chu	

2014/04/21
Agenda
• Facade
• What is Facade?
• Example
• Conclusion
!
!
• Adapter
• What is Adapter
• Example
• Conclusion
!
WHAT IS FACADE?
Provide a unified interface to a set of interfaces in a
subsystem.
Facade define s a higher-level interface that
makes the subsystem easier to use.
About Facade Pattern
目的 簡化原有系統的使用方式

定義自己的介面
問題 只需使用一個複雜系統中的一小部份子系統

用特別的方式與系統互動
解決方案 為client建立一個新的介面來使用子系統
參與者及協作者 Facade為client提供了一個特別介面來簡化系
統的使用(完全沒有說到重點)
結果 Facade簡化了對子系統的操作方式

Facade並不完整,因此某些功能會無法使用
實作方式 建立新介面所需的classes

讓這些class可以使用原有的系統(廢話)
Example of Facade
• The “Football” is the best
example I can find!
Example of Facade
• The Amazon 1-Click
order may be as dangerous
as nuclear weapon to my
wife.
Conclusion
• Dictionary said…
• façade or facade (fəˈsɑːd, fæ-, fəˈsɑːd, fæ-)
• the face of a building, esp the main front.
用行話來說,facade就叫『包一下』

• CRM web service API
WHAT IS ADAPTER?
Convert the interface of a class into another interface
that the clients expect. Adapter lets classes work together
that could not otherwise because of incompatible interfaces.
About Adapter Pattern
目的 讓非你控制的物件可以跟某個目標介面匹配
問題
系統的資料和行為都正確,但介面不相容

通常在需要使用一個洐生自既有抽象類別的
東西時
解決方案 Adapter為目的interface提供一個wrapper
參與者及協作者
Adapter將adaptee的介面做了轉換,讓client
在使用target時,不知道其實target是透過
adapter在使用adaptee的功能
結果
Adapter pattern讓新的class可以使用既存的
object,而不需因為既存object的interface而
受限
實作方式
用新的class把既存的object包起來

透過新class操作既存object的介面

client使用新的class
About Adapter Pattern
An Adapter for client to use
legacy object with an
interface which we already
have.
An Wrapper for client to
use legacy object with no
interface restricted.
Wrapper are also kind of
Adapter.
Example of Adapter
• International Plug
Adapter is the best sample
of Adapter Pattern!!
Ref: http://www.amazon.com/Kensington-33117-International-Travel-Adapter/dp/B0002H4YUI/
Example of Adapter
• ADO.NET
• Provides adapter for client
to access various kind of
database without(?)
problem.
• Once you have new kind
of vintage database need
to access with, just
implement your own
ADO.NET interfaces.
How simple(?) it is!!
Ref: http://msdn.microsoft.com/en-us/library/vstudio/27y4ybxw(v=vs.100).aspx
Conclusion
• Like Facade, Adapter also ‘wrapping’ object but
they still have miner difference.
!
Facade Adapter
是否存在既有類別? Yes Yes
是否須使用某個特定介面? No Yes
物件需要多型嗎? No Maybe
需要更簡單的介面嗎? Yes No
Conclusion
Facade pattern的目的是簡化介面,而Adapter
pattern的目的則是必須適應一個現有的介面。

簡言之,Facade pattern簡化了介面,Adapter
pattern則將一個介面轉化為另一個。
Thanks for your time.

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Facade pattern and Adapter paattern summary

  • 1. READING GROUP - FACADE, ADAPTER Presenter: Vincent Chu 2014/04/21
  • 2. Agenda • Facade • What is Facade? • Example • Conclusion ! ! • Adapter • What is Adapter • Example • Conclusion !
  • 3. WHAT IS FACADE? Provide a unified interface to a set of interfaces in a subsystem. Facade define s a higher-level interface that makes the subsystem easier to use.
  • 4. About Facade Pattern 目的 簡化原有系統的使用方式 定義自己的介面 問題 只需使用一個複雜系統中的一小部份子系統 用特別的方式與系統互動 解決方案 為client建立一個新的介面來使用子系統 參與者及協作者 Facade為client提供了一個特別介面來簡化系 統的使用(完全沒有說到重點) 結果 Facade簡化了對子系統的操作方式 Facade並不完整,因此某些功能會無法使用 實作方式 建立新介面所需的classes 讓這些class可以使用原有的系統(廢話)
  • 5. Example of Facade • The “Football” is the best example I can find!
  • 6. Example of Facade • The Amazon 1-Click order may be as dangerous as nuclear weapon to my wife.
  • 7. Conclusion • Dictionary said… • façade or facade (fəˈsɑːd, fæ-, fəˈsɑːd, fæ-) • the face of a building, esp the main front. 用行話來說,facade就叫『包一下』 • CRM web service API
  • 8. WHAT IS ADAPTER? Convert the interface of a class into another interface that the clients expect. Adapter lets classes work together that could not otherwise because of incompatible interfaces.
  • 9. About Adapter Pattern 目的 讓非你控制的物件可以跟某個目標介面匹配 問題 系統的資料和行為都正確,但介面不相容 通常在需要使用一個洐生自既有抽象類別的 東西時 解決方案 Adapter為目的interface提供一個wrapper 參與者及協作者 Adapter將adaptee的介面做了轉換,讓client 在使用target時,不知道其實target是透過 adapter在使用adaptee的功能 結果 Adapter pattern讓新的class可以使用既存的 object,而不需因為既存object的interface而 受限 實作方式 用新的class把既存的object包起來 透過新class操作既存object的介面 client使用新的class
  • 10. About Adapter Pattern An Adapter for client to use legacy object with an interface which we already have. An Wrapper for client to use legacy object with no interface restricted. Wrapper are also kind of Adapter.
  • 11. Example of Adapter • International Plug Adapter is the best sample of Adapter Pattern!! Ref: http://www.amazon.com/Kensington-33117-International-Travel-Adapter/dp/B0002H4YUI/
  • 12. Example of Adapter • ADO.NET • Provides adapter for client to access various kind of database without(?) problem. • Once you have new kind of vintage database need to access with, just implement your own ADO.NET interfaces. How simple(?) it is!! Ref: http://msdn.microsoft.com/en-us/library/vstudio/27y4ybxw(v=vs.100).aspx
  • 13. Conclusion • Like Facade, Adapter also ‘wrapping’ object but they still have miner difference. ! Facade Adapter 是否存在既有類別? Yes Yes 是否須使用某個特定介面? No Yes 物件需要多型嗎? No Maybe 需要更簡單的介面嗎? Yes No