Git Product home page Git Product logo

design_patterns's Introduction

图说设计模式

本书使用图形和代码结合的方式来解析设计模式;

每个模式都有相应的对象结构图,同时为了展示对象间的交互细节, 我会用到时序图来介绍其如何运行;(在状态模式中, 还会用到状态图,这种图的使用对于理解状态的转换非常直观)

为了让大家能读懂UML图,在最前面会有一篇文章来介绍UML图形符号(看到UML类图和时序图);

在系统的学习设计模式之后,我们需要达到3个层次:

  1. 能在白纸上画出所有的模式结构和时序图;
  2. 能用代码实现;如果模式的代码都没有实现过,是用不出来的;即所谓,看得懂,不会用;
  3. 灵活应用到工作中的项目中;

目录结构说明

本书使用reStructuredText编写,你应该从index.rst开始;

根目录下的design_patterns.EAP为 EA的工程文件,里面包含里书中所有的类图和时序图示例;

code/:书中所有模式实现的示例源代码(工程使用C-Free组织,在gcc 4.6.2下编译通过);

以下三个目录为具体的模式讲解文章;

creational_patterns/ structural_patterns/ behavioral_patterns/

_static/:包含书中用到的所有图片;

_build/: 使用sphnix生成的html文档目录;

sphinx_rtd_theme/:为生成html文档所使用的主题;

在线浏览

http://design-patterns.readthedocs.org/zh_CN/latest/index.html

design_patterns's People

Contributors

me115 avatar oxwsds avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

design_patterns's Issues

关于装饰模式

下面这张图没看明白

Decorator: 抽象装饰类 与 Component: 抽象构件,为什么还有一个泛化关系?
不是只有一个聚合关系么?

http://design-patterns.readthedocs.io/zh_CN/latest/structural_patterns/decorator.html

简单工厂模式有一行日志错误了

`
ConcreteProductA::ConcreteProductA(){

}

ConcreteProductA::~ConcreteProductA(){

}

void ConcreteProductA::Use()
{
cout << "use productB" << endl; // use productA
}
`

类图讲解错误

看懂UML类图和时序图

小汽车与发动机之间是组合关系,使用带实心箭头的实线表示;

没有汽车,发动机也可以独立存在,汽车与发动机应该是聚合关系。同理,汽车和轮胎也是聚合关系。

我参考的这篇文章上的内容the-class-diagram

创建模型-建造者模型中的一个问题

你给的设计模式文档非常的清晰,比GOF的设计模式容易阅读,又比设计模式之禅容易理解,感谢你的分享.
在学习过程中,对于创建者模型-建造者模型的这一部分代码有一个疑问:Builder接口类修改为只提供标准接口,不带任何实现,具体的实现让ConcreteBuilder去完成,如下:
class Builder
{
public:
Builder();
virtual ~Builder();

virtual void buildPartA() = 0;
virtual void buildPartB() = 0;
virtual void buildPartC() = 0;
virtual Product * getResult() = 0;

};
是否更好一些呢.

帮助很大,感谢

你对这些模式的总结写的太好了,方便问下,什么时候有时间给剩余补全呢。感谢~

组合模式貌似没有

受益匪浅。
阅读过程中发现结构型模式中提到的“组合模式”重要度比较高却没有提到,
是否有何考量?
谢谢!

[Observer Pattern] Missing file in source code

Greetings,

In your demo source code, there is a file called "ConcreteSubject.h" in your main.cpp, however, the file is missing on your web page (existing in your code directory)
cheers

is Obeserver typo?

Great job! Just a small issue on the spelling "Obeserver"

In behavior/observer design pattern, I realized the word "Obeserver" often uses in code and your diagram. I am not sure what's your intention, it may be a misspelling.

cheers

继承关系,实现关系

自行车是车 是继承关系
小汽车和自行车;它们之间的关系为实现关系.使用带空心箭头的虚线表示;
但是怎么是虚线连接车,而不是 小汽车和自行车 之间连接

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.