the prototype pattern what we have here is very real need to create large number of objects that are mostly the samewith one or two small tweaks differentiating them loading these objects from scratch every time is not scalable solutionas we saw which brings us to implementing the prototype pattern in the prototype patternwe favor composition over inheritance classes that are composed of parts allow you to substitute those parts at runtimeprofoundly affecting the testability and maintainability of the system the classes to instantiate are specified at runtime by means of dynamic loading the result of this characteristic of the prototype pattern is that sub-classing is reduced significantly the complexities of creating new instance are hidden from the client all of this is greatbut the main benefit of this pattern is that it forces you to program to an interfacewhich leads to better design note just beware that deep-cloning classes with circular references can and will cause issues see the next section for more information on shallow versus deep copy we simply want to make copy of some object we have on hand to make sure the copy is set up the way it should beand to isolate the functionality of the object from the rest of the systemthe instance you are going to copy should provide the copying feature clone(method on the instance that clones the object and then modifies its values accordingly would be ideal the three components needed for the prototype pattern are as followsclient creates new object by asking prototype to clone itself prototype declares an interface for cloning itself concrete prototype implements the operation for cloning itself (credit for the tree components of the prototype pattern / /design-pattern-prototype/