Recently, I posted a
discussion regarding my belief that there are more "cool" applications being written in PHP than in Java. As, I stated in the posting, I come from the Java camp myself, and through the posting I hoped to open the eyes of Java developers who see no value in looking beyond the Java world. I hoped that the resulting discussion via comments to my post wouldn't degrade into yet another Java versus PHP rant. Unfortunately, to a great extent, that is exactly what happened. Many developers, both on the Java and PHP side, took the opening to rant on how horrible, unsuited, lacking of quality, slow, etc.. the other language is. I found it enlightening that many of the arugments against the other language were exactly the same, i.e. the Java developers said that PHP is too slow, PHP developers say that Java is too slow. I took the liberty of deleting some of the comments because they were simply so childish and unprofessional in nature, as to be useless to the discussion at hand.
In further discussion with some who posted comments and others who read my blog, I began to realize that many Java developers are lacking in their understanding of how far PHP has evolved, and how similar in many ways it is to Java, from a developers perspective. For example, I wonder how many Java developers realize that version 5 of PHP brings full object-orientation to PHP, including
- inheritance
- constructors
- destructors
- public, protected, and private properties and methods
- interfaces
- abstract classes
- static properties and methods
PHP5 also introduces a reflection API, very similar to what Java has, full XML support, SOAP support, exceptions and exception handling, and a whole lot more that I'm certain would come as a great surprise to many Java developers who havn't taken a look outside their immediate technology domain lately. Likewise, based on postings from PHP advocates, I am sure there is a great deal about Java that would come as a surprise to many of the hard-core PHP developers.
My point here is certainly not to suggest that we should all move from Java to PHP, or PHP to Java. Rather my point is to suggest, as some did point out in comments to my previous post, that PHP and Java are both very capable languages, each capable of being used to develop very powerful web applications. Yes, they each have their niches, PHP being with the hobbyist and small business community, and Java being in the enterprise and corporate community. Furthermore, I believe that developers can benefit from being aware of what is being done in other languages outside of their chosen language of expertise. Cross-polination can be a very good thing for both PHP and Java developers.
In this debate, people often have looked at some of the applications developed in PHP, which in many cases are very poorly designed and developed, by hobbyists or students without a background in software engineering, and jumped to the conclusion that PHP is a crappy language that leads to poorly designed and buggy applications. This is an invalid conclusion. Especially given the advances in PHP5, I would say that a developer is as capable of developing a high quality, well designed and architected application in PHP, as is capable in Java. Java developers tend to have a more professional, software engineering background, but given a pool of undereducated developers as exists in the PHP community, I am certain that you'd see just as many buggy and sloppily designed Java applications out there.
As a developer, don't bury your head in the sand and make childish comments like PHP sucks, or Java sucks. Instead, spend some time learning a bit about another language and see what you can learn from that.
Until next time,
Tim