ITeye博客

iReading:Head First 设计模式——设计模式入门,欢迎来到设计模式世界

i_bugs · 2013-05-16 15:11 · iReading · 编程语言 · Markdown

代码复用 经验复用

设计原则:

独立易变化代码 针对接口编程,而不是针对实现编程 目的:名(定义、规范、约束)实(实现)分离 关系:面向对象编程思想精髓之一 粒度:一定粒度视图上同类事物的抽象再表示,同类因粒度而变 实际:如果你是……,则必须能…… 方式:多态,在某粒度视图层面上对同类事物不加区别的对待统一处理 多用组合,少用继承 策略模式:The Strategy Pattern defines a family of algorithms, encapsulates each one, and makes them interchangeable. Strategy lets the algorithm vary independently from clients that use it.

待续……

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。