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

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.

主站蜘蛛池模板: 武鸣县| 永兴县| 山东省| 惠安县| 七台河市| 金乡县| 许昌市| 运城市| 兴安县| 青阳县| 万全县| 进贤县| 吉隆县| 神池县| 建湖县| 共和县| 澳门| 福贡县| 仪陇县| 宁阳县| 桂东县| 平远县| 沧源| 仁布县| 丘北县| 台南市| 泰来县| 滨海县| 乌海市| 龙井市| 博爱县| 靖江市| 苏尼特左旗| 庆元县| 陵川县| 疏附县| 攀枝花市| 高清| 吐鲁番市| 定日县| 安庆市|