3->The Factory Pattern(H058预定)
时间:2006-03-27
来源:互联网
The Factory
Pattern
IN OBJECT-ORIENTED PROGRAMMING, the most common way to create an object is with the new
operator, the language construct provided to do just that. But in some cases, new can be problematic.
For instance, the creation of many kind of objects requires a series of steps: you may need to
compute or fetch the object’s initial settings; you might have to choose which of many sub classes to
instantiate; or perhaps you have to create a batch of other helper objects before you can create the
object you need. In those cases, new is a “process” more than an operation―a cog in a bigger machine.
The Problem
How can you create such “complex” objects easily and conveniently―without cut-and-paste programming?
The Solution
Create a “factory”―a function or a class method― to “manufacture” new objects. To understand the
作者: PHPChina 发布时间: 2006-03-26
作者: Bantu 发布时间: 2006-03-28
我的qq 8502206
[ 本帖最后由 h058 于 2006-8-12 11:22 编辑 ]
作者: h058 发布时间: 2006-03-28
作者: PHPChina 发布时间: 2006-03-28
作者: forest 发布时间: 2006-03-28
引用:
原帖由 forest 于 2006-3-28 13:19 发表我也来试试这个啊,对了,请问管理员,翻译这个有没有时间限制,最近我比较忙!
:P
作者: PHPChina 发布时间: 2006-03-28
[ 本帖最后由 h058 于 2006-4-7 22:24 编辑 ]
作者: h058 发布时间: 2006-04-07
作者: PHPChina 发布时间: 2006-04-09
作者: h058 发布时间: 2006-04-09
Refactoring:重构
Factory Pattern:工厂模式
Factory:工厂
lazy loading:迟加载
TDD:测试驱动开发
Constructor:构造器
boundary condition :边界情况
Extract Method:提取方法
abstract class:抽象类
Introduce Parameter Object:引入叁数对象
SimpleTest:简单测试
Black Box Testing:黑匣子测试
White Box Testing:白匣子测试
API:接口
exception:异常处理
[ 本帖最后由 h058 于 2006-4-9 13:20 编辑 ]
作者: h058 发布时间: 2006-04-09
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28