> For the complete documentation index, see [llms.txt](https://hanfak.gitbook.io/workspace/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://hanfak.gitbook.io/workspace/general-paradigms/patterns/gateway.md).

# Gateway pattern

* encapsulates access to an external system or resource
* A gateway class provides a simplified way of interacting with something external that perhaps has a peculiar or difficult API.
* A gateway class can be created to facilitate interaction with this external system
* keep software soft by abstracting and insulating the system being developed from its external dependencies
* By also defining an interface for the gateway, it makes it possible to provide fake versions for testing purposes or swap out one third-party address validation service for another without the change rippling throughout the system.
* The gateway also helps to deal with anything unique to the external service
