The distinction between mechanism and policy is one of the best ideas behind the Unix design. Most programming problems can indeed be split into two parts:
“what capabilities are to be provided” (the mechanism) and “how those capabilities can be used” (the policy). If the two issues are addressed by different parts of the program, or even by different programs altogether, the software package is much easier to develop and to adapt to particular needs.
机制(mechanism ):
A mechanism is some technical aspect of a larger process or mechanical device, or combination of parts designed to perform a particular function. Sometimes an entire machine may be referred to as a mechanism. Examples are the steering mechanism in a car, or the winding mechanism of a wristwatch. When one of the links of a kinematic chain is fixed, the chain is known as a mechanism.Mechanisms are used to convert between one type of motion and another...
策略(policy ):
A policy is typically described as a deliberate plan of action to guide decisions and achieve rational outcome(s). However, the term may also be used to denote what is actually done, even though it is unplanned.
策略通常描述为一个谨慎的行动计划来引导结果和达到理性的结果。但是通常也用于指示实际完成,尽管是毫无计划的。
不这么羞涩地诠释这个思想的说法是这样的:
对于每一个设备,它的驱动的作用是表达出设备有那些功能,而不是简单地去实现它的功能就完事了。软件工程更倾向于把功能的接口表达出来,让别的应用程序去调用这些接口,而不是像某些菜鸟级程序一样,仅仅地把功能实现但是没有提供任何人去实用的机会。