+ -
当前位置:首页 → 问答吧 → 3->The Factory Pattern(H058预定)

3->The Factory Pattern(H058预定)

时间:2006-03-27

来源:互联网

3
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

已经完成80%,明天就可以搞定啦!

[ 本帖最后由 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

热门下载

更多