Jeff Atwood’s latest post on PHP sucking hard, while powering a very decent amount of the internet, got my attention. Not so much by the content itself, but rather because I was thinking about PHP and Java web applications a lot lately anyway.
This blog is powered by PHP and I write little PHP scripts once in a while to mock a server for testing my jQuery plugins. On the other hand, I’m designing, architecting and writing a web application in Java. In the case of testing jQuery plugins and the application, the tool is the right one for the job. I’m not so sure about this blog, WordPress and PHP. Jeff’s post links to more than enough arguments why PHP isn’t the right tool…
But the quality of the programming language is a too small part of the picture. I consider the barrier to entry an important part. Its a hell of a lot easier to get started writing a PHP application. Just create a new file. Finding a hoster for that application is easy, too, and can be as cheap as a few bucks per year, literally. Setting up a shared-hosting enviroment is rather easy, too, as each PHP request runs in its own shared-nothing process.
Installing WordPress is frickin’ easy, too. Download the current release, upload it via FTP, enter DB info into a plain text file (“plain text” in contrast to verbose xml configuration buried within JNDI datesource defintions), and done!
The barrier to entry for writing and deploying Java web applications is a bit higher. Java hosting is rare and expensive. Writing a Java web application requires at least two files and one folder, one file being an XML configuration file placed inside that folder. Deploying applications heavily depends on the hosting enviroment. Usually it involves uploading a war-file via FTP or webinterface, I don’t even know how it works in shared-hosting enviroments.
A few hosters support JSPs: Just upload a .jsp file and point the URL. Pretty close to the PHP model, arguably much worse. JSPs invite you to mix HTML and Java, which is much worse then mixing HTML and PHP. A JSP has extra tags to import classes, and of course tags for SQL queries, if you are really desperate. You loose the benefits of static styping while still bearing the cost, unit-testing is somewhere between extremely hard and impossible, certainly not worth it anymore. In other words: JSPs provide no reasonable benefits over PHP.
That leaves us with a lot of work ahead to lower the barrier to entry for Java web applications. The most potential is creating applications. The create-a-file-to-create-an-application mode is as easy as it gets, so we’d need some abstraction that allow you to create a servlet application with just one file, and no xml configuration, please.
Once creation is a matter of creating a file, deploying should boil down to uploading that file. Once that is possible, hosting will improve – its than a matter of supply and demand.
I hava few ideas for the necessary abstractions and will post about them. Thoughts and ideas are very welcome – maybe I’m looking in the wrong direction here.