advantages of OO programming in Open edge 10.2b

jmac13

Member
Hi All,

I'm using open edge 10.2b but never used objects and classes within it and wouldn't mind starting to use them.

But I'm Wondering what are the benfits of say creating a class and say doing something that we do a lot (see below). Where code is in a .p file we make it persistent in a handle (which i guess is just a object) and then running stuff from it and deleting at the end. compared to doing in a class and object? cheers in advance thanks

Code:
  if not valid-handle(hanCertUtils) then 
        run gui_utils\certUtils.p persistent set hanCertUtils. 
 
    run addCertificate in hanCertUtils( input manpick.wordnum, 
                                        input rowid(specpart)). 
 
    if valid-handle(hanCertUtils) then 
        delete procedure hanCertUtils.
 
There are two very different attitudes about OO in the ABL community ... well, three, if you count the people who wouldn't touch it with a 10 foot pole. One is that OO is just different syntax for doing the same thing one has been doing and it has some possible nice advantages over the old ways like compile-time type checking and passing message objects. The other is the thinking OO is fundamentally different from what we have been doing and there are many advantages to thinking that way. Some of that OO thinking is principles one could apply to traditional ABL, but it doesn't happen a lot. Some is much more natural in OO syntax. But, it is the way of thinking which makes the big difference.

If you can, you should come to PUG Challenge Americas http://pugchallenge.org/index.html where, among many other valuable sessions you can hear Tim Kuehn talking about OO for traditional ABL programmers, which I expect to be mostly of the first school and me talking about "thinking OO". You will be able to find my talk on my website after the conference and right now you can find a number of presentations, including one on good OO, and whitepapers, including ones discussing basic concepts and vocabulary.
 
Thanks.. I do need to have a look at ur website.. cant make PUG company wouldnt shell out... I've done OO stuff before in C# etc but its been a while and trying to see OO within progress is hard as ive never done it. Totaly different mind set...
 
I've done OO stuff before in C# etc but its been a while and trying to see OO within progress is hard as ive never done it. Totaly different mind set...

not that different, some of us used to think OO before we got it and as it looks like your persistent procedures model gives you a head start... strong typing and encapsulation are main advantages as Thomas already said, one thing that you can't do is multiple inheritance which kinda was possible using persistent procedures stack but this is a 'strange' concept and you should not bother with it :)
 
All coding in OO syntax is not good OO. Most, in fact, is not. Good OO is quite different than just a change in syntax. I am talking on this at PUG Challenge Americas and the presentation will be on my website after the conference.
 
I can only second Tamhas' comment. OO (and IMHO the same is true for procedural programming style) is not about syntax - it's about design. Just because using classes in favor of procedures does not make your design superior.

What really surprised me: I was playing around with OO-ABL since it was around, mostly using classes instead of procedures. From my point of view it was just a means to get familiar with the OO syntax. Nevertheless, beginning of this year I was "forced" (one half I was asked and one half I volunteered) to guide a project using Java to access the OpenEdge AppServer and along the way happened to enjoy some Java training classes. At this point I must say that I do like Java, but I don't think it is superior to the ABL - each has it's weaknesses and strengths. Now comes the funny part: Starting to design and develop the Java middle-tier to access the OpenEdge AppServer, I then also started to re-design and the ABL part - mostly applying design concepts and patterns that I became familiar with in Java to the OO-ABL - finding out that, apart from sometimes different syntax - it's almost the same. There was no need to pull a switch in my brain every time changing back and forth between Java and OpenEdge development anymore ...

Therefore in my experience the biggest advantage for developers is that they don't need to learn a new philosophy when they are facing technologies like Java, .NET and OpenEdge in one project.

Heavy Regards, RealHeavyDude.
 
Thanks guys.. I think I might have to go to other code in OO before coming back to progress and hopeful be able to see how to apply it to progress.
 
There is reason to read elsewhere, but no need to code elsewhere. In fact, if anything, coding elsewhere may introduce you to things we don't have yet in ABL and thus frustrate you. This in no way suggests that one can't do good OO in ABL, quite the contrary, it is just that 3GL OO languages have been evolving longer. Of course, sometimes the things they can do are bad OO, like friend classes.

If you want to do some reading, focus on OOAD rather than another language. That is what you need to analyze and design in an OO way. Get started at my website.
 
I'll start by reading a bit on patterns (lots of common sense in the 'gang of four' book), mind you the ABL just got OO as an appendix not so long ago and as such it's kind of an 'work in progress'... depending on your version some things won't be there and some things just don't work as you expect (error handling and the new garbage collector), things will most probably be solved as this appendix grows to be more mature and probably at some point we'll get what now we don't have (collections, automatic boxing, generics...).

All code using OO syntax isn't good is as true as all code using procedural syntax isn't good... Thomas is right in that sense, just because you start to use classes the code won't get automagically better but that is not a reason not to do it :)
 
Can anyone tell me if there is a way to convert a WSDL to a class that can be used in Progress?

I am trying to update records on salesforce.com and the instructions are pretty simple, but kind of ugly:

  1. Determine the ID of each record that you want to update(). For example, you might call query() to retrieve a set of records (with their IDs), based on specific criteria, that you would want to update. If you know the ID of the record that you want to update, you can call retrieve() instead. For information on IDs, see ID Field Type.
  2. Create an sObject for each record, and populate its fields with the data that you want to update.
  3. Construct an sObject[] array and populate that array with the records that you want to update.
  4. Call update(), passing in the sObject[] array.
  5. Process the results in the SaveResult[] object to verify whether the records have been successfully updated.
This is followed by a simple example in C#:

Account updateAccount = new Account(); //need to have the id so that API knows which account to update updateAccount.Id = "001D000000Ivban"; //set a new value for the name property updateAccount.Name = "New Account Name from Update Sample"; //call update passing an array of object // assuming that you've already established an enterprise WSDL binding SaveResult[] saveResults = binding.update( new sObject[] { updateAccount });Easy enough. But if I could use classes I could create the objects that match salesforce. Otherwise it gets ugly and fast.

Thanks,

Jeff
 
Back
Top