结合GOF的《设计模式:可复用的软件基础》,看了前三份之一的《Design Patterns Explained》,对以前看的几个模式了解更深了。还在当前的项目中小用了一下,感觉还不错。前几天做的东西,需求一直要变,搞得我挺晕的。
为什么要学设计模式呢(转自《Design Patterns Explained》):
It helps to
-
Reuse existing, high-quality solutions to commonly recurring problems.
-
Establish common terminology to improve communications within teams.
-
Shift the level of thinking to a higher perspective.
-
Decide whether I have the right design, not just one that works.
-
Improve individual learning and team learning.
-
Improve the modifiability of code.
-
Facilitate adoption of improved design alternatives, even when patterns are not used explicitly.
-
Discover alternatives to large inheritance hierarchies.
-
Design to interfaces.
-
Favor composition over inheritance.
-
Find what varies and encapsulate it
还有好多,要好好看......
1 条评论:
设计模式挺重要的
发表评论