社区
研发管理
帖子详情
design pattern 's question
gorge_an
2001-08-08 12:05:32
about prototype (原型).
大家好。 在学习design pattern的时候。我对prototype (原型)的具体用途不是很清楚。书上说是为了减少subclass的个数。但是我看好想不是的。希望读过该书的
大虾给我一些提示。希望可以具体的讲一下prototype 的思想!
谢谢了先!
...全文
125
5
打赏
收藏
design pattern 's question
about prototype (原型). 大家好。 在学习design pattern的时候。我对prototype (原型)的具体用途不是很清楚。书上说是为了减少subclass的个数。但是我看好想不是的。希望读过该书的 大虾给我一些提示。希望可以具体的讲一下prototype 的思想! 谢谢了先!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
5 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dbbdggdbbdgg
2001-09-09
打赏
举报
回复
关于Pattern的资料,什么都有
http://www.umlchina.com/Pattern/Newindex1.htm
one_add_one
2001-08-11
打赏
举报
回复
gz
jbtan
2001-08-10
打赏
举报
回复
prototype pattern 的确可以减少subclass的数量,但这是后果,而不是目的。我们不能仅仅因为要减少subclass而使用prototype. 此外,如果创建一个对象是耗时操作的话, 我们使用prototype。例如,一个class A的实例包括一个极为复杂(耗时)的查询,而我们需要在不同的地方使用查询结果(当然,可能要求不同的排序或者字段),那么可以通过“克隆”(deep copy or clone)这个实例来得到新的对象,而不是创建A的subclass(比如,仅仅是排序不一样), 去重复耗时操作来得到一个新对象。不限于上述。
请指正。
gorge_an
2001-08-10
打赏
举报
回复
ok thank you
!
gorge_an
2001-08-09
打赏
举报
回复
up
JavaScript
Pat
tern
s
* Study sample JavaScript approaches to common
design
pat
tern
s such as Singleton, Factory, Decorator, and more * Examine
pat
tern
s that apply specifically to the client-side browser environment
The Complete Computer Vision Course with Python
While there are many answers to this
que
stio
n, the umbrella answer is computer vision. In this course, you'll use Python to build a variety of tools that reflect the broad range of computer vision ...
leetcode中国-oracle:Oracle
que
stio
n。。。。。。。 428 无向图最短路径 calculator: 224 227 772 770 394 第一轮: Done: 44. Wildcard Matching 判断source string和
pat
tern
string是否match, ?代表任意一个字母,比如 s = "Happy" p = "H?...
外文翻译 stus MVC
Another way of thinking about Action class is as the Adapter
design
pat
tern
. The purpose of the Action is to "Convert the interface of a class into another interface the clients expect. Adapter lets ...
laravel-decorator:使用laravel-decorator包轻松装饰您的方法调用
什么是"Decorator" :red_
que
stio
n_mark: 装饰器是可调用的,它包装原始装饰的可调用对象,以形成由前两个组成的新可调用对象。 就像一条Python蛇吞下了整个鹿,然后环绕着它的身体! 之后,蛇变得有能力吃和消化...
研发管理
1,265
社区成员
28,324
社区内容
发帖
与我相关
我的任务
研发管理
软件工程/管理 管理版
复制链接
扫一扫
分享
社区描述
软件工程/管理 管理版
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章