Hi All,
I just started reading the
Java Design
pattern & referred the following url for understanding the Prototype Design pattern.
(
http://www.fluffycat.com/java/JavaNotes-GoFPrototype.html)
But I am not sure whether will we use this pattern for the given usage(i.e for creating soupspoons, saladspoons in that example. I think we can directly instantiate the soupspoons and saladspoons). Can you please clarify the prototype usage.
My Observation for prototype pattern usage is:
If i want to have a copy of the instance then i can use the prototype pattern. For that i have to get the clone of object by implementing Clonable interface and calling the clone method then serialize & deserialize the result object to get the copy of the given instance. Am I right? What is the advantage of doing so?
Thanks & Regards,
M.S.Raman.