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

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.

主站蜘蛛池模板: 南充市| 威远县| 红河县| 卢湾区| 沙湾县| 绥芬河市| 嘉义县| 宁河县| 铜鼓县| 马尔康县| 丹阳市| 喀什市| 绍兴市| 天全县| 兴海县| 威远县| 北辰区| 喀喇| 永春县| 丹东市| 于都县| 云安县| 丽江市| 金阳县| 英德市| 凤台县| 新巴尔虎左旗| 会理县| 清流县| 泗洪县| 镇坪县| 乌审旗| 宁乡县| 益阳市| 法库县| 大渡口区| 若尔盖县| 锦州市| 界首市| 隆子县| 奉贤区|