floater
Java Jedi
总版主
发贴: 3233
积分: 421
|
于 2006-07-12 22:39
not quite right.
On the one hand, a lot of patterns have similar code. On the other hand, their intentions are entire different, the invariants and variants are hidden under the code.
In the strategy patten, we want to switch strategies, depending on different values of some field. The place to switch is the tricky part, i.e., where do you want to put the switching code, e.g., in the caller's constructor, or in an if-else block, or on a method signature.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." - Martin Fowler, Refactoring - Improving the Design of Existing Code
|