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

Chapter 1. Creational Patterns

The creational patterns are designed to deal with the object creation mechanism in software designing. A system using these patterns becomes independent of how objects are created, which means it is independent of how concrete classes are instantiated.

These patterns encapsulate the use of concrete classes and favor the use of interfaces in the relationship between objects, allowing to have better abstraction of the global system conception.

Thus, if we analyze the singleton pattern, a pattern designed to instantiate only one instance of a class, we find that the mechanism that controls the unique access to this instance is fully encapsulated in the class, which means that this is completely transparent to the client consuming the instance of the class.

In this chapter, we will introduce you to the five creational patterns and discuss how we can use them with Swift:

  • The prototype pattern
  • The factory method pattern
  • The singleton pattern
  • The abstract factory pattern
  • The builder pattern

The objectives of these patterns are described in the following table:

主站蜘蛛池模板: 阿坝| 兴仁县| 双辽市| 鸡东县| 曲周县| 辽阳县| 和田县| 商河县| 枣阳市| 长宁区| 平果县| 大姚县| 正蓝旗| 蒙自县| 临海市| 乌鲁木齐县| 文水县| 娱乐| 建平县| 封开县| 丘北县| 秦安县| 德惠市| 奇台县| 海城市| 仁怀市| 庄河市| 盐边县| 陆川县| 烟台市| 福州市| 乐东| 莱阳市| 砚山县| 岳西县| 买车| 嘉黎县| 衡阳市| 阿拉善右旗| 绥江县| 成安县|