What's the point of the Prototype design pattern?
Posted
by
user1905391
on Programmers
See other posts from Programmers
or by user1905391
Published on 2012-12-14T23:51:16Z
Indexed on
2012/12/15
5:22 UTC
Read the original article
Hit count: 206
design-patterns
|prototyping
So I'm learning about design patterns in school. Many of them are silly little ideas, but nevertheless solve some recurring problems(singleton, adapters, asynchronous polling, ect). But today I was told about the so called 'Prototype' design pattern.
I must be missing something, because I don't see any benefits from it. I've seen people online say it's faster than using "new"' but this is doesn't make any sense, since at some point, regardless how the new object is created, memory needs to be allocated for it ect.
Furthermore, doesn't this pattern run in the same circles as the 'chicken or egg' problem? By this I mean, since the prototype pattern essentially is just cloning objects, at some point the original object must be created itself (ie, not cloned). So this would mean, that I would need to have an existing copy of every object that I would ever want to clone already ready to clone? Seems stupid to me.
Can anyone explain what the use of this pattern is?
Original post: http://stackoverflow.com/questions/13887704/whats-the-point-of-the-prototype-design-pattern
© Programmers or respective owner