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.
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.
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