A Pattern is a solution to a problem in a context

来源:互联网 发布:新疆的网络管制 编辑:程序博客网 时间:2024/06/05 18:24


command模式

http://www.tracefact.net/Design-Pattern/Command.aspx

 设计模式分类(结构型、创建型, 行为型)

http://www.cnblogs.com/justForMe/archive/2011/07/18/2109211.html


decorator  添加职责, 不改变接口

adaptor     接口适配转换, 改变接口

facade       使接口更简单(减少依赖的类)


facade模式与The Principle of Least Knowledge

The object itself
ß Objects passed in as a parameter to the method
ß Any object the method creates or instantiates
ß Any components of the object


总结设计模式有哪些原则? 

单一职责(例如迭代模式中,迭代这一功能分离开来,因为迭代可能有中间状态要维护)

only talk to friend

等等

总结这些原则有助于说明为什么要用这些模式(head first 一书中有讲解)



格式:

模式名:

类图:

设计原则:

好处:

坏处:

应用例子(代码?):


http://blog.csdn.net/wwj_748/article/details/9747941 有很好的总结(head first这本书)






0 0
原创粉丝点击