Server-side Integration Patterns:
Service Gateway
Software Design – Unit 4
The Question …
What patterns do we have to
help us isolate the complexities
of accessing external services?
2
Gateway Pattern
How to deal with external resources? Ask ChatGPT about Gateway pattern. Interesting!
Software rarely lives in isolation
External resources usually provide APIs that are naturally complicated
APIs that can change
Service Gateway - object encapsulating access to an external
system or resource
Wrap all the special API code into a class whose interface looks like a regular
object.
Other objects access the resource through this Gateway, which translates the
simple method calls into the appropriate specialized API
[Link]
[Link]
3
Gateway – GoF Proxy Design Pattern
Provides a surrogate or
placeholder for another object to
control access to it
Uses an extra level of indirection
to support distributed, controlled,
or intelligent access
Adds a wrapper and delegation to
protect the real component from
undue complexity
[Link]
4
Gateway – GoF Adapter Pattern
Allows classes to work together
that normally could not because of
incompatible interfaces
Translates calls to its interface into
calls to the original interface
Also responsible for transforming
data into appropriate forms
[Link]
5
Gateways and Service Interfaces
The GATEWAY behaves as a “client”
of the external service (that acts as
a “server”)
Gateway
User
6
Server-side Integration Patterns:
Service Gateway
Comments?