Skip to content

关于本章

本章描述OOP design pattern,OOP是当今主流的programming paradim,因此对它的design pattern的学习是必须的。

本章首先描述OOP design principle,然后描述OOP中的各种design pattern。各种具体的design pattern都是践行着design principle。

OOP design pattern分类

Design Patterns: Elements of Reusable Object-Oriented Software 提出的OOP 的design pattern,是design pattern的开山之作。

Creational patterns

维基百科Design Patterns#Creational

Creational patterns are ones that create objects, rather than having to instantiate objects directly. This gives the program more flexibility in deciding which objects need to be created for a given case.

Structural patterns

refactoring Classification of patterns

Structural patterns explain how to assemble objects and classes into larger structures, while keeping the structures flexible and efficient.

除此看到structural pattern,我的第一想法是Boost.PropertyTree

Behavioral pattern

behavioral design patterns are design patterns that identify common communication patterns among objects and realize these patterns.

即object之间communicate的pattern。

Reference