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

Abstract factory design pattern

Provide an interface for creating families of related or dependent objects without specifying their concrete classes. - GOF Design Patterns

The Abstract Factory pattern comes under the creational design pattern. It is a high-level design pattern compared to the factory method design pattern. According to this design pattern, you just define an interface or abstract class to create a related dependent object without specifying its concrete subclass. So here, the abstract factory returns a factory of classes. Let me simplify it for you. You have a set of factory method design patterns, and you just put these factories under a factory using the factory design pattern, which means that it is simply a factory of factories. And there is no need to take the knowledge about all of the factories into the factory--you can make your program using a top-level factory.

In the Abstract Factory pattern, an interface is responsible for creating a factory of related objects without explicitly specifying their classes. Each generated factory can give the objects as per the Factory pattern.

The benefits of the Abstract Factory pattern are as follows:

  • The Abstract Factory Design provides loose coupling between the component families. It also isolates the client code from concrete classes.
  • This design pattern is a higher-level design than the Factory pattern.
  • This pattern provides better consistency at construction time of objects across the application.
  • This pattern easily swaps component families.
主站蜘蛛池模板: 达拉特旗| 原阳县| 九龙城区| 华安县| 望谟县| 秀山| 黎平县| 景东| 宜兰县| 娱乐| 榆林市| 车险| 高碑店市| 厦门市| 常熟市| 沂源县| 怀集县| 安阳市| 云和县| 泰顺县| 土默特左旗| 昭觉县| 宜昌市| 阜新市| 故城县| 耒阳市| 上栗县| 云林县| 遂平县| 霍城县| 东山县| 琼海市| 健康| 浠水县| 新龙县| 平湖市| 阜南县| 札达县| 土默特左旗| 浦北县| 大埔区|