CSDN博客

img wangjiong

Strategy

发表于2004/9/16 17:16:00  564人阅读

Benefits:
• It provides a substitute to subclassing.
• It defines each behavior within its own class, eliminating the need for conditional statements.
• It makes it easier to extend and incorporate new behavior without changing the application.

Applicable Scenarios:
• Multiple classes differ only in their behaviors. The servlet API is a classic example of this.
• You need different variations of an algorithm.
• An algorithm uses data that is unknown to the client.

0 0

相关博文

我的热门文章

img
取 消
img