什么是立面设计模式? [英] What is Facade Design Pattern?

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

问题描述

一个类包含很多其他类?



什么使它成为一种设计模式?对我来说,就像一个普通的班级。



你能解释一下这个 Facade 模式吗?



提前感谢。

解决方案

设计模式是解决常见问题的常用方法。所有设计模式中的类只是正常类。重要的是他们的结构如何,以及如何共同努力以最好的方式解决给定的问题。



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



门面将用户屏蔽系统的复杂细节,并向他们提供一个简化视图易于使用。它也解耦从子系统的细节使用系统的代码,以便稍后修改系统更容易。



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



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



此外,学习设计模式时,重要的是能够识别哪个模式适合您的给定问题,然后使用它适当。滥用某种模式或尝试将其适应某些问题是一件非常常见的事情,因为您知道这一点。在学习设计模式时,请注意这些陷阱。


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

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

Can you explain me about this Facade pattern?

Thanks in advance.

解决方案

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.

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.

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天全站免登陆