Coding Is Never Without A Reason; PHP Has 10
February 1, 2016 Dan Burger
PHP is the open source success story for IBM i. Its support by IBM and particularly Zend Technologies has given it quite a boost. And it’s proved to be capable of leveraging the IBM i operating system, DB2 for i, and RPG code. Beyond that, it is compatible with almost every operating system and hardware platform you can name, which provides the cross-platform capabilities that demolishes siloed information.
Several IBM i independent software vendors offer PHP development tools. Two of them, BCD Software and Zend Technologies, released an e-book last week titled Top Ten Reasons to Choose PHP for IBM i Web Application Development. The foreword to the book was written by Alan Seiden, a PHP on IBM i subject matter expert. Seiden talked about PHP with IT Jungle on the phone last week.
PHP is not a mystery, but it is sometimes misunderstood and even feared. Seiden describes PHP as an enhancement for RPG. It allows RPG developers to do more with RPG, the overwhelming language of choice in IBM i environments. It’s not a replacement for RPG, if anyone actually thinks that. RPG is still the best choice for heavy duty business logic. Among RPG programmers, you’ll find little dissent about that.
RPG remains in control, Seiden points out, but it can call PHP to perform tasks such as sending HTML-oriented emails, creating spreadsheets and pdfs, or generating charts and graphs, for instance.
“The RPG programmer who doesn’t know these techniques may think they are difficult or may not want to step forward and say ‘we can do that on IBM i,'” Seiden says. “But we have to have confidence that we can do things on IBM i. Sometimes when we wait to do new things, management becomes impatient with the platform and, to get what they want, they go to another department or some other outside solution. In many instances, those are things that can be done with RPG or PHP.”
There are developers that write logic in PHP for use on the Web. They’ve been doing it for years. That’s not because they can’t do it in RPG, but because it is reusable when written in PHP. It’s also possible to call PHP from RPG. So there are RPG interactive programs being written that calls PHP code that contains logic.
So PHP is not only a scripting language used for creating graphical interfaces for green-screen applications. Usually that means there is PHP code doing something that RPG code doesn’t do as easily. TCP/IP work or Web services or manipulating images come to mind, but there are others, too.
Seiden calls it “batch PHP” when PHP code is called from RPG.
“If you are an RPG genius like Scott Klement, you could write everything in RPG. But in some instances, PHP is the simpler choice for the average programmer,” Seiden says.
The Ten Reasons to Choose PHP e-book is a quick read. Each reason is concisely presented in several hundred words. A few of the reasons in this list include: an easy learning curve; leveraging RPG, DB2, and IBM i; mobile deployments; modern language design features; and an ecosystem of tools. The book was written by Duncan Kenzie, chief knowledge officer for BCD and Quadrant Software. Download the book in pdf format by following this link.
Seiden, a top consultant in the PHP on IBM i arena, sees PHP as a reason IBM i shops have stayed on the platform, even as companies are bought and sold and end up being owned by an entity with no IBM i experience. “It provides a little bit of a hedge,” he says. “PHP helps retain loyalty to the platform, while also providing the ability to move workloads other places if necessary. It also allows workloads designed to run in other environments to be moved to the i.”
Something else to take into account is the often-mentioned top concern among executives at IBM i shops about what to do with RPG code in the long run considering that developers and system admins are middle-aged or older and in short supply. PHP has a younger demographic, so those that learn RPG skills will help fill that potential void. Sounds like a happy ending, and who’s to say it won’t end that way?