Public methods for PDS events

Posted by Thomas Mercer-Hursh on 30-Sep-2013 11:25

Does it seem strange to anyone else that an event method for a PDS in a class has to be declared public, even though the PDS is totally enclosed in the class?

All Replies

Posted by Admin on 30-Sep-2013 11:31

At least surprising and non OO...

but to be clear, the ProDataset has no events. ProDatasets have Callbacks, and unter that term public is more expected.

Posted by Thomas Mercer-Hursh on 30-Sep-2013 12:05

Well, callbacks from what?  In this case, it seems like it is only from the AVM, since there is no external ABL code involved.   That's why it seems wrong with me.   I get that if I have multiple classes participating in something that I need to make public the parts I expect other classes to trigger, but that doesn't apply here.

Posted by Admin on 30-Sep-2013 12:14

Callbacks from the AVM to your code?

"That's why it seems wrong with me."

It's been like that since roundabout 10 years now.  After that time features typically are considerd accepted by the customer.

Posted by Thomas Mercer-Hursh on 30-Sep-2013 13:28

PDS have been around for that long, but afair, not using methods.  The same principle *should* apply in a PP, of course, but people haven't thought so much about private and public there.

Posted by Admin on 30-Sep-2013 13:31

The same principle *should* apply in a PP, of course, but people haven't thought so much about private and public there.

Trust me. The same principle does apply to persistent procedures.

Posted by Thomas Mercer-Hursh on 30-Sep-2013 13:34

Twisting my words, eh.  What I meant was that one *should* want to encapsulate a PP just as much as a class and therefore one should object to having to leave the IP public ... just that many people haven't been thinking about the private/public status of IPs the way they do with methods.

Posted by Admin on 30-Sep-2013 13:40

Twisting my words, eh.

Not my intention.

So I guess we agree that a good framework needs to provide a structure in which the publicness of dataset callback methods does not create a too big problem with OO principles.

Posted by Thomas Mercer-Hursh on 30-Sep-2013 13:46

If one encapsulates the PDS completely in a class and avoids calling the public event methods, no trouble is going to ensue, but it requires one to behave correctly rather than enforcing that behavior.

Posted by Admin on 30-Sep-2013 13:51

Encapsultation is _ALWAYS_ something that the programmer of a class needs to care about every day. So it's not worse than suggesting other standards, like NO-UNDO variables, NO-LOCK reads etc.

Posted by Thomas Mercer-Hursh on 30-Sep-2013 13:55

We have no disagreement on that.  My issue here is that one can't flag these event methods as private, even though they are used by no ABL code outside the class.

This thread is closed