Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pros and Cons of using object oriented programming for progress openedge

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

like image 351
Bill Avatar asked Apr 23 '12 19:04

Bill


People also ask

What are the benefits of using object oriented methodology for software development?

Object Oriented Development (OOD) has been touted as the next great advance in software engineering. It promises to reduce development time, reduce the time and resources required to maintain existing applications, increase code reuse, and provide a competitive advantage to organizations that use it.

Does OOP affect performance?

An OOP program can be designed to align exactly with the choice of data structures and algorithms that is deemed optimal by CS theory. It will have the same performance characteristic as the optimal program, plus some overhead. The overhead can usually be minimized.


2 Answers

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.

like image 162
Abe Voelker Avatar answered Oct 29 '22 15:10

Abe Voelker


In the last four years I have worked 80% of the time with OOABL (started with 10.1c). I definitely recommend using OOABL but I think it is very important to consider that using OOABL the same way as in other OO languages is fraught with problems. With "the same way" I mean design patterns and implementation practices that are common in the oo world. Also some types of applications, especially in the area of technical frameworks are hard to do with OpenEdge (e.g. ORM).

The causes are performance problems with OOABL and missing OO features in the language.

If you are programming in C# or Java for exampe, memory footprint and instantiation time of objects are not a big issue in many cases. Using ABL this becomes a big issue much more often. This leads to other design decisions and prevents the implementation of some patterns and frameworks.

Some missing or bad OO features:

  • No class library, no data structures needed for oo
  • No package visibility as in java (internal in c#) This becomes relevant especially in larger applications
  • No Generics
  • Really terrible Exception Handling
  • Very limited reflection capabilities (improved in oe11)

So if you are familiar with oo programming in other languages and start working with OOABL, you could reach a point at which you were missing a lot of things you expect to be there, and get frustrated when trying to implement such things in ABL.

If your application has to run on Windows only, it is also possible to implement new oo code in C# and call it from your existing progress code via clr bridge, which works very smoothly.

like image 41
Fabian Frank Avatar answered Oct 29 '22 16:10

Fabian Frank