01-01 Creational Patterns

Overview

When will use it
Creational patterns prescribe the way that objects are created. These patterns are used when a decision must be made at the time a class is instantiated. Typically, the details of the classes that are instantiated – what exactly they are, how, and when they are created – are encapsulated by an abstract superclass and hidden from the client class, which knows only about the abstract class or the interface it implements. The specific type of the concrete class is typically unknown to the client class

What Design Pattern Does it Include

Factory Method

Define an interface for creating an object, but let subclasses decide which class to instantiate. Factory Method lets a class defer instantiation to subclasses. Varying: subclass of object that is instantiated.

Abstract Factory

Provide an interface for creating families of related or dependent objects without specifying their concrete classes.Varying: families of product objects.

Builder

Separate the construction of a complex object from its representation so that the same construction process can create different representations.
Varying: how a composite object gets created.

Prototype

Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.
Varying: class of object that is instantiated.

Singleton

Ensure a class only has one instance, and provide a global point of access to it.
Varying: the sole instance of a class

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值