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

  • Spring 5 Design Patterns
  • Dinesh Rajput
  • 238字
  • 2021-07-08 09:59:31

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.
主站蜘蛛池模板: 白城市| 贵德县| 鹰潭市| 古田县| 鹤岗市| 抚顺市| 子洲县| 蕉岭县| 内乡县| 胶州市| 宜兰县| 平远县| 桐梓县| 遵义县| 海宁市| 柞水县| 栾川县| 闻喜县| 拜城县| 获嘉县| 瑞丽市| 铁岭县| 揭西县| 麻阳| 虹口区| 沙洋县| 汉中市| 驻马店市| 临猗县| 呼伦贝尔市| 孝昌县| 新安县| 德惠市| 丹东市| 岫岩| 论坛| 裕民县| 望谟县| 威海市| 永城市| 沈阳市|