From: Robert Klemme Date: 2003-05-17T00:59:44+09:00 Subject: Re: State Pattern Implementation "Simon Vandemoortele" schrieb im Newsbeitrag news:987xa.4791$1u5.452@afrodite.telenet-ops.be... > On Fri, 16 May 2003 at 02:59 GMT, Sacha Schlegel wrote: > > Did look at the state pattern in "Desing Patterns, E. Gamma, R. Helm, R. > > Johnson, J. Vlissides, Addison-Weslay, 1995 > > > Do YOU or anyone else have links to "implemented" ruby state pattern > > code? > > Take a look at http://www.rubygarden.org/ruby?StatePattern I'd prefer to not use the context but make the state changing methods return the new state. At least in this example I can't see the advantage of the choosen implementation. Maybe someone can shed some light in this. (Don't have the GOF book available.) If a state needs info about its sourroundings, maybe it would make sense to use a binding instead, which was generated in class Client (or Context). Just a thought. Regards robert