- Design Patterns and Best Practices in Java
- Kamalmeet Singh Adrian Ianculescu LUCIAN PAUL TORJE
- 129字
- 2021-06-25 20:52:34
Simple factory versus factory method versus abstract factory
We have talked about three ways to implement the factory pattern, namely, the simple factory, the factory method, and the abstract factory pattern. If you are confused about these three implementations, you are not to be blamed, as there is a lot of overlap between them. Moreover, there is no single definition of these patterns, and experts may differ on how they should be implemented.
The idea is to understand the core concept. At its core, we can say that the factory pattern is all about delegating the responsibility for the creation of appropriate objects to a factory class. If our factory is complex, that is, it should serve multiple types of objects or factories, we can modify our code accordingly.
推薦閱讀
- SQL Server 從入門到項目實踐(超值版)
- 微服務(wù)設(shè)計(第2版)
- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發(fā)經(jīng)典名著)
- C# Programming Cookbook
- C# 從入門到項目實踐(超值版)
- Apache Spark Graph Processing
- Mastering ServiceNow(Second Edition)
- 數(shù)據(jù)結(jié)構(gòu)習(xí)題解析與實驗指導(dǎo)
- “笨辦法”學(xué)C語言
- Zabbix Performance Tuning
- 大學(xué)計算機基礎(chǔ)
- Learning VMware vSphere
- 從零開始學(xué)UI:概念解析、實戰(zhàn)提高、突破規(guī)則
- Python高性能編程(第2版)
- Python繪圖指南:分形與數(shù)據(jù)可視化(全彩)