提取方法模式提供了两个关键好处。
组合方法模式有三条关键规则
这是个典型的Factory方法模式实例。
严格遵守TDD会自然地产生符合组合方法模式的方法。
Rigorous adherence to TDD naturally creates methods that adhere to composed method.
然后再使用工厂方法模式,这样耦合度就与界面相关联了。
Then, I use the factory method pattern so that the coupling is with the interface.
模板方法模式和抽象类的不同在与处理工作流程。
This differs from the Template Method pattern in that the abstract superclass doesn't handle workflow.
现在,让我们在这个意义上定义的工厂方法模式。
Now, let us make sense of this definition for the Factory Method pattern.
模板方法模式的这种用法提供了关注点的好的分离。
Such USES of the Template Method pattern offer good separation of concerns.
教材在很大程度上决定着大学英语的教学方法模式。
The textbook determines to a great degree the teaching methods and class models of college English.
而工厂方法模式,顾名思义,定义的是一个用来大量产出对象的方法的实现。
The factory method pattern, as its name implies, defines the implementation of a method used to churn out objects.
组合方法模式指出,每个方法应该只做一件事,这个方法违反了此规则。
Composed method says that each method should do one and only one thing, and this method violates that rule.
您可以在应用程序需要创建其类型依赖于子类的实现的对象时,使用工厂方法模式。
You use the factory method pattern when an application needs to create objects whose type depend on the implementation of subclasses.
策略设计模式比模板方法模式花费了更多的工作去实现,但是它也更灵活。
The Strategy design pattern takes a little more work to implement than the Template Method pattern, but it is more flexible.
如果您曾经协助过或参与过方法模式的归档或创建,那么您应该熟悉图7所展示的图。
If you've ever assisted with, filed for, or otherwise been involved with creating a method patent, the diagram in Figure 7 May look familiar.
这稍微的更复杂去实现比用模板方法模式在类继承的版本中,但是也更灵活。
This is slightly more complex to implement than the version using concrete inheritance with the Template Method pattern, but is more flexible.
模板方法模式的另一个选择是策略模式,它抽取了多变的行为到一个接口中。
An alternative to the Template Method is the Strategy design pattern, which factors the variant behavior into an interface.
由于通常定义接口比定义类更好,模板方法模式通常被用于实现接口的策略。
As it's usually better to define types in interfaces rather than classes, the Template Method pattern is often used as a strategy to implement an interface.
因此,我将根据组合方法模式重构这个方法,看看是否可以分离出原子性部分。
So I'll refactor this method, with composed method in mind, to see if I can isolate the atomic parts.
接着具体讲述了组件对象模型中使用的两种设计模式:工厂方法模式和代理模式。
It describes two kinds of design patterns in COM in detail: Factory Method pattern and Proxy pattern, and tells how to realize the former.
由于模板方法模式是受保护的,而不是公共方法,调用者被分离从类实现的细节中。
As the template methods are protected, rather than public, callers are spared the details of the class's implementation.
在此介绍采用GOF的模板方法模式及采用回溯算法的模板方法模式的设计与实现。
Template method pattern of GOF and the realization of template method pattern in back tracing algorithm are introduced.
要创建Factory方法模式的实例,执行同Singleton模式相同的步骤。
To create an instance of the Factory Method Pattern, perform the same steps as for the Singleton Pattern.
在出现不完全符合由面向对象的方法模式所公开的典型同步请求-响应模式的情况时,如何处理?
How can cases be handled that do not fit neatly into to the synchronous request-response pattern typically exposed by the object-oriented method pattern?
模板方法模式使得子类可以不改变一个算法的结构即可重定义该算法的某些特定步骤。
Template Method lets subclasses redefine certain steps of an algorithm without changing the algorithm's structure.
但是,如果逻辑中包含真实的业务值,就会想到测试它,这个时候就可以看到提取方法模式的作用了。
If that logic embodies true business value, however, then you'll want to test it, in which case you'll get to see the Extract Method pattern at work.
Factory方法模式是一个创建的模式,它定义一个用来创建对象的接口,而让子类来决定实例化哪个类。
The Factory Method Pattern is a creational pattern that defines an interface for creating an object but lets subclasses decide which actual class to instantiate.
中介模式的“桥接”角色是使用模板方法模式实现的,它通过几种不同的基础通信技术,为远程服务调用提供支持。
The "bridge" role from the broker pattern was then implemented using the template method pattern to support remote service invocation using several different underlying communication technologies.
改进了简单工厂模式的实现策略,克服了原来简单工厂模式的局限性,同时弥补了工厂方法模式的不足。
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.
本文基于实际调研资料,附以详实的分析评述,结合相关政策章程,探讨户外广告的设计发布方法模式。
The paper which bases on practical survey with detailed analysis, discusses the outdoor advertisement's design and promotion mode combining with correlative policy and rule.
您可以使用各种各样的方法模式在飞机跑道上降落,这取决于由天气、交通密度、风速等等因素决定的空中交通控制指导。
You can land on an airstrip with various approach patterns, depending on air traffic control guidelines due to weather, traffic density, wind speed, and so on.
应用推荐