design_patterns_in_typescript icon indicating copy to clipboard operation
design_patterns_in_typescript copied to clipboard

Hello! Prototype Pattern is right?

Open haoolii opened this issue 7 years ago • 4 comments

I think prototype pattern is reduce resource consumption. UseObject.create(Prototype.prototype) wouldn't it be better?

haoolii avatar Oct 10 '18 12:10 haoolii

I think prototype pattern is reduce resource consumption. UseObject.create(Prototype.prototype) wouldn't it be better?

That's what I thought.Sometimes,clone a object is more efficient than new,so we can use Prototype Pattern

jacksplwxy avatar Apr 08 '19 09:04 jacksplwxy

I think prototype pattern is reduce resource consumption. UseObject.create(Prototype.prototype) wouldn't it be better?

That's what I thought.Sometimes,clone a object is more efficient than new,so we can use Prototype Pattern

Wow, Time is getting too fast! I think this example actually is the factory pattern...

haoolii avatar Apr 08 '19 12:04 haoolii

I think prototype pattern is reduce resource consumption. UseObject.create(Prototype.prototype) wouldn't it be better?

That's what I thought.Sometimes,clone a object is more efficient than new,so we can use Prototype Pattern

Wow, Time is getting too fast! I think this example actually is the factory pattern...

yes,it is a factory pattern.And i write the ptototype pattern demo like this https://github.com/jacksplwxy/DesignPatterns_TypeScript/blob/master/src/Prototype%EF%BC%88%E5%8E%9F%E5%9E%8B%EF%BC%89/demo.ts.

jacksplwxy avatar Apr 16 '19 01:04 jacksplwxy

I think prototype pattern is reduce resource consumption. UseObject.create(Prototype.prototype) wouldn't it be better?

That's what I thought.Sometimes,clone a object is more efficient than new,so we can use Prototype Pattern

Wow, Time is getting too fast! I think this example actually is the factory pattern...

yes,it is a factory pattern.And i write the ptototype pattern demo like this >https://github.com/jacksplwxy/DesignPatterns_TypeScript/blob/master/src/Prototype%EF%BC%88%E5%8E%9F%E5%9E%8B%EF%BC%89/demo.ts.

I done it with Typescript at last year too 原來你也是華人呢! https://github.com/unnhao/IT30Days/tree/master/Day10

haoolii avatar Apr 16 '19 02:04 haoolii