Monday, March 23, 2009

Religious wars

You would have figured by now that I would know better. 20 plus years in IT, programming everything from assembly to PHP. But, no, I still got sucked in to the vortex of a religious war of technologies. At first I didn’t know what to think. It was a typical customer call. Showing them the presentation of Zend products and I was wondering where their thoughts were. Then I tripped. I mentioned that one of the key features that PHP had and Java didn’t was it’s divided personality of Procedural development and OOP. The Java guy in the back of the room reared his head and exclaimed “That’s not true!” And, he was right. Java does have a model that is more forgiving to the typical RPG programmer. So, if Java has that loving and forgiving model, why haven’t all of the RPG programmers learned Java?

You would think the legendary burger flipping ad would have motivated enough folks. Not so much. RPG is still around. IBM continues to invest in it. And, it’s looking more and more like Java every day! So why the struggle? For years I have felt that PHP is a much more forgiving language. Not as rigid and structured. It hearkens me back to the days when I used to burst forms in my dad’s data center. They had a System 3 and a couple of COBOL developers. My Dad was getting frustrated that it took several days for a COBOL developer to put out even a basic report. Punching the deck, turning around the cards, bursting the print: It all took time. Then an IBM SE (Software Engineer, for those who were wondering) came in and told my Dad about a new macro language that would put out reports in a fraction of the code required for COBOL and in record time. My Dad took the plunge and headed down to IBM downtown for a week of intensive RPG training.

The other COBOL developers warned my Dad. They said: “George, you really should mess around with toy languages like that. COBOL is Strategic, COBOL is enterprise and besides, it supports a structured programming model.” My Dad considered what the other developers said. And then continued developing his reports in RPG. The productivity gain was unbelievable. He was happy and the owners of the company were getting information faster than they ever had before. RPG evolved over time from a Macro language in RPG I that replaced the old FARGO machines and RPG II used by the System 3 to a full blown structured programming language in RPG III on the System 38 and RPG/400 and RPG IV. Not to mention ILE that just kicks the whole structured thing up a notch: “BAM”

Today, I feel that I am reliving the same religious war that my Dad endured. I listened to people who have been fed the Java Kool-Aid and regurgitate the same FUD about PHP. Yet so many websites and business applications are written in PHP. I wanted to describe why I think PHP is gaining in popularity. It all centers around the desire to create. PHP is a blue collar language that gets stuff done. It’s OK to sometimes write a piece of procedural code just like its OK to sometimes use the logic cycle to crank out a report. If that is all you need, then have at it!. Certainly OOP has its place. Many hands can make light work and with so many i5 shops have 1 or two programmers that the luxury of designing a monolithic Java architecture just isn’t in the cards. So a little PHP can go a long way!

The community is another reason. Sure, Java is Open Source and quite possibly about to become another IBM asset. But the reality is that Java became open source a little too late. PHP has been open source nearly since its birth. Many people in the community have grown up with PHP and still many can adopt it as if it were still young. It’s cool to be working with PHP in the open source arena and there is a far reaching camaraderie that envelops the members like no other technology save Linux.

But the last reason I wanted to mention is purely the organic growth of PHP. We recently updated a slide in one of our presentations that describes the top 10 web sites by traffic. This is estimated and tracked by the Alexa group. When I started with Zend four of the top 10 websites by traffic were running PHP. Today, six of the ten are running PHP and there does not seem to be any loss of momentum. Those six include: Yahoo, YouTube, Wikipedia, Blogger (which I am using for this piece), Facebook, MySpace, and Yahoo Japan. It’s OK if you want to combine Yahoo and Yahoo Japan as number eleven is a Chinese search engine called Baidu which is also written in PHP.

