Pros and Cons of using object oriented programming for progress openedge

Bill picture Bill · Apr 23, 2012 · Viewed 7.8k times · Source

I understand the pros and cons of using object oriented programming as a concept. What I'm looking for are the pros and cons of using oo in progress/openedge specifically. Are there challenges that I need to take into account? Are there parts of the language that don't mesh well with oo? Stuff like that.

Edit: using 10.2b

Answer

Abe Voelker picture Abe Voelker · Apr 24, 2012

I'll give you my opinion, but be forewarned that I'm probably the biggest Progress hater out there. ;) That said, I have written several medium-sized projects in OOABL so I have some experience in the area. These are some things I wrote, just so you know I'm not talking out of my hat:

  • STOMP protocol framework for clients and servers
  • a simple ORM mimicking ActiveRecord
  • an ABL compiler interface for the organization I was at (backend and frontend)
  • a library for building up Excel and Word documents (serializing them using the MS Office 2003 XML schemas; none of that silly COM stuff)
  • an email client that could send emails using multiple strategies

OOABL Pros:

  • If you absolutely must write Progress code, it is a great option for creating reusable code.
  • Great way to clean up an existing procedural codebase

OOABL Cons:

  • Class hierarchies are limited; you can’t create inherited (sub-) interfaces in 10.2B (I think this was going to be added in 11). Older versions of OpenEdge have other limitations like lack of abstract classes. This limits your ability to create clean OO design and will hurt you when you start building non-trivial things.
  • Error handling sucks - CATCH/THROW doesn’t let you throw your custom errors and force callers to catch them. Backwards compatibility prevents this from evolving further so I doubt it will ever improve.
  • Object memory footprint is large, and there are no AVM debugging tools to track down why (gotta love these closed systems!)
  • Garbage collection wasn’t existent ‘til 10.2A, and still has some bugs even in 11 (see official OE forum for some examples)
  • Network programming (with sockets) is a PITA - you have to run a separate persistent procedure to manage the socket. I think evented programming in OOABL was a PITA in general; I remember getting a lot of errors about “windowed environments” or something to that effect when trying to use them. PUBLISH/SUBSCRIBE didn’t work either, if memory serves.
  • Depending on your environment, code reviews may be difficult as most Progress developers don’t do OOABL so may not understand your code
  • If above point is true, you may face active resistance from entrenched developers who feel threatened by having to learn new things

OO is all about building small, reusable pieces that can be combined to make a greater whole. A big problem with OOABL is that the “ABL” part drags you down with its coarse data structures and lack of enumerators, which prevent you from really being able to build truly beautiful things with it. Unfortunately, since it is a closed language you can’t just sidestep the hand you’re dealt and create your own new data or control structures for it externally.

Now, it is theoretically possible to try and build some of these things using MEMPTRs, fixed arrays (EXTENT), and maybe WORK-TABLEs. However, I had attempted this in 10.1C and the design fell apart due to the lack of interface inheritance and abstract classes, and as I expected, performance was quite bad. The latter part may just be due to my poor ability, but I suspect it's an implementation limitation that would be nigh impossible to surmount.

The bottom line is use OOABL if you absolutely must be coding in OpenEdge - it’s better than procedural ABL and the rough edges get slightly smoother after each iterative release of OpenEdge. However, it will never be a beautiful language (OO or otherwise).

If you want to learn proper object-oriented programming and aren’t constricted to ABL, I would highly recommend looking at a language that treats objects as a first-class citizen such as Ruby or Smalltalk.