Do you use design patterns?
http://stackoverflow.com/questions/11586/do-you-use-design-patterns引用
Any large program that is well written will use design patterns, even if they aren't named or recognized as such. That's what design patterns are, designs that repeatedly and naturally occur. If you're interfacing with an ugly API, you'll likely find yourself implementing a Facade to clean it up. If you've got messaging between components that you need to decouple, you may find yourself using Observer. If you've got several interchangeable algorithms, you might end up using Strategy.
It's worth knowing the design patterns because you're more likely to recognize them and then converge on a clean solution more quickly. However, even if you don't know them at all, you'll end up creating them eventually (if you are a decent programmer).
And of course, if you are using a modern language, you'll probably be forced to use them for some things, because they're baked into the standard libraries.
通过Java例子代码学习设计模式:
https://thenewcircle.com/bookshelf/java_fundamentals_tutorial/design_patterns.html
http://www.avajava.com/tutorials/categories/design-patterns
设计模式最佳例子之JAVA API:
Examples of GoF Design Patterns [closed]:
http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns
Design Patterns in the JDK:
http://www.briandupreez.net/2010/11/design-patterns-in-jdk.html
Structural比较 之:装饰 组合
Behavioral比较 之:策略 状态 命令
http://www.cnblogs.com/Mainz/archive/2007/12/15/996081.html
http://www.vincehuston.org/dp/
http://www.jdon.com/designpatterns/index.htm
Iterator:
http://www.journaldev.com/1716/iterator-design-pattern-in-java-example-tutorial
http://www.scribd.com/doc/16738161/Java-Design-Patterns-With-Examples#outer_page_46
设计模式笔记
http://www.riabook.cn/doc/designpattern/
设计模式之禅,写的不错哈:
http://cbf4life.iteye.com/
http://www.cnblogs.com/cbf4life/tag/%E8%AE%BE%E8%AE%A1%E6%A8%A1%E5%BC%8F/
23设计模式
http://www.cnblogs.com/singlepine/category/59538.html
Lazy loading 懒加载 模式的设计与实现:
http://jtechies.blogspot.com/2012/07/item-71-use-lazy-initialization.html
http://stackoverflow.com/questions/3578604/how-to-solve-the-double-checked-locking-is-broken-declaration-in-java
http://timezra.blogspot.com/2008/04/threadsafe-lazy-instantiation-without.html
http://books.google.com/books?id=Jl5rkQnbfAIC&pg=PA202&lpg=PA202&dq=java+lazy+load+list+object&source=bl&ots=guy4dQmaJU&sig=TjbgDB3Y4hds8--zh563hcavqGI&hl=en&sa=X&ei=6FZ1Uq70GcqErAfzpIDACA&ved=0CJcEEOgBMDc#v=onepage&q=java%20lazy%20load%20list%20object&f=false
http://twit88.com/blog/2008/01/22/design-pattern-in-java-101-lazy-load-part-i/
http://www.javabeat.net/2012/07/lazy-initialisation-singleton-and-double-check-locking/
filter 模式的设计与实现:
http://stackoverflow.com/questions/18062023/interface-method-that-has-different-parameters-in-java
http://erikras.com/2008/01/18/the-filter-pattern-java-conditional-abstraction-with-iterables/
非常好的一篇关于责任链模式的文章:
http://www.cnblogs.com/java-my-life/archive/2012/05/28/2516865.html
Builder Pattern(建造者模式/生成器模式):
极好的Builder范例:http://blog.crisp.se/2013/10/09/perlundholm/another-builder-pattern-for-java
Builder 和 继承:引用
[url]http://www.javacodegeeks.com/2012/07/builder-design-pattern-in-java.html
http://www.drdobbs.com/jvm/creating-and-destroying-java-objects-par/208403883?pgno=2
eclipse中生成 Builder,代码,见:
http://wuaner.iteye.com/blog/444391
关于State Pattern一篇好E文:
http://www.informit.com/guides/content.aspx?g=java&seqNum=576
Bridge pattern:
hhttp://javapapers.com/design-patterns/bridge-design-pattern/
http://www.oodesign.com/bridge-pattern.html
用 Decorator 设计邮件发送程序的一个例子:
http://www.developer.com/tech/article.php/3689436/Working-with-Design-Pattern-Decorator.htm
Simple Factory vs. Factory Method vs. Abstract Factory:
http://corey.quickshiftconsulting.com/1/post/2009/5/first-post.html
There are three kinds of design patterns:
Creational patterns:
They are related with how objects and classes are created. While class-creation patterns use inheritance effectively in the instantiation process,while object-creation patterns use delegation to get the job done.
* Abstract Factory groups object factories that have a common theme.
* Builder constructs complex objects by separating construction and representation.
* Factory Method creates objects without specifying the exact object to create.
* Prototype creates objects by cloning an existing object.
* Singleton restricts object creation for a class to only one instance.
Structural patterns:
They are related to class and object composition.This pattern uses inheritance to define new interfaces in order to compose new objects and hence new functionalities.
* Adapter allows classes with incompatible interfaces to work together by wrapping its own interface around that of an already existing class.
* Bridge decouples an abstraction from its implementation so that the two can vary independently.
* Composite composes one-or-more similar objects so that they can be manipulated as one object.
* Decorator dynamically adds/overrides behavior in an existing method of an object.
* Facade provides a simplified interface to a large body of code.
* Flyweight reduces the cost of creating and manipulating a large number of similar objects.
* Proxy provides a placeholder for another object to control access, reduce cost, and reduce complexity.
Behavioral patterns:
These design patterns deal with objects communication. They are specifically concerned with communication between objects.
* Chain of responsibility delegates commands to a chain of processing objects.
* Command creates objects which encapsulate actions and parameters.
* Interpreter implements a specialized language.
* Iterator accesses the elements of an object sequentially without exposing its underlying representation.
* Mediator allows loose coupling between classes by being the only class that has detailed knowledge of their methods.
* Memento provides the ability to restore an object to its previous state (undo).
* Observer is a publish/subscribe pattern which allows a number of observer objects to see an event.
* State allows an object to alter its behavior when its internal state changes.
* Strategy allows one of a family of algorithms to be selected on-the-fly at runtime.
* Template method defines the skeleton of an algorithm as an abstract class, allowing its subclasses to provide concrete behavior.
- 大小: 64.6 KB
分享到:
相关推荐
设计模式golang版本-go-design-patterns.zip" 包含了将传统设计模式应用到Go语言中的实例和解释。 1. **工厂模式**:工厂模式是一种创建型设计模式,它提供了一种创建对象的最佳方式。在Go中,我们可以使用接口和...
《DesignPattern设计模式》是软件开发领域中的一部经典之作,它主要探讨的是在面向对象编程中如何设计可复用、高效且具有高质量的代码。设计模式是对在软件设计过程中遇到的常见问题的一种最佳实践解决方案的总结,...
在这个"C++ Design Pattern 23种设计模式(全_解释+源代码).zip"压缩包中,包含了对23种经典设计模式的详细解释和源代码实现,这些模式均基于面向对象编程的原则。 首先,我们来看看这些设计模式的基础原则: 1. **...
标签"DesignPattern设计模式手册"进一步确认了内容主题,而压缩包中的文件名"designpattern(设计模式迷你手册)"则指明了主要的学习资料。 设计模式可以分为三类:创建型模式、结构型模式和行为型模式。创建型模式...
"设计模式:四巨头设计模式"通常指的是由Erich Gamma、Richard Helm、Ralph Johnson和John Vlissides四位作者在《设计模式:可复用面向对象软件的基础》一书中提出的23种经典设计模式。这本书被誉为设计模式领域的...
### Design Pattern(设计模式)讲义 #### 一、引言 设计模式是软件工程领域的一个重要主题,它提供了一套解决常见问题的方案。侯捷老师的讲义为我们揭示了设计模式背后的原理与实践方法。这份讲义不仅包含了GoF...
在《设计模式英文版-Design Pattern Explained》这本书中,作者深入浅出地介绍了设计模式的概念及其在软件开发中的应用。本书不仅适合已经熟悉面向对象编程的开发者,也适合那些希望通过学习设计模式来提高自己技术...
"DesignPattern_BasicKnowledge设计模式之类关系"这个主题主要探讨了类之间的交互方式,包括依赖、关联等基本概念,这些都是构建可扩展、可维护的软件系统的基础。 1. **设计模式**:设计模式是对在特定上下文中...
深入浅出设计模式 (Head First Design Pattern)_带书签 深入浅出设计模式 (Head First Design Pattern)_带书签
"golang design pattern go 设计模式实现.zip" 文件提供了23种Go语言设计模式的实现,这些模式主要来自于经典的《设计模式:可复用面向对象软件的基础》一书,即通常所说的GOF(Gang of Four)设计模式。 1. **单例...
23种设计模式(Design Pattern)的C++实现范例,包括下面列出的各种模式,代码包含较详细注释。另外附上“设计模式迷你手册.chm”供参考。 注:项目在 VS2008 下使用。 创建型: 抽象工厂模式(Abstract Factory) 生成...
每种设计模式都有相应的UML图,有相应的代码实现,深刻的学习底层的一些机制。 希望更加深入了解学习的可以深入设计模式的文献,推荐《Java 设计模式》 GITHUB:git@github.com:akumalzw/design-pattern.git
Design Pattern
本资源"DesignPattern_设计模式c++_"是一个关于C++设计模式的简单实现集合,适合初学者作为入门教程来学习。 1. **单例模式(Singleton)**:保证一个类只有一个实例,并提供全局访问点。在C++中,通常通过私有化...
本资料包“JAVA 23种设计模式(全).Design Pattern_Java模式”涵盖了所有23种经典的GOF(GoF,Gang of Four)设计模式,旨在帮助开发者深入理解和应用这些模式。 首先,我们来看一下23种设计模式的分类: 1. **创建...
本份帮助文档主要是为了向读者介绍二十三种设计模式,包括模式的描述,适用性,模式的组成部分,并附带有简单的例 子和类图,目的是为了让读者了解二十三种设计模式,并能方便的查阅各种设计模式的用法及注意点。所...
在这个名为"JAVA design pattern-java设计模式"的CHM文件中,我们可能找到了关于如何在Java开发中应用设计模式的详细信息。 设计模式通常分为三大类:创建型、结构型和行为型。创建型模式关注对象的创建,如单例...
本资料库中的"design pattern设计模式范例"提供了23种经典设计模式以及最新的范式用法,非常适合用于项目重构或作为学习设计模式的参考。 首先,我们来看23种经典的设计模式,它们通常分为三类:创建型、结构型和...