× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Scott said:
"
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.

"

Well ok, you could say it is event driven. But most (non-RPG) programmers
wouldn't call it like that. The problem with this implementation (besides
that these events are triggered within a specific structure/order) is that
there is some coupling between the event and code. For example youn can't
simply connect any code (subr) to the "total-time" event. You have to use
some special syntax (conditioned with indicators in pos. 7-8) for this code
and you have to put in a special place.

Also, you can't simply add your own events.

Anyway, this is mostly all semantic, words.

Essential is the decoupling of an "event" (which is a concept which can be
implemented in numerous ways), and the code associated with it.

The phrase "event-oriented language" implies a language with special
constructs for events. I can't think of a language which has these. This is
because "event" is a concept, which can be easily implemented. Like i said,
it is a programming STYLE. Most explicit support for event oriented
programming is from frameworks / libraries etc, not languages.

Thus, what does it exactly mean for a programming language to be "event
oriented". I didn't say you could do event-oriented programming with RPG.
Of course you can. But it isn't very well suited for it. Because it's
simply not a very versatile and modern language. It's as suited for event
oriented programming just as C is, or COBOL. Java is better suited because
it's more versatile. Smalltalk even more because it has blocks. etc etc.

You also said RPG'ers don't use event-oriented programming because they
don't see any use for it.

But in business oriented systems, events should be a very important
concept. Event sourcing for example is the way to go for business
applications. But then we are talking about events in a system wide
fashion. Not events as a programming style or construct. Maybe RPG
programmers should use event style programming more.

For example. For every add/update/delete "event", put a record in a data
queue. This data queue is continuously read by another program which acts
upon these events. For example, if a client address is changed this is
logged as an event. The event processor (or whatever you call it) reads
this "client address changed" and sends a mail to the appropriate
department (or any other action). the advantage is that you decouple these
kinds of behaviors. Most implementation i see is that the program which
actually updates the client address, also sends the mail. Be decoupling
these (validating and updating the address, and sending the mail or any
other action to be taken) you get a much simpler and more scalable (in
complexity) system.

So maybe RPG'ers should use event-oriented programming more.


On Tue, Feb 21, 2012 at 8:11 PM, Scott Klement <rpg400-l@xxxxxxxxxxxxxxxx>wrote:

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.)

--
This is the RPG programming on the IBM i / System i (RPG400-L) mailing list
To post a message email: RPG400-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/rpg400-l
or email: RPG400-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/rpg400-l.



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.