<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: What is a state machine?</title>
	<atom:link href="http://www.stateworks.net/2008/03/what-is-a-state-machine/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/</link>
	<description>StateWORKS blog about software engineering using virtual finite state machines</description>
	<lastBuildDate>Wed, 15 Sep 2010 17:51:43 +0200</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Joe</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-2816</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Wed, 15 Sep 2010 17:51:43 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-2816</guid>
		<description>It&#039;s been two years since first time I left a comment here. Recently, I happened to trace complete event-driven system programs. Suddenly I had the sense that why you do not like event driven stuff. Event itself is not a problem but software nowadays handles it using call backs. One call back tries to trigger another call back, or tries to communicate with another call back. System control logic is distributed among call backs. In some way, it&#039;s like system control logic is distributed among threads. Quite complex.

    After two years, I finally understood some things. I found sequential logic is simpler than concurrent logic. Use sequential and centralized logic whenever possible and  use concurrent logic only when necessary. 

    Another difficulty I found: sometimes same data must be handled by different actions(or different sorts of &#039;clients&#039;) and each action has different timings. Then making concurrent asynchronous access mechanism for the data may be a good thing, or the chaining actions for the data may become quite complex.</description>
		<content:encoded><![CDATA[<p>It&#8217;s been two years since first time I left a comment here. Recently, I happened to trace complete event-driven system programs. Suddenly I had the sense that why you do not like event driven stuff. Event itself is not a problem but software nowadays handles it using call backs. One call back tries to trigger another call back, or tries to communicate with another call back. System control logic is distributed among call backs. In some way, it&#8217;s like system control logic is distributed among threads. Quite complex.</p>
<p>    After two years, I finally understood some things. I found sequential logic is simpler than concurrent logic. Use sequential and centralized logic whenever possible and  use concurrent logic only when necessary. </p>
<p>    Another difficulty I found: sometimes same data must be handled by different actions(or different sorts of &#8216;clients&#8217;) and each action has different timings. Then making concurrent asynchronous access mechanism for the data may be a good thing, or the chaining actions for the data may become quite complex.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: admin</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-2083</link>
		<dc:creator>admin</dc:creator>
		<pubDate>Sun, 25 Jul 2010 07:31:38 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-2083</guid>
		<description>You are right. A network of communicating state machines each in its own thread without a clear logical structure is a nightmare and must end in a disaster. In the VFSM concept and its StateWORKS implementation we try to show  that the proper way of designing a system of state machines is the hierarchical structure. It is less a problem of having the state machines in one or more threads but the the logical design plays a decisive role. In the StateWORKS implementation all state machines are per definition in one thread anyway.</description>
		<content:encoded><![CDATA[<p>You are right. A network of communicating state machines each in its own thread without a clear logical structure is a nightmare and must end in a disaster. In the VFSM concept and its StateWORKS implementation we try to show  that the proper way of designing a system of state machines is the hierarchical structure. It is less a problem of having the state machines in one or more threads but the the logical design plays a decisive role. In the StateWORKS implementation all state machines are per definition in one thread anyway.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Toronto Condo Staging</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-2077</link>
		<dc:creator>Toronto Condo Staging</dc:creator>
		<pubDate>Sat, 24 Jul 2010 15:57:35 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-2077</guid>
		<description>If we design a set of state machines each solving a partial problem without having in mind from the beginning the entire logical structure we may end in a difficult fight with deadlocks and nondeterministic behavior by implementation.
Keeping state machines in one thread simplifies a lot.</description>
		<content:encoded><![CDATA[<p>If we design a set of state machines each solving a partial problem without having in mind from the beginning the entire logical structure we may end in a difficult fight with deadlocks and nondeterministic behavior by implementation.<br />
Keeping state machines in one thread simplifies a lot.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ferdinand</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-6</link>
		<dc:creator>ferdinand</dc:creator>
		<pubDate>Sat, 06 Sep 2008 09:20:39 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-6</guid>
		<description>I am glad that my comments could help you a bit.
You write that you are  “tired of many flags and if-else”. We are all tired with this jungle of conditions we build into our programs that make them difficult to understand and cost a huge amount of time (and money but normally we do not bother about it until there are institutions that are ready to pay for our exercises). It is interesting that we still believe that we get our software quickly to work with some simple solutions or tricks. I observe it on my behavior. As a rule I try to design  my software (using in most cases the concept of a state machine). But sometimes I behave also as a teenager. An example: for test purposes we have in StateWORKS the SWQuickPro monitor that displays all details of RTDB objects and can be used to manipulate objects. Some time ago we decided to extend its functionality by automatic testing features (some informations about it are described in www.stateworks.com/technology/TN20-Testing-with-StateWORKS). I was involved in that project  and decided just to “expand” the existing software adding “here and there” missing code. The functionality of that monitor part seemed to be simple: read a command file and then execute the commands line by line. In addition, these operations should have been affected by buttons: NEXT, RUN, RUN Continuous and STOP. This simple task appeared soon quite complex if you think about all constrains: missing file, error in command, missing or erroneous operand, etc. The task become quite obscure at the latest when we decided to introduced pseudo-commands: Delay and Wait For Event. Eventually, I got it working but it was a terrible code based on flags and if-then-else. I watched some time this software disaster and when I wanted to change something I found that I did not understand how and why it works. Eventually, I was completely fed up and wrote the software again starting from a state machine model. It took me a month or so but now we have software that I understand and at any time I can change it without fear of side effects. It would be relatively easy for another person to take it over and continue as it is described by a specification which corresponds in 100% to the code.
The complexity of a problem we are to solve in software is as it is: it is determined by customer requirements. We cannot change/simplify it, we have to fulfill it. As software developers we decide about the complexity of its implementation: we may find a solution that exhibits the complexity of the application but no more. We may produce a software monster which complexity exceeds by far the complexity imposed by the requirements.
I believe that without modeling and specification it is impossible to develop a good software.
There is one general problem with any formal or quasi-formal methods: they require some knowledge, they demand learning from us. Normally, we do not have time for such “useless” activity, we just have a project deadline. There are many programmers who believe that their common sense supported by programming skill is all they need to solve any software problem. Sometimes it works but the result is poor.
Last but not least: Especially in the beginning, supporting the software development by modeling with finite state machines may be as difficult as the fight with flags and if-then-else statements (see my comments about complexity) but the results are better if the software has a sound model based skeleton.
</description>
		<content:encoded><![CDATA[<p>I am glad that my comments could help you a bit.<br />
You write that you are  “tired of many flags and if-else”. We are all tired with this jungle of conditions we build into our programs that make them difficult to understand and cost a huge amount of time (and money but normally we do not bother about it until there are institutions that are ready to pay for our exercises). It is interesting that we still believe that we get our software quickly to work with some simple solutions or tricks. I observe it on my behavior. As a rule I try to design  my software (using in most cases the concept of a state machine). But sometimes I behave also as a teenager. An example: for test purposes we have in StateWORKS the SWQuickPro monitor that displays all details of RTDB objects and can be used to manipulate objects. Some time ago we decided to extend its functionality by automatic testing features (some informations about it are described in <a href="http://www.stateworks.com/technology/TN20-Testing-with-StateWORKS" rel="nofollow">http://www.stateworks.com/technology/TN20-Testing-with-StateWORKS</a>). I was involved in that project  and decided just to “expand” the existing software adding “here and there” missing code. The functionality of that monitor part seemed to be simple: read a command file and then execute the commands line by line. In addition, these operations should have been affected by buttons: NEXT, RUN, RUN Continuous and STOP. This simple task appeared soon quite complex if you think about all constrains: missing file, error in command, missing or erroneous operand, etc. The task become quite obscure at the latest when we decided to introduced pseudo-commands: Delay and Wait For Event. Eventually, I got it working but it was a terrible code based on flags and if-then-else. I watched some time this software disaster and when I wanted to change something I found that I did not understand how and why it works. Eventually, I was completely fed up and wrote the software again starting from a state machine model. It took me a month or so but now we have software that I understand and at any time I can change it without fear of side effects. It would be relatively easy for another person to take it over and continue as it is described by a specification which corresponds in 100% to the code.<br />
The complexity of a problem we are to solve in software is as it is: it is determined by customer requirements. We cannot change/simplify it, we have to fulfill it. As software developers we decide about the complexity of its implementation: we may find a solution that exhibits the complexity of the application but no more. We may produce a software monster which complexity exceeds by far the complexity imposed by the requirements.<br />
I believe that without modeling and specification it is impossible to develop a good software.<br />
There is one general problem with any formal or quasi-formal methods: they require some knowledge, they demand learning from us. Normally, we do not have time for such “useless” activity, we just have a project deadline. There are many programmers who believe that their common sense supported by programming skill is all they need to solve any software problem. Sometimes it works but the result is poor.<br />
Last but not least: Especially in the beginning, supporting the software development by modeling with finite state machines may be as difficult as the fight with flags and if-then-else statements (see my comments about complexity) but the results are better if the software has a sound model based skeleton.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-5</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Fri, 05 Sep 2008 19:20:11 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-5</guid>
		<description>Mr Ferdinand:
Thank you very much for your reply though I have not figured out the way to apply state machines to my work. And yes, I am quite in the event-driven ways. But I am tired of many flags and if-else. I really hope the state machine(STATEworks) can really complete whole project/software model before coding, as it is claimed. The idea of not reinveing wheels is what I like most and especially when it can really match a state machine to a software model.
Desktop computers are now equipped with multi-core CPU but I think fewer processes/threads would be good and even perfect if number of processes or threads equals to the number of CPU cores. But in another way, while developing a software system, I think multiple processes are still needed if more than two developers are involved. Anyway, I would like tobuy some book (from StateWorks) from Amazon before I make wrong statements(Or maybe too late :)  ).
</description>
		<content:encoded><![CDATA[<p>Mr Ferdinand:<br />
Thank you very much for your reply though I have not figured out the way to apply state machines to my work. And yes, I am quite in the event-driven ways. But I am tired of many flags and if-else. I really hope the state machine(STATEworks) can really complete whole project/software model before coding, as it is claimed. The idea of not reinveing wheels is what I like most and especially when it can really match a state machine to a software model.<br />
Desktop computers are now equipped with multi-core CPU but I think fewer processes/threads would be good and even perfect if number of processes or threads equals to the number of CPU cores. But in another way, while developing a software system, I think multiple processes are still needed if more than two developers are involved. Anyway, I would like tobuy some book (from StateWorks) from Amazon before I make wrong statements(Or maybe too late <img src='http://www.stateworks.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />   ).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: John M</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-4</link>
		<dc:creator>John M</dc:creator>
		<pubDate>Thu, 04 Sep 2008 13:16:38 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-4</guid>
		<description>Coincidence!! I was dealing with exactly this earlier today in my system development!
As in your post indicates, Ferdinand, I concluded that splitting the control logic across multiple asynchronous processes (threads) is more trouble than it&#039;s worth.  (Happy to have confirmation!!)
One still has to deal with issues like deadlocks and loops as in : Master VFSM issues a command to a Slave VFSM that then changes it&#039;s state that the Master detects causing it to issue another Slave command and so on and on.   These are much easier to deal with in a single execution engine - even if it is iterative or recursive - than using cross thread messaging!
In my application I need to backtest control logic using previously captured external timestamped input events (simulating external system reactions to control outputs where needed).  The most efficient way to do that is move simulated time from event to event - practically impossible if two asynchronous parts of the control logic can affect each other&#039;s actions per my loop example above.  (Don&#039;t worry, Mr Ferdinand, I&#039;m making absolutely sure the control processing itself is *not* event driven - only input changes are handled like that!)
</description>
		<content:encoded><![CDATA[<p>Coincidence!! I was dealing with exactly this earlier today in my system development!<br />
As in your post indicates, Ferdinand, I concluded that splitting the control logic across multiple asynchronous processes (threads) is more trouble than it&#8217;s worth.  (Happy to have confirmation!!)<br />
One still has to deal with issues like deadlocks and loops as in : Master VFSM issues a command to a Slave VFSM that then changes it&#8217;s state that the Master detects causing it to issue another Slave command and so on and on.   These are much easier to deal with in a single execution engine &#8211; even if it is iterative or recursive &#8211; than using cross thread messaging!<br />
In my application I need to backtest control logic using previously captured external timestamped input events (simulating external system reactions to control outputs where needed).  The most efficient way to do that is move simulated time from event to event &#8211; practically impossible if two asynchronous parts of the control logic can affect each other&#8217;s actions per my loop example above.  (Don&#8217;t worry, Mr Ferdinand, I&#8217;m making absolutely sure the control processing itself is *not* event driven &#8211; only input changes are handled like that!)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ferdinand</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-3</link>
		<dc:creator>ferdinand</dc:creator>
		<pubDate>Thu, 04 Sep 2008 08:09:15 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-3</guid>
		<description>We tend to overuse threads. We should use them if we need them but no more. There is no explicit requirement that each state machine has to run in a separate thread.
A single state machine is seldom a true problem, a system of state machines is a problem. The major challenge is to design a system of state machines which is a solution of a logical control problem and not a source of difficulties that are created by putting each state machine in a separate thread. Any complex control problem requires communication among involved state machines. If we design a set of state machines each solving a partial problem without having in mind from the beginning the entire logical structure we may end in a difficult fight with deadlocks and nondeterministic behavior by implementation.
Keeping state machines in one thread simplifies a lot. The idea, as realized in StateWORKS run-time system, is then: the behavior represented by a system of state machines is realized by an executor (a kind of decision machine in one thread) while all time consuming data processing input/output actions are moved into threads. This solution guarantees that the system is in its control path very fast as the data processing tasks are not in its scope.
This concept is of course realized without any difficulties on a single CPU without thread resources. The only difference is that the control path has to wait until its data processing tasks are carried out.
</description>
		<content:encoded><![CDATA[<p>We tend to overuse threads. We should use them if we need them but no more. There is no explicit requirement that each state machine has to run in a separate thread.<br />
A single state machine is seldom a true problem, a system of state machines is a problem. The major challenge is to design a system of state machines which is a solution of a logical control problem and not a source of difficulties that are created by putting each state machine in a separate thread. Any complex control problem requires communication among involved state machines. If we design a set of state machines each solving a partial problem without having in mind from the beginning the entire logical structure we may end in a difficult fight with deadlocks and nondeterministic behavior by implementation.<br />
Keeping state machines in one thread simplifies a lot. The idea, as realized in StateWORKS run-time system, is then: the behavior represented by a system of state machines is realized by an executor (a kind of decision machine in one thread) while all time consuming data processing input/output actions are moved into threads. This solution guarantees that the system is in its control path very fast as the data processing tasks are not in its scope.<br />
This concept is of course realized without any difficulties on a single CPU without thread resources. The only difference is that the control path has to wait until its data processing tasks are carried out.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Joe</title>
		<link>http://www.stateworks.net/2008/03/what-is-a-state-machine/comment-page-1/#comment-2</link>
		<dc:creator>Joe</dc:creator>
		<pubDate>Thu, 04 Sep 2008 02:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://stateworksnet.cmarc.net/2008/03/what-is-a-state-machine/#comment-2</guid>
		<description>I don&#039;t know if this blog is still active or not. I&#039;ve read &quot;state machine misunderstandings&quot;. That clarifies a bit. However, there are some questions here. How to apply state machine into multi-thread computing, especially if synchronization among threads is needed?
And another question is that if the computer only has only one CPU core, is it possible to merge multiple threads/processes into single process through the use of FSM, since traditionally, each process/thread has its different mission and timing?
</description>
		<content:encoded><![CDATA[<p>I don&#8217;t know if this blog is still active or not. I&#8217;ve read &#8220;state machine misunderstandings&#8221;. That clarifies a bit. However, there are some questions here. How to apply state machine into multi-thread computing, especially if synchronization among threads is needed?<br />
And another question is that if the computer only has only one CPU core, is it possible to merge multiple threads/processes into single process through the use of FSM, since traditionally, each process/thread has its different mission and timing?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

