By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,183 Members | 1,190 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,183 IT Pros & Developers. It's quick & easy.

Timer, State machine and Object oriented

P: n/a
Hi,

In my project I have a timer-driven state machine. The timer object
are in the form. Update of controls like edit, label will be executed
in some states. The state machine is in a seperate class, and will be
called when time-out event comes. The sequence is timeout->state
machine->update form.
I am now thinking using observer pattern to let the state machine
class update the form. One thing I am not so sure is, the real trigger
actually comes from the form, so the form is not only the observer of
the event, but also has the role of the subject. This seems violating
the decouple principle in using the observer pattern.

Have anyone had the same problem? Any idea will be appreciated
Steven

Feb 10 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
okay so you have built a system that has a set of defined states, it can
only have a single state at anyone time, the transistion between two of
these states is trigger when an event (message) is input into the system.
When the system is transistioning (processing) or has transitioned it fires
events back to any process that is interested.

The fact that the hosting process that is utilising your system both fires
the event to cause a transition in state and uses the obeserve pattern to
monitor the state of the system is irrelevant IMO to the functioning or
design of the system.

HTH

Ollie Riches
"Steven P" <ph*******@gmx.dewrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
Hi,

In my project I have a timer-driven state machine. The timer object
are in the form. Update of controls like edit, label will be executed
in some states. The state machine is in a seperate class, and will be
called when time-out event comes. The sequence is timeout->state
machine->update form.
I am now thinking using observer pattern to let the state machine
class update the form. One thing I am not so sure is, the real trigger
actually comes from the form, so the form is not only the observer of
the event, but also has the role of the subject. This seems violating
the decouple principle in using the observer pattern.

Have anyone had the same problem? Any idea will be appreciated
Steven

Feb 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.