The answer says "D. The Prototype pattern allows you to create customized objects without knowing their exact class details.". But doesn't the same apply to the other patterns like abstract factory and factory method also ? In those patterns also, the client does not need to know the exact class and creation method.

Please share your thoughts on this.

Thanks Devi

Ricardo Ferreira

Ranch Hand

Posts: 156

posted 10 years ago

Originally posted by Sreedevi Vinod: This is another question from the Whizlabs simulator. "Which design pattern should you use when you need to create objects without knowing either their exact class or how to create them?"

The answer says "D. The Prototype pattern allows you to create customized objects without knowing their exact class details.". But doesn't the same apply to the other patterns like abstract factory and factory method also ? In those patterns also, the client does not need to know the exact class and creation method.

Please share your thoughts on this.

Thanks Devi

The prototype objective is to create CUSTOMIZED objects. This simple sentence can disagree with the abstract factory and factory method definitions, because they are creational patterns that create objects based on an specified interface. This means that the created object will be an realization of this interface.

The prototype can create objects without know the class, but it can create any type of object, not based on a interface.