What is a Gateway?
Sounding mysteriously like a doorway to a mysterious netherworld, a Gateway forms an important part of object-oriented development.
An official description of a Gateway was provided by Martin Fowler, an expert in OOP:
A Gateway is an object that encapsulates access to an external system or resource Martin Fowler.
This description states that a Gateway object manages and handles access to
Essentially, this means that a Gateway object will manage and handle access between an application and a data provider, which could be anything such as a relational database, or an external Application Programming Interface (API) returning XML or JSON formatted data.
Regardless of where the data originates from, or in which format it is returned, the main purpose of the Gateway is to encapsulate the relationship and return the data cleanly and easily back to the application.
Other objects are able to access the resource by sending requests through the Gateway object that returns the data...