From: Jim Weirich Date: 2005-08-12T10:16:52+09:00 Subject: Re: Head First Design Patterns - Strategy Pattern [was: Java/C# "interface" in Ruby ?] On Thursday 11 August 2005 05:21 pm, Dave Burt wrote: > This looks like exactly what mixins are for - you can put the > implementation itself in a module and then include it rather than using > delegation and having extra objects with one-method floating around. Although Peter's demo didn't illustrate it, the key to the strategy pattern is that the strategy can be dynamically chosen (and changed) at runtime. However, including modules would be an interesting variation on the Template Method Pattern, which is similar to Strategy, except that it uses inheritance to get the variation (and therefore can't change at runtime). -- -- Jim Weirich jim@weirichhouse.org http://onestepback.org ----------------------------------------------------------------- "Beware of bugs in the above code; I have only proved it correct, not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)