Are the scripting languages threatening Java?

A posting Friday on TheServerSide defending Java against Ruby on Rails made me realize that some Java programmers seem to be feeling threatened by Ruby and its Rails framework. The concern seems to be Ruby, or another scripting languages like PHP, makes developing web applications easier than using Java and one of its many web frameworks. The result being Java will start to die out and really will become the next COBOL.

Granted, there’s a lot of hype right now about Ruby and Rails. We all read or heard about the article in January on the O’Reilly ONLamp web site by Curt Hibbs saying Ruby on Rails will let you develop a web application 10 times faster than using Java. That article seemed to strike a chord among Java developers. A lot of blogs have been discussing RoR and why it’s the best way to go for developing web applications, or a big step backward for separation of concerns and good design, depending on whom you read.

And there’s even been recent hype about PHP as a fast way to develop web applications. IBM last month, announced it will work on products to bring the “do it yourself” simplicity of PHP to products like Zend Core for IBM. The headline on one story proclaimed “IBM Bets PHP Is Open Source’s Next Big Thing.” IBM accompanied its announcement with a new developerWorks section devoted to all things PHP. This month, IBM developerWorks announced new blogs, by the likes of Sam Ruby, focusing on the benefits of PHP.

Does this mean Java is on the way out for developing web applications? Who knows? But why worry? New languages and new web frameworks will have to prove themselves. They’re not going to steamroll over Java without some real projects proving their mettle over Java in the long term.

I do have a concern that some software development managers, in their quest for Cheaper, Faster, Lighter software, might fall for the hype of the scripting language du jour and hire inexperienced developers (“Hey, they’re right out of college but they can program in PHP!”) to write web applications in PHP or Perl because they’ve heard these languages will result in faster delivery. The result could indeed be fast delivery — of horrendously complex, intertwined, unmaintainable code.

But how is that any different than hiring an inexperienced Java developer to do the same thing? I’ve seen a lot of inexpensively developed Java code that was horrendously complex, tightly coupled and expensive to enhance and maintain. (OK, there is a difference. In the latter case, I can get hired to come in and fix it at a nice rate.)

If the scripting languages and their frameworks like Ruby on Rails really do make developing web applications easier, sign me up. Ruby seems like an elegant, expressive language that allows for good object-oriented design. Exaggerated claims about a language or framework are no reason to dismiss it. If features of Ruby or Rails really make developing software easier, faster and more maintainable, Java and its frameworks eventually will adopt similar features. And if they don’t, Java deserves to fade.

I’m not worried about Java fading soon. Java has been evolving since it began, learning from other languages and frameworks (even .NET). The EJB remote-object overkill was solved in EJB 2.0. Web services got easier to develop in J2EE 1.4. Annotations were added in JDK 5 and will be expanded in J2EE 5. Object-relational mapping is supposed to get better with EJB 3.0.

But what makes me believe Ruby, Python and PHP won’t kill Java is that they haven’t been able to do it in almost a decade. Object-oriented scripting languages, even Ruby, have been around for years. Most predate Java. If they were so uber-language powerful, why does Java (currently, at least) enjoy such a large developer and CTO mind share? What I think we’re seeing in the Rise of the Scripting Language is that Java is overkill for a lot of projects. Just like we all accepted a couple of years ago that EJB is overkill for a lot of projects. The interest in scripting languages could be a trend similar to the growing interest in Spring and Hibernate to help us simplify our applications.

The interest in scripting languages among Java developers actually seemed to start a few years ago. I remember hearing Bruce Eckel in 2001, saying how Python, with its OO features and dynamic typing, allow him to write software faster and more elegantly. He said in an interview on Artima developer that:

I feel Python was designed for the person who is actually doing
the programming, to maximize their productivity. And that just
makes me feel warm and fuzzy all over.

Since about 2000, Dave Thomas has been saying how Ruby does the same for him. Here’s an excerpt from an article he wrote for Linux Magazine in September, 2002:

Ruby is concise (like Python), fully object-oriented (like SmallTalk),
and powerful (like Perl). In addition, Ruby is a remarkably capable
language for building Internet applications. Ruby's libraries and
built-in networking support make networked applications (such as email
clients, SOAP servers, and distributed processing) easy to write and easy
to maintain and extend.

But the interest in scripting languages among Java developers really seemed to begin in the past few months with all the talk about Ruby on Rails. It seemed to start with Curt Hibbs’s O’Reilly ONLamp article, the one in which he said:

What would you think if I told you that you could develop a web application
at least ten times faster with Rails than you could with a typical Java framework?
You can--without making any sacrifices in the quality of your application!

The next month, Bruce Tate said in a February blog that Ruby on Rails “is beautiful, simple, and has a little bit of magic to it.” He said he loves Ruby.

The Rails lovefest hasn’t gone by without some cricism. JavaServer Faces expert David Geary countered Hibbs’s claim that Ruby on Rails beats Java hands down:

...ROR is no match for a Java-based web app six pack of
JSF-Shale-Tiles-SiteMesh-Hibernate-Spring .... I'm not going to use the default
views generated by ROR (nobody is, except for simple UI mockups) and implementing
my own views in ROR looks mighty ugly to me. And am I going to just throw away the
incredibly rich collection of open-source Java software, like JSF, Tiles and SiteMesh?
No way. ... [Y]ou take this ROR koolaid. I'll stick with the JSF flavor.

Still, after getting an email from Bruce Tate, who raved to him about Ruby on Rails, Geary responded last week in his blog that he would take a closer look at Ruby on Rails before criticizing further.

I’m going to bet that the use of scripting languages like Ruby, and scripting-language based frameworks like Ruby on Rails, will increase in the coming years. Still, I don’t think Java will fade as a result. I think the increase in scripting languages will help developers refine their decisions on where the power or maturity of Java is needed, and where it’s not.

And by the way, where’s Groovy (JSR 241)? Last year, I heard from a developer that he’s several times more productive writing in Groovy than Java, and had several thousand lines of Groovy code under his belt to bolster his comparison. Yet I don’t hear developers talking about Groovy to the same level as other scripting languages. Maybe once Groovy reaches its 1.0 milestone, we’ll start to hear how Groovy can make us 10 times more productive as developers.