The Gateway and the Plugin Patterns


To play lego with your applications, think about using the following patterns:

Gateway: An object that encapsulates access to an external system or resource (Patterns of Enterprise Application Architecture, Fowler et al. Addison-Wesley, 2004)

  •  Every gateway eliminate a direct dependency with the business logic implementation and details like protocols, communication means and mechanisms behind the gateway. 
  • Possibility to wrapp methods, to have control about the asynchronous and synchronous character of the API.
  • Extern applications will not access the data model directly, witch can improve security, and increase maintenability  (It reduce coupling between business logic, platform dependent logic and the data model).
  • Depending on the needs of every system the gateway can be unidirectional or bidirectional.
The pattern Plugin: This pattern extends the behavior of a class by allowing extensions to plug into an abstract class that, in turn, plugs into a core class. This creates a new subclass that includes only the capabilities required in the specific context. 
  • The communication with every extern system will use its own gateway. 
  • The integration with every business logic third application is P2P (Point to point). Communications with Webservices can be concentrated by an ESB tool. Where we could plug and play the different gateways
  • The ease of testing, by:
    •  Separting clearly concerns of each gateway, functionaly, facilitating unit testing.
    •  Pluging and playing mocks gateway implementations that simulate the functional purpose of the gateways.

To adequate to a change all you have to do, is to develop the new implementation of your interface contract, and then plug and play.

Comentarios