/Design-pattern

设计模式 / Design pattern( java )

Primary LanguageJava

概述

一起学习设计模式吧!我会在学习的同时写一些程序同一个设计模式也会写多个实例(Ps:每一个模式的说明和讲解都在测试类里。第一个实例通常没有在项目中的实用价值,但它能让我们更好理解该模式。)

★设计模式 之 五重境界★

  • Lv.1 从来没学过设计模式。对面向对象理解不深,设计的代码、模块非常糟糕。
  • Lv.2 学了几个模式。像发现了新大陆,开始考虑可维护性可扩展性。但急着想要用着自己学过的模式,时常造成误用模式。
  • Lv.3 学习了过半的模式,以及所有原则。感觉模式之前诸多相似,无法分清差异。同时害怕用错模式,而用时犹豫。
  • Lv.4 学习了所有的模式。此时脑中非常凌乱,需要大量的实践、应用才能到达下一个阶段。
  • Lv.5 灵活使用各种模式,融会贯通。甚至不用一个具体的模式也能设计出非常优秀非常合适的层次结构,达到无招胜有招。

Summary

Study design pattern together! I'd like to code some program when I study it~ Every design pattern have one more example~ (By the way,every detail and explain will in the test class.And the first example in each pattern maybe not so useful in project,but it makes we understand the pattern eayily)

##★Design pattern 's five Levels★

  • Lv.1 Never study the design pattern.Know very less about object-oriented.The code is terrible.
  • Lv.2 Study several design patterns.Just like discovery of the new continent.Consider more about extensibility and maintainability.But you always use the wrong pattern because you want to use the pattern you have study as soon as possible.
  • Lv.3 Study patterns more than a half and all the principles.You may be find they are very similar.And you afraid of using wrong pattern.
  • Lv.4 Study all the patterns.You are mass of them.You need so many example and try again and again to level up.
  • Lv.5 You can use all the patterns easily.And you always design a perfect hierarchical structure by yourself rather than a kind of pattern.You just "without action get the better of have action".

Chinese-English

设计模式 Design Pattern 已更新例子数
简单工厂 Simple Factory 1
策 略 Strategy 1
装 饰 Decorator 1
代 理 Proxy 1
工厂方法 Factory Method 1
原 型 Prototype 1
模板方法 Template Method 1
外 观 Facade 1
建 造 者 Builder 1
观 察 者 Observer 1
抽象工厂 Abstract Factory 1
状 态 State 1
适 配 器 Adapter 1
备 忘 录 Memento 1
组 合 Composite 1
迭 代 器 Iterator 1
单 例 Singleton 2
桥 接 Bridge 0
命 令 Command 0
职 责 链 Chain of Responsibility 0
中 介 者 Mediator 0
享 元 Flyweight 0
解 释 器 Interpreter 0
访 问 者 Visitor 0

参考文献

  • 《大话设计模式》 - 程杰
  • 《JavaWeb设计模式之道》 - 蒋海昌