FAQ: State machines in Squeak
Last updated at 12:47 am UTC on 17 January 2006
Harvested from the squeak-dev list on 2/18/2003 [bkv]
The following packages can be found on SqueakMap:
- Ned Konz's Connectors package uses a state machine to model the state of the connections between Morphs ("both ends connected", etc.)
- Yanni Chiu's PostgreSQL driver uses a state machine (see the PGConnection class).
- Bob Hartwig's SqueakAmp uses the State design pattern.
- Ian Piumarta's Telnet client uses a state machine to parse the escape sequences that are sent from the remote client to the emulated terminal in Squeak.
- The class StatefulProtocolDescription has some examples on the class side, and its two subclasses show how to drive arbitrary method invocations during transitions along edges in the state graph. (There are some additional examples on the class side of the other clases in the same category.)
- A less trivial example is the vt100 state machine, defined in VT102Emulator class>>protocol. (This last one also shows how to create loops in the graph to accumulate arbitrary amounts of the input to be delivered to the action method when the input causes a break out of the loop.)
- Markus Gaelli explains FAQ: State machines in Squeak
- Ned Konz pointed out a particular simple way to implement a state machine.
A general State pattern may be found here
You may also see an Java/Smalltalk State machine examples