Singleton Pattern(单例模式):Ensure a class has only one instance, and provide a global point of access to it.
(确保某一个类只有一个实例,而且自行实例化并向整个系统提供这个实例。)
Factory Pattern(工厂方法模式):Define an interface for creating an object,
but let subclass decide which class to instantiate.Factory Method lets a class defer instantiation to subclass.
(定义一个用于创建对象的接口,让子类决定实例化哪一个类。工厂方法是一个类的实例化延迟到其子类。)
Abstract Factory Pattern(抽象工厂模式):Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
(为创建一组相关或相互依赖的对象提供一个接口,而且无需指定它们的具体类。)
Template Method Pattern(模板方法模式):Define the skeleton of an algorithm in an operation,deferring some steps to subclasses.
Template Method lets subclass redefine certain steps of an algorithm without changing the algorithm's structure.
(定义一个操作中的算法框架,而将一些步骤延迟到子类中。使得子类可以不改变一个算法的结构即可以重定义该算法的某些特定步骤。)
Builder Pattern(建造者模式): Separate the construction of a complex object form its representation so that the
same construction process can create different representations.
(将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。)
Proxy pattern(代理模式):Provide a surrogate (代理) or placeholder for another object to control access to it.(为其他对象提供一种代理以控制对这个对象的访问。)
Prototype Pattern(原型模式):Specify the kinds of objects to create using a prototypical instance,
and create new objects by copying this prototype.
(用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。)
Mediator Pattern(中介者模式):Define an object that encapsulates how a set of objects interact.
Mediator promotes loose couping by keeping objects from referring to each other explicitly,
and it lets you vary their interaction independently.
(用一个中介对象封装一系列的对象交互,中介者使各对象不需要显示的相互作用,从而使其耦合松散,而且可以独立的改变它们之间的交互。)
命令模式
Encapsulate a request as an object,thereby letting you parameterize clients with different requests,queue or log requests, and support undoable operations.(将一个请求封装成一个对象,从而让你使用不同的请求把客户端参数化,对请求排队或者记录请求日志,可以提供命令的撤销和恢复功能。)
责任链模式
Avoid coupling the sender of a request to its receiver by giving more than one object a chance to handle the request.Chain the receiving objects and pass the request along the chain until an object handles it.(使多个对象有机会处理请求,从而避免了请求的发送者和接收者之间的耦合关系 。将这些对象连成一个链,并沿着这条链传递请求,知道有对象处理它为止。)
装饰模式(Decorator Pattern)
Attach additional responsibilities to an object dynamically keeping the same interface.Decorators provide a flexible alternative to subclassing for extending functionality.(动态地给一个对象添加一些额外的职责。就增加功能来说,装饰模式相比生成子类更为灵活。)
策略模式(Strategy Pattern)
Define a family of algorithms, encapsulate each one, and make them interchangeable.适配器模式(Adapter Pattern)
Convert the inface of a class into another interface clients expect.Adapter lets classes work together that couldn't otherwise because of incompatible interface.
迭代器模式(Iterator Pattern)
Provide a way to access the elements of an aggregate object sequentially without exposing its underlying representation.
组合模式(Composite Pattern)
Compose objects into tree structure to represent part-whole hierarchies.Composite lets clients treat individual objects and compositions of objects uniformly.
观察者模式(Observer Pattern)
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
门面模式(Facade Pattern)Provide a unified interface to a set of interface in a subsystem.Facede defines a higher-level interface that makes the subsystem easier to use.(要求一个子系统的外部与其内部的通信必须通过一个统一的对象进行。门面模式提供了一个高层次的接口,使得子系统更容易使用。)
备忘录模式(Memento Pattern)
Without violating encapsulation, capture and externalize an object's internal state so that the object can be restored to this state later.
访问者模式(Visitor Pattern)
Represent an operation to be performed on the elements of an object structure.Visitor lets you define a new operation without changing the classes of the elements on which it operates.
(封装一些作用于某种数据结构中的各种元素,它可以在不改变数据结构的前提下定义作用于这些元素的新的操作。)
状态模式
Allow an object to alter its behavior when its internal state changes.The object will appear to change its class.(当一个对象在状态改变时允许其改变行为,这个对象看起来像改变了其类。)
解释器模式(Interpreter Pattern)
Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences int the language.
(给定一门语言,定义它的文法的一种表示,并定义一个解释器,该解释器使用该表示来解释语言中的句子。)
享元模式(Flyweight Pattern)
Use sharing to support large numbers of fine-grained objects efficiently.
桥梁模式(Bridge Pattern)
Decouple an abstraction from its implementation so that the two can vary independently.
(将抽象和实现解耦,使得两者可以独立的变化。)
Creational patterns
These patterns have to do with class instantiation. They can be further divided into class-creation patterns and object-creational patterns. While class-creation patterns use inheritance effectively in the instantiation process, 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 class to create.
Prototype creates objects by cloning an existing object.
Singleton restricts object creation for a class to only one instance.
Structural patterns
These concern class and object composition. They use inheritance to compose interfaces and define ways to compose objects to obtain new functionality.
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 zero-or-more similar objects so that they can be manipulated as one object.
Decorator dynamically adds/overrides behaviour 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
Most of these design patterns 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.
Visitor separates an algorithm from an object structure by moving the hierarchy of methods into one object.
Circuit Breaker prevents using a broken external dependency (or internal component) until it comes back online
相关推荐
《Head First 设计模式》的英文版是一本面向初学者的设计模式入门书籍,它以幽默风趣的文风,深入浅出地介绍了软件设计中经常使用的设计模式。设计模式是一套被反复使用、多数人知晓、经过分类编目、代码设计经验的...
《GOF 23种设计模式》是软件工程领域中极具影响力的一本书,由Erich Gamma、Richard Helm、Ralph Johnson和John Vlissides四位大师合著,因此也被称为“Gang of Four”(GOF)的设计模式。这本书详细阐述了在面向...
这本书的英文版,"Design Patterns: Elements of Reusable Object-Oriented Software",包含23种经典的设计模式,分为创建型、结构型和行为型三大类: 1. **创建型模式**:主要关注对象的创建过程,包括单例模式、...
解释器模式将描述怎样 在 有了一个简单的文法后, 使用模式设计解释这些语句。 在解释器模式里面提到的语言是指任 何解释器对象能够解释的任何组合。在解释器模式中需要定义一个代表 文法的命令类的等 级结构,也...
《Head First设计模式》是一本深受开发者欢迎的设计模式教程,英文版为读者提供了全面而深入的理解,适合那些对设计模式充满兴趣并愿意投入精力去学习的朋友们。设计模式是软件工程中的重要概念,它们是解决常见问题...
这本书被誉为设计模式的经典之作,它归纳了23种在软件设计中常见的模式,旨在解决面向对象设计中的常见问题,提高代码的重用性、灵活性和可维护性。 设计模式并非具体的代码或库,而是描述在特定场景下如何解决常见...
在提供的文件列表中,我们有两个PDF文件,分别命名为“设计模式.pdf”和“Design Pattern.pdf”,这很可能是中文版和英文版的设计模式书籍,如GOF(Gang of Four)的经典著作《设计模式:可复用面向对象软件的基础》...
本知识点将详细介绍设计模式的分类、设计模式的六大原则,以及Java中23种设计模式的具体应用。 一、设计模式的分类 设计模式主要分为三大类,分别是创建型模式、结构型模式和行为型模式。此外,还有并发型模式和...
这本书以其独特的视觉和易于理解的方式介绍了23种GOF(GoF,Gang of Four)设计模式,这些模式是面向对象编程中的核心概念。设计模式是解决常见软件设计问题的模板,它们代表了在特定上下文中被反复验证过的设计解决...
《Head First设计模式》是软件开发领域中一本非常知名的经典著作,它以英文版的形式提供了深入浅出的设计模式讲解。这本书以其独特的“Head First”学习风格,通过丰富的图像、幽默的语言和互动性的教学方法,帮助...
本书设计实例从面向对象的设计中精选出23个设计模式,总结了面向对象设计中最有价值的经验,并且用简洁可复用的形式表达出来。本书分类描述了一组设计良好,表达清楚的软件设计模式,这些模式在实用环境下有特别有用...
### GOF 23种设计模式详解 ...综上所述,GOF的23种设计模式不仅在理论上有深刻的意义,而且在实际项目中也有广泛的应用。了解和掌握这些设计模式有助于提升软件架构的设计水平,提高代码质量和开发效率。
Java设计模式通常涵盖单例、工厂方法、抽象工厂、建造者、原型、适配器、装饰器、桥接、组合、享元、职责链、命令、解释器、迭代器、访问者、中介者、备忘录、观察者、状态、策略、模板方法、访问者等23种经典设计...
### GOF23设计模式双语版解析 #### 引言 "GOF23设计模式双语版"是一份极具价值的学习资源,旨在帮助开发者更好地理解和应用23种经典的设计模式。这份资料由两个PDF包组成,分别用中文和英文进行讲解,适合不同语言...
这本书详细介绍了23种设计模式,这些模式是经过实践检验的解决方案,可以用来解决在面向对象编程和软件工程中常见的设计问题。 设计模式是一种在特定情况下,为了解决特定问题而被反复使用的、已被证明有效的方法或...
这本书是设计模式领域的经典之作,通常被称为“GOF”设计模式,其中包括了23种经典的设计模式。 1. **工厂模式**:这是最基础的创建型模式,它提供了一种创建对象的最佳方式,避免了直接new操作,使得代码更加灵活...
《HeadFirst设计模式》是软件开发领域的一本经典著作,主要介绍了面向对象设计中的23种经典设计模式。这本书以其独特的“HeadFirst”学习风格,通过丰富的图表、幽默的插图以及互动性强的教学方式,帮助读者深入理解...
### 从追MM谈Java的23种设计模式——详细解析 #### 1. 工厂模式(FACTORY) 在日常生活中,当我们邀请MM吃饭时,可能会选择麦当劳或者肯德基这样的快餐店,而这两家店都有各自特色的鸡翅。当我们带着MM到店时,...
GOF设计模式包括了23种核心模式,这些模式被广泛应用于Java、C++、.NET等各种面向对象编程语言中。它们可以分为三类:创建型模式、结构型模式和行为型模式。 1. **创建型模式**:这类模式主要关注对象的创建过程,...