Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hello! Prototype Pattern is right? #14

Open
haoolii opened this issue Oct 10, 2018 · 4 comments
Open

Hello! Prototype Pattern is right? #14

haoolii opened this issue Oct 10, 2018 · 4 comments

Comments

@haoolii
Copy link

haoolii commented Oct 10, 2018

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

@jacksplwxy
Copy link

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

@haoolii
Copy link
Author

haoolii commented Apr 8, 2019

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...

@jacksplwxy
Copy link

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.

@haoolii
Copy link
Author

haoolii commented Apr 16, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants