This presentation provides an introduction to API Facade pattern. It describes what the problem is, how the pattern solves the problem and how such a pattern can be utilized in real deployments.
3. Façade Patten in OOP
(Source:
http://en.wikipedia.org/wiki/Facade_pattern)
4. API Façade Pattern
It provides a simple interface to a complex system
Most enterprise software/services are stable and
provide a dependable service, but they are
difficult to expose to web using protocols such as
HTTP.
More and more apps are relying on such
enterprise services
This pattern allows to expose such enterprise
services as APIs to app developers
Still confused what it does for you? Next few
slides illustrate the pattern.
5. Problem
Imagine that you are an app developer. You are
writing personalized weather app, called
MyWeather, where you automatically get the
location from Google maps (service 1), feed it to
weather channel service (service 2) and maintain
a profile for user at another third-party service
called myprofile (service 3). How do you about
designing and implementing your app?
MyWeath
er
Service 2
Service 1
End users Service 3
6. Direct Connection to Complex
Systems
do_op() do_op()
Client 1 Client 2
(1) op1
(2) op2 (3) op3
System 1 System 2 System 3
7. Direct Connection to Complex
Systems
Clients needs to deal with
Multiple network connections
Initialization of multiple security/API contexts
Different message formats from each system
How can we avoid multiple connections from
clients and make the client app development less
painful?
8. API Façade Pattern
Client 1 Client 2
do_op() do_op()
(1) op1
API Layer
(2) op2
(3) op3
System 1 System 2 System 3
9. API Façade Pattern
One connection, one security/API context, one
message format for client
Further:
Allows to perform centralized validation
Allows to control message content and flow
Ability to provide value added services such as
monitoring, logging, throttling, etc.
10. Three Step Process
(1) Design API
(2) Implement the design with data stubs (Façade)
(3) Mediation between Façade and
legacy/complex systems
11. A Practical Solution
Client 1 Client 2
API Gateway
Enterprise Service Bus
System 1 System 2 System 3
12. References
eBook: API Façade Pattern, Brian Mulloy
http://en.wikipedia.org/wiki/Facade_pattern
My blog:
http://mohamednabeel.blogspot.com/2014/09/api-facade-
pattern.html
Notas do Editor
Furniture showroom facades furniture warehouse.
Each client needs to make 3 connections, negotiate API/service security each time and may have to deal with different data formats for different systems.
It is a bad idea to expose core objects of each system to outside as it makes client app development fragile and will break if the system objects are changed.
One connection (authentication), one message format for the client, the rest is taken care of by the API layer
Can plug into to a different system without changing the client application as the complexities are abstracted from clients
API layer can perform additional validation/throttling, etc. request payload manipulation in general
App developers can start to work on their application as soon as API is designed (assuming it won’t change over the cause of implementation). This gives them the benefit to market their apps quickly.