|
One of my pet-peeves as a technology-guru, is how some
people are given a hammer and can't appreciate that there
are other things in the world other than nails. If you spend
enough time on this site you may get the feeling that I'm
just another open source bigot who hates the Microsoft
empire and anything that is closed. That's not true. I've
been around the block long enough to have been exposed to a
number of technologies and I appreciate when one might be
better than another when presented a problem. The
Java
vs. PHP
debate exemplifies this.
Java
or PHP?
PHP
or Java?
To too many of the developers that code with both, this is a
one sided coin. Well, for me it's not that clear
cut...read-on if you care. Another good side of Java is all the out-of-the-box class libraries you get and how everything is 100% object oriented. Procedural code can die anytime if you ask me. Wait, but PHP is object oriented, right? Well, yes, for the most part. But there are some inherent things missing (overloading, inheritance from multiple object, enforcement of private properties and methods). Ok, now for the cons of Java that give PHP it's place in software development. Java is complicated. Just learning the intricacies of all the class libraries can keep a newbie fumbling about for months before they get their hands around it. And even then that doesn't give you a working Java platform. Installing Tomcat or WebSphere Application Server is not trivial if you want to do it right. And if you are talking about WebSphere you are taking a few thousand bucks for application server and IDE not to mention additional costs if you run AIX like a lot of shops do. What else? PHP is loosely typed. This can be a double edged sword but this makes converting over from something like VB/ASP a snap. Furthermore, installing PHP is much simpler and, if you are using Visual Studio or Linux with gcc you can compile in new features as needed. To address the class libraries you find in Java, PHP compilation can add hooks to many things (DBMS's, Cryptography Libraries, XML Libraries, etc). You also have PEAR which is really growing exponentially now that it is out of beta. No, it's not packing everything Java has but it's filling in a lot of the gaping holes. Finally, and most importantly, PHP is simple. To draw from an outdoors analogy, why use a canon to kill something better suited for a .22? Just open vi, write the code and run it. No deploying EAR's, no restarting the application server, no hassles. Working Iowa's IT Department I see a few instances where Java was used to code a simple solution for a customer that had no real needs to scale. They could have saved a considerable amount of money going with PHP in some of those cases (note that some case were justified using Java because of bridges to things like MQ Series isn't supported in PHP). With all this said, I'll leave you with more than just endless babbling. You can read a Java programmers comparison on the two and a rebuttal by a PHP developer. In conclusion, be open-minded.
PHP,
in my own opinion, has a place in most enterprises. It's not
a silver bullet, but a cheap one. Like ammo for a .22, it's
cheap and effective at killing small to medium sized
critters ;-) |