This discussion is archived
1 Reply Latest reply: Jul 4, 2011 10:49 AM by jschellSomeoneStoleMyAlias RSS

When should we use prototype pattern?

fxbird Newbie
Currently Being Moderated
I know object cloning is a concrete usage, but when we should use that?
  • 1. Re: When should we use prototype pattern?
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    Since this is a java forum the following from GoF is relevant...

    ------
    "Prototype is particularly useful with static languages like C++...and little or no type information is available at run-time...It's less important in languages...that provide what amounts to a a prototype (i.e, a class object) for creating instances of each class."
    ------

    Java of course has java.lang.Class and has plenty of type information.

    Cloning is a very special case that is outside normal java.

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points