Skip to content

coding-dream/Design_Pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

46 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Design_Pattern

设计模式&设计思想

记录关于23种设计模式的使用

设计模式分为:创建型模式, 结构型模式,行为型模式等23种设计模式。

一、五种创建型模式如下:

工厂方法模式factory_method

抽象工厂模式abstract_factory

单例模式singleton

建造者模式builder

原型模式prototype

二、结构型模式如下:

适配器模式adapter

桥接模式bridge

合成模式composite

装饰器模式decorator

门面模式facade

代理模式proxy

享元模式flyweight

三、行为型模式如下:

策略模式strategy

模板方法模式template_method

观察者模式observer

迭代器模式decorator

责任链模式responsibility_chain

命令模式command

备忘录模式memento

状态模式state

访问者模式visitor

中介者模式mediator

解释器模式interpreter


设计模式六大原则:

开放封闭原则:一个软件实体如类、模块和函数应该对扩展开放,对修改关闭。

里氏替换原则:所有引用基类的地方必须能透明地使用其子类的对象。

依赖倒置原则:高层模块不应该依赖低层模块,二者都应该依赖其抽象;抽象不应该依赖细节;细节应该依赖抽象。

单一职责原则:不要存在多于一个导致类变更的原因。通俗的说,即一个类只负责一项职责。

接口隔离原则:客户端不应该依赖它不需要的接口;一个类对另一个类的依赖应该建立在最小的接口上。

迪米特法则:一个对象应该对其他对象保持最少的了解。

模式图

模式图

About

设计模式&设计思想

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy