On Java

Publié le :

Warning, serious parody ahead...

I should really buckle down and try writing a Java app because, at the moment, I have an attitude problem. I know that IBM now officially loves it, and Tim Bray's been charting the upcurve in Java book sales, and everyone's saying that Oracle's going to adopt NetBeans. If you want your ears bent back, have a listen to Sun President Jonathan Schwartz; he'll tell you that half the websites in the world are powered by Java and that there are 2½ million developers and that the war is over and Java won. So here's my problem, based on my limited experience with Java (deploying a couple of Content Management Systems for a big IT company): all the Java code I've seen in that experience has been messy, unmaintainable crap. Spaghetti SQL wrapped in spaghetti JSP wrapped in spaghetti HTML, replicated in slightly-varying form in dozens of places. Everyone agrees on Java's downsides: it's not written for the web, it's difficult to deploy and get running, and it's pretty slow and a resource hog. Those are important disadvantages. And I'm sure that it's possible to write clean, comprehensible, maintainable, Java; only apparently it's real easy not to. But Java has competition, most obviously PHP; and don't write the Rails crowd off, they're not stupid at all and they're trying to learn the lessons that Java tried to teach. So Java hasn't earned everyone's respect in getting where it is, and Sun should understand it more than it has. But in the big picture, it feels vulnerable to me.

Sorry Tim, but when I read your post on PHP, I just couldn't help but swap PHP with Java in there, because that's pretty much my attitude problem with Java! Of course it's a parody of your post, but an alarming amount of the above is actually true in my book!

In the past height years, while running my company web platform, I've eliminated two major things: Microsoft and Java, the two over which I've lost sleep. The big winner is LAMP with P as in PHP, Python and Perl. The new kid on the block is Ruby on Rails, though I'm watching its hosting aspects like milk on the fire, for some of them remind me too much of Java in terms of bad code, memory leaks and resources consumption. I'm not enamored with Linux (especially not the Red Hat distro), and I'm eager to test this T2000 and Solaris 10 to see if they're up to some promises, so Sun's not completely out of the picture (my last Sun server, running Solaris 8, died last year). But in the near future, I'll have no Java on my web servers as long as I have better choices. Better meaning: more reliable, faster and less expensive to write, maintain, deploy and run.

P.S. Tim Bray has picked up a lot of good feedback and reflected it on his post. He labelled mine "satirical, funny", which is cool. I think I need to make clear that the above was written in the same spirit (or so I think) that Tim's piece, i.e. an admitted prejudice, certainly not an absolute truth, that's biased by one's experience. I'm very focused on hosting, i.e. running, dynamic sites in a shared environment where 1) I don't control what my "clients" upload and run on servers, 2) I must ensure everything runs smoothly 365/24/7 style, 3) costs must stay as low as possible (read: pack servers and make them sweat). I know how to do that with PHP, but not with Java. I don't pretend to know it all, but look around at the shared hosting world: how many do offer PHP vs Java at competitive prices? QED. One dirty truth is that one can write good or bad code in just any language, PHP is just more forgiving (or, er, "adapted") to that than Java in a shared hosting configuration with, say, average code from multiple developers that are, say, disparate in quality...