Blog‎ > ‎

Java Versus PHP

posted May 22, 2010, 10:52 AM by Infojester   [ updated May 22, 2010, 1:24 PM ]

Originally published Sunday, July 12th, 2009

One of my main interests is in web frameworks, or more simply put “what is the best way to implement a given application?”.

I like Java, love the IDE’s available and what they can do, and believe that a good Object Oriented design is the foundation of a good application, irrespective of the technologies used.

That being said, there are some really great PHP applications out there (Wordpress, Joomla. Drupal, etc). You really can’t point to as many open source, easily available Java applications.

The main selling point of the PHP is the ease of installation and deployment. Most of the popular programs just require you to upload the source code and run an installation script.

Java on the other hand is a bit more involved. If all goes well, you should just be able to copy a War or Ear file to your server and you are all set. Of course, there are issues with restarting the application and such architecture is of questionable ease to extend with plug-ins the way PHP seems to be. I’d like to think that all the good Java developers are too busy building really cool corporate applications, which might actually be the case.

I bring all this up due to my recent experience in finalizing the XX Framework. I have two demo applications that are part of the distribution, a guestbook and an implementation of Java Pet Store. I’ve successfully converted these to XX 2.0, and they can easily be deployed as a War file.

My intention was to have the demos available online. This is always a nice to have when looking at a new framework or product.

I use and love for hosting. I’ve been able to run on their shared VPS environment, but soon outgrew them and moved to a GoDaddy dedicated box.

Since I don’t want to spend much money to keep the demo apps online, I attempted to deploy the War to a shared 256MB server. It deployed and ran fine, but quickly blew through available CPU, so I had to back it out before I received a phone call from Eapps support “suggesting” that I upgrade.

I thought, if this was a PHP application, it would likely work fine and be quite fast. Is this just the nature of PHP versus Java, PHP being more suitable for the low end and Java more for the high end. I think this is probably the case. I should add, that the XX framework is a known CPU hog, being entirely dependent on XSL transformation and those can certainly spin up the processor.

I’d like to compare apples to apples some day and deploy a simple and lean Java app, with and without additional frameworks like Spring and Hibernate. I could rewrite the demos to do this and hopefully someday I will have the time to do just that.