
Software Design – The Prototype Pattern
Our tour of the creational patterns takes us to one of the fastest ways to create a new instance. The prototype pattern provides an option to clone an instance rather than create and then set values. This approach has a variety of uses that can reduce coding and execution time. The Prototype Pattern Defined It helps to start with the “Gang of Four” definition and then we will dig into that. “Specify the kinds of objects to create using a prototypical instance, and create new objects by copying this prototype.” The benefit of this pattern is that we replace the constructor with a clone method. This approach can include parameters for the clone to limit/specify the values to clone. On the other hand, it... Read more