From: Scott Klement
Why do you think RPG is not well suited for event-driven programming?
Dieter and John E. opened themselves up to rebuttal by failing to define what they meant by event-driven programming. And as you've pointed out, events can arise from many different sources; not just GUI components, which they may not have anticipated.
However, I think the traditional meaning of event-driven programming arose from IDE's that provided for drag and drop GUI widgets on various design surfaces, and provided for attaching "functions" to a wide range of onXXX events.
To add event logic, you'd just select the GUI widget in your IDE, then double click on one of the onXXX labels listed in a property sheet. A new code window would open, and the event-handling interface would be automatically generated for you. That was event-driven programming. It was a feature of the IDE.
If that's what we mean by event-driven programming, then I'd suggest that it's a good thing that RPG is NOT well suited for it. We're better off by having RPG as a server language, and for the compiler team to focus on that.
For GUI event programming, I use Dreamweaver, and JavaScript. It would be a waste of time to try to make RPG run in a browser. However, that doesn't mean that RPG shouldn't respond to browser events. We write a lot of RPG code that responds to timer, keypress, mouse click, combo-box change, page load, focus, and other GUI events using asynchronous requests, mostly. And since the response is so quick, it makes the user feel like they're working on a desktop based system, rather than one where most of the event-handling logic is actually running on a server.
-Nathan
As an Amazon Associate we earn from qualifying purchases.