Builder
来源:互联网 发布:python snmp agent 编辑:程序博客网 时间:2024/05/12 11:43
The Builder Pattern is a software design pattern.The intention is to abstract steps of construction of objects so thatdifferent implementations of these steps can construct differentrepresentations of objects.
Often, the Builder Pattern is used to build Products in accordance to the Composite pattern, a structure pattern.
Class Diagram
Useful tips
- Builder focuses on constructing a complex object step by step.Abstract Factory emphasizes a family of product objects (either simpleor complex). Builder returns the product as a final step, but as far asthe Abstract Factory is concerned, the product gets returnedimmediately.
- Builder often builds a Composite.
- Often, designs start out using Factory Method(less complicated, more customizable, subclasses proliferate) andevolve toward Abstract Factory, Prototype, or Builder (more flexible,more complex) as the designer discovers where more flexibility isneeded.
- Sometimes creational patterns are complementary: Builder can useone of the other patterns to implement which components are built. Abstract Factory, Builder, and Prototype can use Singleton in their implementations.
Consequences of the Builder Pattern
- A Builder lets you vary the internal representation of the product it builds. It also hides the details of how the product is assembled.
- Each specific builder is independent of the others and of the rest of the program. This improves modularity and makes the addition of other builders relatively simple.
- Because each builder constructs the final product step-by-step, depending on the data, you have more control over each final product that a Builder constructs.
- A Builder pattern is somewhat like an Abstract Factory pattern in that both return classes made up of a number of methods and objects. The main difference is that while the Abstract Factory returns a family of related classes, the Builder constructs a complex object step by step depending on the data presented to it.
- Builder
- Builder
- Builder
- Builder
- Builder
- Builder
- Builder
- Builder
- Builder
- Builder
- builder
- Builder
- builder
- Builder
- BUILDER
- builder
- Builder
- Builder
- Perl DBI mssql
- 两个Linux操作系统NFS服务器的配置方法
- 硕士论文写作须知
- JAVA时间
- Mark
- Builder
- 《给开复同志的一封信》
- 查看linux系统版本是32位还是64位
- 在IE状态栏显示会话超时信息
- windows API
- 在Linux上安装飞信
- 数字转字符串前面自动补0的实现
- 数据库查询之通配符的使用[数据库]
- 在PowerBuilder中实现动态菜单的方法