Skip to content

dlteng/JavaDesignPattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 

Repository files navigation

JAVA 设计模式

        工作中常常遇到设计模式,但遇到时又不知所以,所有萌发整理一下相关设计模式,以下设计模式分类均依据  
 《图解设计模式》一书中分类,代码顺序也以书中顺序编排。 

强化意识

        不要只使用具体类来编程,要优先使用抽象类和接口来编程!!!

GOF设计模式分类

1.创建型模式

简单工厂模式(Simple Factory)
工厂方法模式(Factory Method)
抽象工厂模式(Abstract Factory)
创建者模式(Builder)
原型模式(Prototype)
单例模式(Singleton)

2.结构型模式

外观模式(Facade)
适配器模式(Adapter)
代理模式(Proxy)
装饰模式(Decorator)
桥模式(Bridge)
组合模式(Composite)
享元模式(Flyweight)

3.行为型模式

模板方法模式(Template Method)
观察者模式(Observer)
状态模式(State)
策略模式(Strategy)
职责链模式(Chain of Responsibility)
命令模式(Command)
访问者模式(Visitor)
调停者模式(Mediator)
备忘录模式(Memento)
迭代器模式(Iterator)
解释器模式(Interpreter)


《图解设计模式》一书中设计模式分类

1.适应设计模式

迭代器模式(Iterator)
适配器模式(Adapter)

2.交给子类

模板方法模式(Template Method)
工厂方法模式(Factory Method)

3.生成实例

单例模式(Singleton)
原型模式(Prototype)
创建者模式(Builder)
抽象工厂模式(Abstract Factory)

4.分开考虑

桥模式(Bridge)
策略模式(Strategy)

5.一致性

组合模式(Composite)
装饰模式(Decorator)

6.访问数据结构

访问者模式(Visitor)
职责链模式(Chain of Responsibility)

7.简单化

外观模式(Facade)
调停者模式(Mediator)

8.管理状态

观察者模式(Observer)
备忘录模式(Memento)
状态模式(State)

9.避免浪费

享元模式(Flyweight)
代理模式(Proxy)

10.用类来表现

命令模式(Command)
解释器模式(Interpreter)

About

Java 设计模式代码实现

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors