|Practical RPG: New Open-Source EGL Tools for RPG Developers|
|Programming - RPG|
|Written by Joe Pluta|
|Wednesday, 04 April 2012 00:00|
How quickly can you build multi-tiered Rich Internet Applications? With the new open-source EGL Development Tools, you can measure your development time in hours, not days or weeks.
I have been an advocate of EGL for a long time now. I started writing about it almost seven years ago, although at first I wasn't exactly enamored with the language. However, as EGL progressed over the years, I've come to see the power of a true 4GL. Yes, anything I can do in EGL someone else can do in Perl or PHP or Python. But I guarantee that unless you're just bolting together pre-existing bits, I can do it a lot faster in EGL.
What's Wrong With Pre-Existing Bits?
Nothing! Nothing at all! Pre-existing bits are very important, especially for things like mail systems and database queries and other commodity functions. Prefabricated software components exist that ably fill entire software niches, such as Contact Management Systems (CMSs). Seriously, do you want to write an appointment-scheduling application? I don't! So don't think that I don't appreciate a good chunk of off-the-shelf software; I only have so many hours to be productively writing software, and I don't want to waste it developing YATMA (Yet Another Text Messaging App) that notifies me when a serious message appears on the QSYSOPR message queue.
But I don't necessarily have to become an expert at Python to install a Python application or even to modify it. If I pick a piece of prefab software, it's both because the package is easy to install and implement and because what modifications I do need to make are simple and have a large community to help me make them. In fact, if you want to see just such a package, go to the Plone home page. Plone is a powerful and hugely popular CMS system written in Python with an extensive support community. I think Plone has more user groups than the IBM i.
Okay, Then Where Should I Focus My Time?
Or perhaps the question is, "What will make me most productive as an RPG programmer?" See, I don't want to become a Python programmer, or a .NET programmer, or even a Java programmer. What I want to be is an RPG programmer with m4d w3b sk1llz (that's "mad web skills" to you non-l33t types out there). I want to be able to create powerful next-generation Web-based applications using a tool that doesn't just co-exist with my RPG abilities but instead is symbiotic: my Web language and my RPG language together should be better than both separately. And that's where EGL really shines. Everything, and I do mean everything, about EGL is businesslike. By that I mean that every concept in EGL is familiar to an RPG programmer, and where the two differ, EGL is usually better.
As an example, in RPG, I group related fields in a data structure. If it's a data structure that I pass between programs, I usually make it an externally described data structure, which essentially means that I use a record format as my data structure. In EGL, I group data in a record, and I can pass that record from one program to another, even if the programs are running on different platforms in different languages.
Here's another small example: guess what the index of the first element of an array is in EGL? If you guessed zero, you get fifty lashes with a PHP noodle, because in EGL, as in RPG, the first element of an array is index one (1).
Yet another thing that makes EGL an excellent application language is its tightly integrated SQL support. EGL provides tools to create records from existing SQL tables. Once the records are created you can use EGL opcodes like get and add to access your database nearly as easily as you can use CHAIN and WRITE in an RPG program. It's definitely easier than trying to use the ODBC wrappers provided by languages like Java and PHP. And with the new open-source version, it's remarkably easy to access databases on two different machines simultaneously.
What's That About Open Source?
This is the point of this article and is the fact that should really get you going. Let's say you want to extend your skills to the Web. You're convinced that Java is too foreign of a world, so you're going to use PHP because it's available on the IBM i for "free." Well, it's free as long as you don't count the time you'll spend learning PHP. But yes, the tools are free, and until recently, that gave PHP a huge advantage over EGL (a seat of the commercial IBM tooling for EGL, Rational Business Developer, will cost an IBM i shop about $1,200). But with the announcement of the open-source EGL Development Tools, the price issue goes away. You can download the tools today and start learning EGL. The most recent release (version 0.8.0 M3) contains the full support for calling RPG programs from EGL, so you can begin building multi-tiered rich Internet applications today.
So now, instead of having to learn the rather arcane Java-like syntax of PHP, with its zero-based arrays and JDBC-like SQL wrappers, you can instead use EGL to quickly write rich applications that can use SQL when it fits and call RPG when you need real power.
I Like Symbiosis
I do. I like symbiosis. I like it when my skills feed off one another. Rather than learning a completely new mindset such as OO programming, I can write procedural code in EGL. I remember long ago talking with Jon Paris about how Java would be a wonderful language if only there were a more procedural variant. EGL is as close to procedural Java as you're going to get. In fact, with a little work you can even create constructs that act very much like objects in OOP languages, although I've rarely needed to do anything that complex. Instead, my long years of experience in writing procedural code are directly applicable to writing EGL.
So, go out, get the open-source version of EGL, and give it a try. I think you'll be pleasantly surprised by how quickly you can become a Web application wizard.
|Last Updated on Wednesday, 04 April 2012 00:00|