Thursday, May 31, 2012

Is RPG Dead? The Autopsy

In a previous post, I promised to say more on the subject of RPG's death. But I'm finding it tougher than I expected. Don't misunderstand me, it's not for lack of content. It's just that I worked with RPG for a long time. I don't want to see RPG go away. Writing this blog posting feels like I'm kicking an old friend while he's down on the ground. On the other hand, it's just a programming language. And the facts need to be understood.

When I first learned RPG III, 31 years ago, I was impressed by a couple of things. First, I was impressed with the externally-described file. As far as I knew, no other language had such a powerful feature. Second, I was impressed with the syntax-checking source editor. At my university, some professors were just beginning to think about something like that.

But other aspects of RPG III were definitely goofy, such as the fixed-form syntax and the indicators. Fortunately, the language has grown since then. Indicators can be largely avoided, and calculations can be coded in a free-form syntax. However, although RPG has progressed, other languages have progressed faster, and new languages have cropped up with even more powerful features. More and more, RPG looks like an anachronism, rather than a modern programming language.

I'll list some features that are commonplace in other, modern programming languages that RPG still lacks:

1) Namespaces. That is, what happens when you want to import two libraries with the same name? In languages like Java and Python, imports can be put into a directory hierarchy. And if there are conflicts, things can be renamed.

2) User-defined data types. Sorry, data structures and LIKEREC just don't cut it.

3) Object-oriented programming. What language doesn't have OO support these days? It's something we now take for granted elsewhere.

4) Extensive list of built-in functions or classes. Just compare what RPG has to the Python Standard Library or PHP's Function Reference. No comparison.

5) Frameworks. Most modern programming languages have a goodly selection of frameworks that simplify programming web applications. These frameworks have various levels of functionality, however, typically they take care of a lot of nitty-gritty details. Using a framework, you should never see a query string, or XML, or JSON, or SQL.

6) Operating system independence. Programs written in languages like Java, Python, and PHP can easily be ported across different operating systems.

Some would argue that RPG could be further enhanced to address these short-comings. But why bother when there are already other languages that have these features? The planners at IBM certainly know what's lacking in RPG, and they still seem to have the resources to make the occasional enhancement. But over the past decade, there seems to have been little effort to address these specific short-comings. Looking at the situation from that perspective, one could argue that IBM itself also sees no future for RPG.

So far, I've written about 500 words, and yet there's still more to be said. Stay tuned.

(Update: Next installment: Is RPG Dead? The Wake)

Cheers! Hans

7 comments:

  1. Sorry old buddy, but some of these questions I asked you some ten years ago when you were the chief, and you answered me. E.g. Why doesn't RPG has OO, and the answer being ... ILE is indeed OO, you have to look differently. Why isn't RPG portable ... because it is a compiled language, not interpreted. etc etc. I think the biggest problem of RPG are its old thinking programmers, and a lack of good converter from RPGII and RPGIII to /free (free of indicators and subroutines etc). I had suggested you way back in 2000 to have 100% /free, a good converter, and a subset compiler that would not allow any of the RPGIII clutter. When the shops would adopt these subsets, the clutter programming would go away, and so would the clutter programmers (the main problem of RPG).

    ReplyDelete
  2. ILE (ca. 1995) gives you static binding, something which other operating systems had since the 1960's, if not earlier. In RPG, you don't have the ability to define classes or objects. Note that some people describe IBM i as "object-based". But this isn't the same thing as "object-oriented".

    ReplyDelete
  3. Another good post Hans. Absolutely, RPG has some technical deficiencies. One could draw up a similar list for any language. We all know that there's no perfect language for all applications, so I'm not going to dwell on that. Although I sure wish we had namespaces :-)

    I'd like to present a different viewpoint regarding one of the items in your list: operating system independence. It is very true that most applications are OS-agnostic these days; part of the industry turning everything into a lowest-common-denominator commodity. But at least one other major OS company feels that proprietary is virtuous: Apple. Yes, they are an exception to the rule of commoditization; why can't IBM i be another?

    ReplyDelete
  4. During my days of experimenting with Turbo C and Turbo Assembler in 83, I did use the "ILE" of that platform. I think it was the "Link" command that bound my Assembler and C subroutines. So when Saville Systems decided to try ILE in 1997, the concepts were no stranger to me. If IBM had continued the /free journey and converted the D specs as well, I think making classes and objects out of sub-procedures would not have been a big thing. Alas, as you told me in 2001, IBM was not ready to provide funding for further /free.

    ReplyDelete
  5. Buck: Strictly speaking, the operating system should be a lowest common denominator commodity. It's job is to enable programs to run and to abstract out the hardware. Regarding Apple, like IBM i, their products also come with a premium price. Ironic since OS X is based on BSD.

    Hassan: Add /FREE to the list of RPG enhancements that barely made it into the language. Some others were EVAL (schedule delays gave us the breathing room to implement it after two other developers failed to make any progress) and ANDxx/ORxx. Scary when you think what RPG could have been like.

    ReplyDelete
  6. In high school, the first programming language I learned was C through the Turbo C compiler. Went on to ANSI C, then C++, then Visual Basic and now mostly use C# and VB.NET.

    I started out with the mindset that the open source community was the future of software development, and now in my late 20s I remain steadfastly convinced that it's the greatest reason for the collapse we saw in 2001. Languages like PHP becoming popular have convinced the business types that "programming is easy, anyone can do it" and lead to an outright abandonment of good software engineering principles and the situations your blog often describes.

    Hopefully we will see the emergence of a global set of standards for this stuff.

    ReplyDelete
  7. RE: namespaces ... If you quote the procname value in the extproc, you can use mixed case names and include periods to get pseudo namespaces.

    d Pop pr extproc('Stack.Pop') like(stackable)
    d field likeds(stack1)

    ReplyDelete