Facade和Gateway设计模式有什么区别? [英] What is the difference between Facade and Gateway design patterns?

查看:384
本文介绍了Facade和Gateway设计模式有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

或Facade == Gateway?

or Facade==Gateway?

推荐答案

在GoF书中查看门面以及Martin Fowler网关的另一个答案中的链接

Reviewing Facade in the GoF book and the link in another answer to Martin Fowler's Gateway, it appears that their focus is in opposite directions.

Facade为(一个或多个)外部客户端提供了复杂内部组件的简单统一视图;

Facade provides a simple uniform view of complex internals to (one or more)external clients;

网关提供了一个外部资源到应用程序内部的简单统一视图。

Gateway provides a simple uniform view of external resources to the internals of an application.

这个区别让我们专注于哪一个更重要在设计中:

This distinction lets us focus on which is more important in a design :

使用Facade,外部系统是我们的客户;如果外部接口更简单,最好增加面向内部的复杂性。

With the Facade, the external system is our customer; it is better to add complexity facing inwards if it makes the external interface simpler.

使用Gateway,内部系统是我们的客户;尽可能地帮助我们,即使外部更复杂。

With the Gateway, the internal system is our customer; give it all the help we can, even if the externals are more complex.

这篇关于Facade和Gateway设计模式有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