然后再使用工厂方法模式,这样耦合度就与界面相关联了。
Then, I use the factory method pattern so that the coupling is with the interface.
现在,让我们在这个意义上定义的工厂方法模式。
Now, let us make sense of this definition for the Factory Method pattern.
您可以在应用程序需要创建其类型依赖于子类的实现的对象时,使用工厂方法模式。
You use the factory method pattern when an application needs to create objects whose type depend on the implementation of subclasses.
工厂方法模式定义了一个创建对象的接口,但由子类决定实例化的逻辑。
The Factory Method Pattern defines an interface for creating an object, but lets subclasses decide which class to instantiate.
而工厂方法模式,顾名思义,定义的是一个用来大量产出对象的方法的实现。
The factory method pattern, as its name implies, defines the implementation of a method used to churn out objects.
接着具体讲述了组件对象模型中使用的两种设计模式:工厂方法模式和代理模式。
It describes two kinds of design patterns in COM in detail: Factory Method pattern and Proxy pattern, and tells how to realize the former.
改进了简单工厂模式的实现策略,克服了原来简单工厂模式的局限性,同时弥补了工厂方法模式的不足。
The policy of Simple Factory is reformed, and applied to produce command objects, which eliminates the limitations of past Simple Factory and makes up the defect of Factory Method.
根据配置创建SecurityManager实例(使用Shiro的工厂概念,它表述了 工厂方法设计模式);
Create the SecurityManager instance based on the configuration (using Shiro’s Factory concept that represents the Factory Method design pattern).
单例、生成器和工厂方法设计模式被视为是创建型的模式,因它们可协助对象的构建。
The singleton, builder, and factory method design patterns are considered creational patterns, as they assist in the construction of objects.
使用工厂方法设计模式的正确方法是什么?
What's the right way to use the Factory method design pattern?
此时,您可能很想更进一步并用成熟的抽象工厂对象替换工厂方法,如ErichGamma等人在设计模式中详细描述的那样。
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.
此时,您可能很想更进一步并用成熟的抽象工厂对象替换工厂方法,如ErichGamma等人在设计模式中详细描述的那样。
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.
应用推荐