Creational patterns

The flashcards below were created by user cepheuz on FreezingBlue Flashcards.

  1. 1
    • Abstract factory
    • Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
    • 抽象工厂模式
    • 为一个产品族提供了统一的创建接口。当需要这个产品族的某一系列的时候,可以从抽象工厂中选出相应的系列创建一个具体的工厂类。
  2. 2
    • Builder
    • Separate the construction of a complex object from its representation, allowing the same construction process to create various representations.
    • 生成器模式
    • 将一个复杂对象的构建与它的表示分离,使得同样的构建过程可以创建不同的表示。
  3. 3
    • Factory method
    • Define an interface for creating a single object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses (dependency injection[18]).
    • 工厂方法模式
    • 定义一个接口用于创建对象,但是让子类决定初始化哪个类。工厂方法把一个类的初始化下放到子类。
  4. 4
    • Prototype
    • Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
    • 原型模式
    • 用原型实例指定创建对象的种类,并且通过拷贝这些原型创建新的对象。
  5. 5
    • Singleton
    • Ensure a class has only one instance, and provide a global point of access to it.
    • 单例模式
    • 确保一个类只有一个实例,并提供对该实例的全局访问。
  6. 6
    • Lazy initialization
    • Tactic of delaying the creation of an object, the calculation of a value, or some other expensive process until the first time it is needed. This pattern appears in the GoF catalog as "virtual proxy", an implementation strategy for the Proxy pattern.
    • 惰性初始模式
    • 推迟对象的创建、数据的计算等需要耗费较多资源的操作,只有在第一次访问的时候才执行。
  7. 7
    • Multiton
    • Ensure a class has only named instances, and provide a global point of access to them.
    • 多例模式
    • 确保一个类只有命名的实例,并提供对这些实例的全局访问。
  8. 8
    • Object pool
    • Avoid expensive acquisition and release of resources by recycling objects that are no longer in use. Can be considered a generalisation of connection pool and thread pool patterns.
    • 对象池模式
    • 通过回收利用对象避免获取和释放资源所需的昂贵成本。
  9. 9
    • Resource acquisition is initialization
    • Ensure that resources are properly released by tying them to the lifespan of suitable objects.
    • 资源获取为初始化
    • 通过绑定到合适对象的生命周期来确保资源被适当地释放。
Author:
cepheuz
ID:
315230
Card Set:
Creational patterns
Updated:
2016-02-04 12:38:28
Tags:
Design Patterns
Folders:
Software Engineering
Description:
Design Patterns - Creational patterns 創建型模式
Show Answers: