This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2013-04-05 12:41:47

dakra137
New Scratcher
Registered: 2013-04-02
Posts: 3

Antipatterns, bad habits, e.g. Forever

I am concerned that many Scratch examples teach bad habits using

forever
Each sprite may have several forever scripts running.  Most have no wait, input, or sleep timer in them. Each one is an infinite loop burning cycles on its own [conceptual] thread of execution. 

Maybe the Scratch dispatcher deals with this to make it tolerable, but the real world does not. One spin loop is too many and can make some Windows systems unresponsive. Several spin loops is way too many. (In Windows programming, depending on your perspective, "doevents" helps or hurts.)

Recommendations:

Teachers: Emphasize examples that put use

forever
wait until
rather than

forever
or

forever if
whose help claims that it does "keep checking"

Under the covers, maybe forever if and forever, wait until are the same, but the educational lesson is not the same.

Scratch implementers:

Please create a forever wait until block.

Offline

 

Board footer