revjim.net

February 8th, 2006:

Java vs. The World

There are a lot of people talking about Ruby/PHP/ASP/Whatever vs. *The World* out there. Over time I’ve realized that for many people it’s natural to claim that whatever you have currently is the absolute best, and that there’s no way anything else can compare, regardless of what you have, what you’ve tried or what else is out there.

However, equal in number, there are those who like to complain that the tool of choice that others are so adamant about is indeed the wrong tool for the job. They point out a features they already have, features you’ll never have, or, when they run out of things to complain about, they just brag about how old their tools are.

bq. PHP and Rails folks take note. ActionRecord (or whatever it is), generated code, and directories that represent apps are so 1996. PHP, hand cranked persistence code is practically as old as C++. This is not where these tools compare favorably with Java’s offerings. And your languages are new. Talk to a seasoned PHP guy and ask them about their code from 5 years ago. Most don’t have code that old, anywhere. — “Matt”:http://crackmonkey.livejournal.com on “Colors of Bikesheds”:http://crackmonkey.livejournal.com/519300.html.

Though it’s been said several times before and in better words than I can present, I’ll point it out again here for posterity: Ruby alone can hardly be considered something to scratch the “web itch”. In fact, like Java, Ruby doesn’t scratch the “web itch” very well at all, it was designed to be much less specific than that. Furthermore, while Python is far more mature than Ruby, the two are often compared in equal light and many Rubyists are Python converts, and vice versa. However, this doesn’t mean that Ruby, Java, or Python can’t handle web development. In the Java world (and forgive me, because I don’t know it all that well) you have Tomcat/JSP and things like that that help Java to get on the web. Ruby has “Ruby On Rails”:http://rubyonrails.com/ for that similar purpose. Python has Skunkweb, among others.

While I don’t intend to argue the advantages and disadvantages to ActiveRecord’s approach to the problem, it certainly isn’t “so 1996″ to me. Maybe Java had some tool that did something like that 10 years ago but, not being a Java programmer, I did not. No, it isn’t /Hibernate/, but that isn’t implicitly good nor bad. It’s just different. If Hibernate was around 10 years ago then that’s great. I wish I was using it 10 years ago when I had nothing else. If I was programming in Java and Hibernate was the right tool for the job, I’d be using it today. But I’m not.

As far as directories that represent applications go, I don’t understand the complaint here at all. I’ve used plenty of Java code before. The “libraries” go in the library directory (just as they do in Ruby, Perl, PHP, and Python) and everything else goes with the application. Some programmers are inclined to put all of the functionality into a library and simply call it from a single file application. I rather like this approach but the code is still separated into directories. Those directories just all sit under the libraries directory now, instead of under the application directory. Ruby On Rails works this way. The actual “web deployed” code is a directory with a single file in it. Sometimes there is a bit of code to hook it into the webserver of choice or, in some cases, *BE* a webserver, depending on how you choose to deploy it. Of course when serving a web application there are often auxiliary files (images, stylesheets, etc) that come a long with it. Some people store those in other ways but, for simplicity, most people include those in the deployed directory as well, though you certainly don’t have to.

I have lots of code that’s 5 years old. I even have some PHP code that’s 5 years old. I’m not really proud of that fact, but it’s not something to be ashamed of either. It just is.

You are right about one thing. Most of the languages you’ve mentioned are indeed younger than Java. And I have a great deal of appreciation for a language and a set of libraries that are old enough to have all the bugs worked out and be considered tried and true. But Java’s been moving forward all of this time and so have its tools. So unless you stick with the same versions you were using in 1996, you’ve got a chance of running into an “undocumented feature” regardless of what language you’re using.

What were you doing using Java 10 years ago anyway? It was *SO YOUNG*! And the tools it had were so immature compared to what C++ had at the time. Of course my question is rhetorical. I know why you used Java: It got the job done in the best possible way: best for what is important to you and your application. That’s the same reason you use it today. And this is the same reason I choose the tools I choose. In certain situations, Java might just be that tool. But not today.