外墙设计模式是什么? [英] What is the facade design pattern?

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

问题描述

facade 是一个包含许多其他类的类吗?

Is facade a class which contains a lot of other classes?

是什么使其成为设计模式?对我来说,这就像一个普通班。

What makes it a design pattern? To me, it is like a normal class.

您能告诉我这种 Facade 模式吗?

Can you explain to me this Facade pattern?

推荐答案

设计模式是解决重复出现问题的常用方法。所有设计模式中的类都是普通类。重要的是它们的结构以及如何以最佳方式解决特定问题。

A design pattern is a common way of solving a recurring problem. Classes in all design patterns are just normal classes. What is important is how they are structured and how they work together to solve a given problem in the best possible way.

Facade 设计模式简化了与复杂系统的接口;因为它通常由组成复杂系统子系统的所有类组成。

The Facade design pattern simplifies the interface to a complex system; because it is usually composed of all the classes which make up the subsystems of the complex system.

Facade可以使用户免受系统复杂细节的影响,并为他们提供简化视图 易于使用。它还可以将使用系统的代码与子系统的详细信息解耦,从而使以后更轻松地修改系统。

A Facade shields the user from the complex details of the system and provides them with a simplified view of it which is easy to use. It also decouples the code that uses the system from the details of the subsystems, making it easier to modify the system later.

http://www.dofactory.com/Patterns/PatternFacade.aspx

http://www.blackwasp.co .uk / Facade.aspx

此外,学习设计模式时重要的是能够识别出适合您给定问题的模式,然后使用它适当地。仅仅因为您知道某种模式,就滥用它或试图使其适应某些问题是很常见的事情。在学习使用设计模式时要注意这些陷阱。

Also, what is important while learning design patterns is to be able to recognize which pattern fits your given problem and then using it appropriately. It is a very common thing to misuse a pattern or trying to fit it to some problem just because you know it. Be aware of those pitfalls while learning\using design patterns.

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

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