polling vs. events

Lex Spoon lex at cc.gatech.edu
Tue Sep 8 09:04:59 UTC 1998


Stefan Matthias Aust writes:
 > >An event-driven architecture already exists; namely Morphic.  It 
 > >currently interfaces with the polled Squeak interface through 
 > >HandMorph>>processEvents, which continuously generates Morphic events, 
 > >but it should be relatively easy to push the Morphic event interface down 
 > >through to the VM, generating these only when the actual action occurs.
 > 
 > Well, I probably tend to ignore Morphic, mainly for personal taste :-)
 > You're right, Morphic is basically event driven already. It uses the same
 > four basic event types I mentioned in my last email (see
 > HandMorph>>handleEvent:). However, the stepping is still done with polling
 > (see WorldMorph>>doOneCycle). For a true event driven system, this should
 > be based on some kind of timer events. I don't know how difficult it would
 > be to change this.
 > 


I just have to jump in here, after having spent a summer developping
in Morphic.  I have three things to add.

First, if you stick with the PluggableMorphs, then you don't really
have to get into the morphic protocols.  You mostly just do
Model-View-Controller, and this is an easier to use
Model-View-Controller system that MVC is.  Now technically, you might
not consider using the PluggableMorph's to be true programming in
Morphic; however, one can also think of it as programming using
existing widgits, as opposed to writing new widgits.  Use deep Morphic
protocols for writing new widgits, but for most purposes one can just
use enough to get some existing widgits up on the screen.

Second, for the specific argument quoted above, it is true that the
stepping is implemented based on a polling loop.  However, this is an
implementation detail invisible to the application, the same way it's
invisible to them just how mouseDown:'s and all the other events are
generated.  And besides, if a morph is using stepping, then it's in a
polling mode already; I've always thought of stepping as an *escape*
from the normal event system, for times when events just don't cut it.

Finally, I recommend to anyone who hasn't tried morphic in a while:
try it again.  Try working from in a morphic project instead of an MVC
project, and see how it goes.  To be brief in my opinion (which I'm
finding very hard :)), Morphic has most all the basic windows from
MVC, so you should be able to get the same work done, and plus it has
lots of new additional goodies that the brilliant guys at Disney have
dreamed up.

Lex





More information about the Squeak-dev mailing list