下一个最高级抽象是 BeanFactory 接口,它是工厂设计模式的实现,允许通过名称创建和检索对象。
The next-highest layer of abstraction is the BeanFactory interface, an implementation of the Factory design pattern that enables objects to be created and retrieved by name.
此时,您可能很想更进一步并用成熟的抽象工厂对象替换工厂方法,如Erich Gamma等人在设计模式中详细描述的那样。
At this point, you may be tempted to go one step further and replace the factory method with a full-fledged abstract factory object, as detailed in Design Patterns by Erich Gamma, et al.
希望这篇文章能帮助你理解抽象工厂模式的基础。
Hopefully this article helped you understand the basics of the abstract factory pattern.
应用推荐