有的书读了N遍还是不能完全理解和掌握, C++经典书籍尤其如此, GP, MP, OOA, OOD的书籍更是需要高级C++程序员才能开始真正理解和掌握.
重读GoF经典-Design Patterns. 还记得另一本-Implementation Patterns的几个关键字: Values, Principles, and Patterns.
Design Patterns的purpose:
"The purpose of this book is to record experience in designing object-oriented software as design patterns.
Each design pattern systematically names, explains, and evaluates an important and recurring design in object-oriented systems."
Pattern has four essential elements: pattern name, problem, solution, consequences.
The design patterns in this book are description of communicating objects and classes that are customized to solve
a general design problem in a particular context.
再次看完英文版的GoF 23种Design Patterns.
.创建型(5): abstract factory, build, factory method, prototype, singleton.
.结构型(7): adapter, bridge, composite, decorator, facade, flyweight, proxy.
.交互型(11): chain, command, interpreter, iteration, mediator, memento, observer, state, strategy, template method, visitor.
Encapsulating variation is a theme of many behavioral patterns. 封装变化是许多行为模式的一个主题.
读后感: 如果项目巨大, 需要累次重构, 前期预估有重构的风险, 那patterns非常重要, patterns就是通过设计实现技巧(代码复杂度上升), 来获得以后的弹性和可扩展.
如果项目很小, 通常只需要层次化, 模块化即可, 当然能很好的设计应用patterns效果会更佳, 代码会更加elegent, 文档也更好维护, 相应的工时也肯定会上升.
总之前期的设计文档, patterns抽象很重要, 这是细节活, 也是技术活, Team长久发展的生命线.
阅读(2017) | 评论(0) | 转发(0) |