From: "Mauricio Fernández" Date: 2003-05-20T02:28:04+09:00 Subject: Re: State Pattern Implementation On Tue, May 20, 2003 at 02:07:41AM +0900, Robert Klemme wrote: > class Socket > def statusMessage(); @state.statusMessage; end > end > > Now, @state.statusMessage needs to access the Socket it's attached to. We > can achieve this by > > - recording a ref to socket in state > - augmenting every method call on state with the socket reference > - put all socket state info that the state needs (i.e. the two messages) > in all state classes (clearly not intended by this pattern) > - ? > > I find all these a bit awkward... Crap, I don't remember what should be done w/ shared attributes. I'll see if I can get my book sent here :) Ummm, now I remember something about internalizing information and the applicability of the State DP... really need the book. -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com "Who is General Failure and why is he reading my hard disk?" Microsoft spel chekar vor sail, worgs grate !! -- Felix von Leitner, leitner@inf.fu-berlin.de