Skip to main content
edited tags
Link
Source Link

Event-driven or polling for beginning programming environments?

In beginner programming environments, I have noticed an essential difference in style for handling user interaction. Scratch and Alice are event-driven, while Processing and Greenfoot, for lack of a better term, are poll-driven. In the event-driven case, when the user clicks the mouse on something or types a key, a method is called to handle the event. In the poll-driven case, in order to respond to user actions, the programmer puts if statements into an update method that is called every frame to poll the input.

I like to use these beginning programming environments in beginning classes, especially for game programming. I'm not sure which approach is better, though. Event-driven programming is easier for programming GUIs, but poll-driven programming is better for simulations. Neither one seems best for all types of games.

Which approach will work the best for programming games for beginners? If I wanted to design my own environment, which style should I use? Are there any other styles?