谁帮我翻译下这几行英文,谢谢
关于Adapter模式的,
http://www.cs.sjsu.edu/faculty/pearce/modules/patterns/behavioral/pluggable.html
翻译准确点~,谢谢~
[解决办法]
这么简单还要翻译,混妹哪~
再穷不赚此分
[解决办法]
可插拔适配器设计模式
Introduction简介
An object contains methods and variables.包含一个对象的方法和变量。 Methods can be invoked.方法可以调用。 Variables can be updated.变量可以被更新。 But what if a variable contained a method?但是,如果一个变量包含一个方法吗? This would mean we could change the method dynamically.这将意味着我们可以动态改变的方法。 Several instances of the same class could have different methods in the same variable.同一类的几个实例可以有不同的方法,在相同的变量。 In a sense, the pluggable adapter pattern takes polymorphism (the ability of override a method in a subclass) and the Strategy Design Pattern (the ability to change the algorithm used by a method) to a new level.从某种意义上说,可插拔适配器模式多态性(在子类中重写一个方法的能力)和策略设计模式(能力改变的方法使用的算法)到一个新水平。
Structure结构
The key to the Pluggable Adapter Pattern is to be able to treat methods as data.可插拔适配器模式的关键是要能处理数据的方法。 (This is one of the big ideas behind the Functional Programming paradigm.) For example, we might represent methods as instances of a Method class: (这是一个功能的编程范式背后的大思路)例如,我们可能会代表作为一个方法的类的实例方法:
Discussion讨论
Java reflection provides a Method class. Java反射机制提供了一个方法的类。 C++ functors can be pluggable adapters as can function pointers. C + +中仿函数可以是可插拔的适配器,可以函数指针。
[解决办法]
可插拔适配器设计模式
简介
一个对象包含方法和变量。方法可以被调用。变量可以被更新。但是,是否一个变量包含一个方法吗?这将意味着我们可以动态改变方法。同一类的几个实例在相同的变量的情况下可以有不同的方法,从某种意义上说,可插拔适配器模式多态性(在子类中重写一个方法的能力)和策略设计模式(使用方法改变算法的能力)上升到一个新的水平。
结构
可插拔适配器模式的关键是能够像处理数据一样处理方法。(这是一个依附于功能编程范式的很好的主意。)例如,我们可能会表现方法作为方法类的实例。
讨论
Java反射机制提供了一个方法类。C++中仿函数可以把可插拔适配器作为函数指针。