News:

  • October 27, 2025, 02:59:08 AM

Login with username, password and session length

Author Topic: 1st project problems  (Read 26656 times)

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6127
  • Yes Pinky, Do-more will control the world!
Re: 1st project problems
« Reply #30 on: April 12, 2013, 03:06:16 PM »
Good question and widely misunderstood.

Stages are consistently misused in DL, partially because there is not another modularization mechanism, and partially due to ignorance. First and most importantly...Stage is Koyo's version of SFC. It is a sequencing mechanism. When used as a sequencing mechanism, it is a very cool thing. Because there is no way to break code up into manageable chunks in DL, folks tend to use Stage for modularization *and* sequencing. Couple this with the fact there is only one pool of stage bits, stuff gets messy...customers get confused...and many people have developed an allergy to Stage.

In Do-more we introduced Program and Task blocks to handle modularization...but we also recognized that we still needed a sequencing mechanism as well. So we added Stage to Program blocks. So no...programs are not like stages, in fact, programs can contain stages. Can you modularize with Stage? Yes, but they are optimized for sequencing. Can you sequence with Programs? Yes, but they are optimized for modularization.

Here is the best way to think about it:
* Use Program and Task blocks to break up code into modular chunks.

* If the lifespan of the chunk is controlled by the thing enabling it, use a Task. An example of this would be if you wanted to put all of the code associated with alarms into its own module, and then turn them on or off from $Main, you would use a task. You can also use Tasks to do operations that don't need to happen continuously or operations that use loops to do time consuming things.

* If the lifespan of the chunk is controlled by the chunk itself, use a program. An example of this would be a status report that gets sent out every Friday. From $Main you would RUN the report program, which would then gather then data, construct the report, and send it out. Upon completion it would EXIT.

* If a program needs to step through a sequence as part of performing its function, you would use stages in that program. The status report of the previous example would likely use stages...or anything that is described as a sequence of operations. It is super easy to create custom communications in Do-more using stages. I actually create entire protocol handlers as standalone programs...and it is easier in Do-more than it is in C++ in a PC. By far.

Not sure if this helped or hurt...but we are happy to help you better understand.
« Last Edit: April 12, 2013, 03:30:32 PM by BobO »
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO