2

Im building a service (rest services) that make an internal call to database and then make one external web services call. This services is available to internal request and is exposed to external clients calls, My doubt is if i can name this service a Facade or a Gataway. I did read about Gateway and Facade patterns, one is when a customer is an external application and other is to internal application, so i dont found nothing about services patterns with both kind of calls.

1 Answers1

0

In many ways Gateway/Facade are two sides of the same coin The gateway pattern would be used to simplify the calls to the web services external to you (i.e. provide a consistent API) and the facade pattern would be used to provide a simplified version of your own internal API to your clients.

if you want your clients to have the same access to the external web service as you do, you could always incorporate the simplified external API into your facade directly. A better solution might be to decouple it from your internals through the use of the command pattern (or similar) that way if the external web services API adds functionality or changes for whatever reason you have a simple way of modifying your system to cope.

I don't think there is one pattern for your particular use case, you are going to have to engineer your solution based on what works best/what gives you the most consistent, maintainable code.

Community
  • 1
  • 1
Jan Hanson
  • 194
  • 5
  • 13