No matter how you slice it, PHP is running a significant portion of the web. It was developed for the web and by the community to be a powerful and fast way to get applications developed. Sounds a lot like the early days of RPG to me!


  1. I think the reason I am not the biggest fan of PHP is because of it's perceived singular use. My perception is that it is really only useful when invoked from the browser, though I am guessing you can also invoke it from PASE - but do people do that?

    The thing I like about Java is that it can be used anywhere - AS400 (server side), on the desktop, and on small(er) devices (i.e. J2ME).

    And then of course RPG is still my fav because of it's simplicity and integratedness into OS400 and DB2 - can't beat it if you ask me. Or maybe the better thing to say is that PHP nor Java have beat it on those fronts.

  2. The other thing that I wish PHP (and/or Java) had is a really simple framework for building web applications that is similar to the simplicity that we have with RPG+Display Files. I haven't played in the PHP camp for a couple years now (at least no significant programming) so that might be an ignorant statement - does PHP have a framework like that? (commercial or free)

  3. Aaron,

    Try Ruby on Rails (open source) or Cold Fusion (Adobe).

  4. Frameworks, for all their benefits, introduce learning curves.

    If you just want to emulate the RPG + Display files, you likely want to settle on a standard structure for your forms and build on that. Two resources:


    If you are comfortable with the standard programming model, I suspect these approaches will work pretty well for you.

    Should you decide you need more than these provide, Some popular PHP frameworks include CodeIgniter, CakePHP, and Symphony.

    They all implement the MVC -- Model View Controller -- model in some format. Model is sort of an abstraction of the database -- if you have a standard rpg procedure to write an order -- which also writes to a history file and some other stuff -- you are on your way to using a model. View is your display file. Controller is your program flow structure.

    CodeIgniter is the lightest, and has the smallest learning curve. Use of the model is optional. If you use CodeIgniter and put SQL in the controller, you are pretty close to the standard RPG model.

    CakePHP and, I believe, Symphony make some database naming and design assumptions (single unique key field named 'id') that make them poor fits for most existing AS/400 databases. They both have more functionality and bigger learning curves than CodeIgniter.

    There is also Zend Framework, which is really more a collection of utilities than an integrated Framework. It is certainly worth looking at once you are fairly proficient with the simple approaches. This is not something you would need to adapt in its entirety -- you might decide you just need to use the LDAP authentication library, or something like that.

    In summary. Start simple. Any formal Framework you choose will already impose more structure and have more moving parts than the simple model you are used to.

  5. Ron, I have done one project with Ruby on Rails and don't believe it is anywhere near the same efficiency as RPG+DSPF - do you believe it is? I haven't really ever done ColdFusion but I am inclined to think it isn't any better than RoR given your combined recommendation and lack of expounding on either of them.

    The closest thing I have seen to date is JSF (MyFaces specifically) and that introduces other complications that make me dislike it as an efficient application "framework".

    It really is quite amazing that NOBODY has been able to address this well - not Zend, not Microsoft, not IBM (though EGL is getting closer), not Sun, not the open source community... I think it has to do with the whole IT industry not being able to come up with a solid UI for business applications. We obviously have HTML+CSS+Javascript+HTTP, but much of that was never meant for what we are trying to use it for today. We have Adobe Flex, M$ Silverlight and JavaFX coming down the pipes as a "thicker" thin client, but those are still in their infancy IMO (none of them have proven track record for large scale business applications and instead are mostly used for simple things like a 25 to 50 page web app) - most larger Flash/Flex apps I use are CPU hogs (thinking of Godaddy's domain admin right now).

    Zend, will you be the first to answer the call? I think that would rock as PHP is darned easy to learn/use (compared to Java). A solid framework that took the work out of building browser apps would take the industry by storm - but you will need to think different than you are today. Leverage your relationship with IBM and get in touch with the 5250 communications personnel to learn how they were able to create such a powerful solution that lasted the better part of decade (then the internet became popular :-)

    Aaron Bartell

  6. Aaron, have you looked at Wavemaker? If so, just curious as to what you think.

  7. David, Wavemaker looks fun. I think it would be a great tool to use for prototyping applications or as something you could put into the hands of a pseudo programmer.

    The thing I don't get is how to implement the full application stack with something like this. Like where is the business logic? I dug around for about 15 minutes and from what I can tell it is basically a tool that emulates the model layer on a 1-to-1 basis.

    In the end something like this could get me a site up real quick, but what about additions or maintenance after that? How does it work with a Change Management system? Etc...

    What I would love is a completely back-end-language-agnostic front end written in Flex/Silverlight/HTML-CCS-Javascript/JavaFX that talked to the server using a predefined generic protocol based on a specification. This specification wouldn't adhere to any particular language but instead would "make the rules" and the server side language would adhere to those rules. Then you can have the server dynamically send down screen representations (via XML/JSON or whatever) and then have the client dynamically generate the screen and spawn events back to the server based on user interaction. What we have today has *some* of those features, but most of them require that you have a compiled object (thinking of Flex) for each screen that is then needing to be downloaded to the client - makes for deployment headaches. I have built a solution similar to what I am prescribing for a Canon MFD with a touch screen. Because we couldn't change the client code after we installed it on the MFD we had to come up with a VERY dynamic client that wouldn't ever need to change. So everything about the client is dynamically rendered based on an XML "form" definition. I hope to release the concept to open source sometime in the future. I have to take out a lot of J2ME specific code first.

    Aaron Bartell

  8. Aaron, sounds like you are talking about web services. Wavemaker has some nice features for do webservices. Certainly you can add both Java and Javascript code as much as you like with Wavemaker, not to mention HTML and CSS. I think Wavemaker does as good a job as I have seen at getting you started, but as with all products, eventually you have to get in the trenches. Wavemaker makes deployment simple. It also provides a nice avenue for implementing security via LDAP... as well as role based security (although this feature is not free - unfortunately)

  9. Yep, in this case I am talking something similar to XML web services, but I am wondering if something more efficient could be thought up (i.e. less verbose and not requiring a sometimes bloated HTTP server). Maybe even have two options: 1) Very loosly coupled interface with XML+HTTP. 2) Have proprietary interfaces that maybe just used a trimmed down socket server and a different delimiter technology to pass data.

    Just curious, how does "Wavemaker make deployment simple"? If you could elaborate that would be great.

  10. I agree with what Mike says re Java. Often Java applications, especially when written by seasoned java architects, are just far too over-engineered.

    I have often written quick and dirty bits of java code, just to get the job done, and used that way its quite fast to get something up and running. But when you go down the OOP route, designing objects and classes blah,blah,blah you can end up sitting around for days trying to get your design just right, when you could have had the whole thing done and coded and tested and implemented in that time.

    The main problem I have with java frameworks is the complexity of learning something new. eg if the framework is almost as complex as learning a new language, then the benefit has to be quite high if im going to take the time to learn it. Often i get to a certain point and discover that the benefit just isnt worth it

    PHP reminds me of Net.Data. Fairly simple to setup, and you can reasonable quickly just get stuff done. Not always pretty, but then unless its a large project, you dont always need pretty


Note: Only a member of this blog may post a comment.