Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: Sticky Button Down State

From: greggirwin:mindspring at: 1-Jul-2003 9:47

Hi Daril, DN> I don't do much View programming now, but when I do it DN> would be great to see examples or a How-to. ^_^ Agreed. I think we all want that.
>> My main tool against this kind of problem is a state >> machine. Events are placed into a queue and dispatched from there.
DN> Sounds complex... The complexity is there already. State machines help to *manage* it by making things explicit. Most programs contain an informal state machine of some kind. As soon as you need to disallow events, or handle them differently based on what the app is doing, you've got a state machine. The only difference in what I'm talking about is that you design them explicitly rather than setting flags here and there, disabling event triggers, and using nested SWITCH statements. Designing the state machine for your program forces you to identify all the possible states it could be in, what events can occur, and what you do for each event in each state. All that information is going to be expressed implicitly in your program anyway. What makes the "normal" way seem simpler is that we tend to ignore a lot of the things that can actually happen, so we're handling only a portion of all the possible cases. This is a great way to keep complexity at bay, but not a great way to build mission critical software. It is always best to express things as simply and directly as possible. Sometimes the only way to find the best solution is to try all the ways you can think of and compare them. :) -- Gregg