Design patterns·Making things
instead of building a new one from scratch you copy an existing configured one and change two fields.
Prototype pattern
Also calledprototype, clone pattern
Creating objects by cloning a prepared instance rather than by calling a constructor, so the expensive or fiddly setup happens once. It shows up where construction is costly, where the configuration is easier to demonstrate than to describe, or where the concrete class is not known to the caller. The whole difficulty of it is the copy itself — how deep it goes, and what happens to shared references.