官术网_书友最值得收藏!

Prototype design pattern

Specify the kind of objects to create using a prototypical instance, and create new objects by copying this prototype. - GOF Design Patterns

The Prototype pattern comes under the creational design pattern family of GOF patterns in software development. This pattern is used to create the objects by using a clone method of objects. It is determined by a prototypical instance. In the enterprise application, object creation is costly in terms of creating and initializing the initial properties of objects. If such a type of object is already in your hand, then you go for the prototype pattern; you just copy an existing similar object instead of creating it, which is time-consuming.

This pattern involves implementing a prototype interface, it creates a clone of the current object. This pattern is used when the direct creation of the object is costly. For example, say that an object is to be created after a costly database operation. We can cache the object, returns its clone on the next request, and update the database as and when it is needed, thus reducing database calls.

主站蜘蛛池模板: 和田县| 临海市| 宁安市| 福清市| 云梦县| 东阳市| 南和县| 绿春县| 商河县| 林甸县| 军事| 连江县| 涡阳县| 乐昌市| 府谷县| 岳阳市| 分宜县| 徐水县| 武陟县| 綦江县| 新和县| 噶尔县| 长治市| 册亨县| 乌兰县| 乐都县| 白沙| 镇宁| 金平| 慈利县| 霞浦县| 乐平市| 台前县| 兴安县| 大石桥市| 涞水县| 紫阳县| 鄄城县| 杭锦旗| 梁平县| 汽车|