On 2/21/2012 9:54 AM, john e wrote:

"event-driven", "object-oriented", "functional" are programming STYLES.

You CAN do OO programming in RPG (or assembler), the language is just not
very suited for it.


Why do you think RPG is not well suited for event-driven programming?

It's not well suited for object-oriented programming... I agree with that. But in my opinion, it's every bit as good at event-driven programming as any other language.


Although i agree on most you said, Scott, i wouldn't call RPG an
event-driven language (and never was).

I guess we'll have to agree to disagree on that one. The RPG cycle is most certainly an event-driven process. the handlers used with XML-INTO, XML-SAX, or Open Access are also coded in an event-driven fashion.

It's not identical to other event-driven environments. I've programmed rather heavily in visual basic and visual C in a past life, which are event-driven. I've also coded both JavaScript and Java which are "sometimes" event driven. As well as some other more obscure event-driven environments. RPG is definitely capable of event-driven logic. It may not be the "norm" today, but saying "RPG can't do event-driven logic" is wrong.


You probably mean the cycle, which has all kinds of "events" happening such
as level-break etc.

I specifically stated that I meant the cycle.


I don't think there is a real definition what constitutes "event-driven",
but it is a programming style which is NOT tied to GUI programming
(although here it is very helpful).

I didn't say it was 100% tied to GUI programming. I said that was the most common use of it...

If you ask yourself "why isn't it the norm to code event-driven logic in RPG", then you'd have to say to yourself "it's because there aren't that many problems that RPGers normally face for which event-driven logic is a good solution". And if you ask "what problems do non-RPGers face that they use event-driven logic more frequently than RPGers" the answer is "GUI".


So you could say that RPG was event-driven all along because there are some
pre-defined events (such as total-time happening) which exectutes some code
associated with it. But event-driven means that those "events" can happen
any time, in no specific order.

Event-driven doesn't necessarily mean "it can happen at any time, in no specific order." It depends on the nature of the event. Some events occur at very specific predictable times. (Total time is one example. "OnLoad" type events in GUI programming are another.)

Some events can happen at any time, as you say. ("OnClick" type events are an example. These are less common in RPG... but database triggers, signal handlers, CEEUTX events, CEE4RAGE events are all event handlers that I've coded in RPG. A more commonplace one might arguably be *PSSR. But, again, this type of event handling is not commonplace in RPG, and if you really think about why, it's because other environments primarily do it for GUI events. Note when I say "primarily", I mean MOST of the time, not all the of time.)


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.