CNET también está disponible en español.

Ir a español

Don't show this again

Culture

Is Java getting better with age?

Scripting languages are catching on with developers, but Sun's James Gosling sees plenty of kick left in Java.

A surefire way to ignite a Web flame war is to say one programming language is better than another. James Gosling, known the "father of Java," understands that as well as anybody.

In a recent blog, Gosling walked into the most recent dustup regarding Java and scripting languages.

Scripting languages such as PHP and Python--also known as "dynamic" languages--are simpler to learn than Java and are a popular choice among developers, particularly for building Web pages. Many people, including former Java devotees, contend that the rising use of scripting languages and the so-called LAMP stack of open-source components comes at the expense of Java.

Although clearly biased toward Java, Gosling, now the chief technology officer at Sun's Developer Products Group, isn't losing sleep over the issue. "It feels like we're only a third of the way through exploiting into what we can really do with Java. There's a lot of play in this puppy yet."

Gosling spoke to CNET News.com about the never-ending debate over programming languages, the bright side of being flamed and the future direction of Java.

Q: There is this ongoing discussion about the merits of Java as a programming language. Many people say that scripting languages are replacing Java. So, is Java's use waning? Is it aging ungracefully? Is it getting old and crusty?
Gosling: Well, there's a part of me that actually wishes that was true--that would make my life a lot easier. But from everything I see, things like survey data from Evans Data, and just the enormous uptake we keep getting of Java and all the related technologies around it, there's no detectable slowdown.

I know there's a lot of people who wish there was a slowdown. For me the most exciting thing is the way that the excitement is sort of diversifying.

Why did you say you wish it would get old and crusty?
Gosling: Well, I've been doing this for a while, and there are times when I think, "You know, it would be nice to be able to take a vacation."

It's funny, looking at the blog replies (to his recent posting), I try really hard to steer away from even vaguely controversial topics. But because of who I am, it doesn't take very much before the blogosphere erupts in craziness.

AJAX is pretty cool, but it certainly has its problems.

At one level, I thought I was trying to be very laid back and innocuous, and people were inferring insults when there was none there. But the sort of flipside of that is that there's also a huge number of folks who came strongly to my defense. I thought that was quite heartwarming.

I think one of the best indicators for me these days (of Java's health) is these developer education programs we do around the world. They're just getting bigger, and more and more people are showing up--particularly in places like China and India and Brazil, they are mob scenes.

Let's talk about some of the points that have been brought up. Evans Data had a study showing that use of Java has been going down in North America for the past two-and-a-half years, although it's been going up in Asia. PHP and other scripting languages are getting more popular and robust. And if you look at Web 2.0 companies, it seems that lot of them are using AJAX, which involves scripting.
Gosling: Well, AJAX is just a style of using JavaScript to build advanced things. It's pretty cool, but it certainly has its problems.

Right. Then there are books like "Beyond Java," which says that Java is great for some things but for Web development, other development languages and frameworks are better. So, what's your reaction to that? Do you think that it's well-founded?
Gosling: Well, there's bits of both. When you take a look at something like PHP, which is totally focused on doing just Web development--if you're just generating a Web page, PHP is actually pretty good. It's almost a clone of JSP (Java Server Pages), pretty much is exactly a clone of JSP.

The place where I think it's getting messy is when you go beyond something that is purely Web page generation. As soon as you start doing much analysis or integration with other kinds of computation, it gets difficult because something like PHP is very focused on Web page generation.

One of the things that we often find is that people will do the Web page piece in PHP, and then the back-end data analysis kind of stuff is done in Java code. Often, what goes on is not that one technology displaces another, but one technology augments another.

If that increasingly becomes the case--that Java is used on the server, and scripting on the front end--isn't that a problem for Java?
Gosling: I guess I've always thought of the Web front-end stuff, in the spectrum of the world's computing tasks, to be one of the more straightforward and simple. There's a lot of scripting stuff that people have been doing within the Java context--JavaScript itself, languages like Groovy and J/Python and J/Ruby.

One of the things that is often not well appreciated is that Java is really a two-level language: It's the virtual machine and it's the sort of ASCII syntax?all the other really interesting magic is in the virtual machine, the things that people never actually see. There are many, many, many scripting languages that have been put on top of that virtual machine.

Why would you want to write use scripting in conjunction with the Java virtual machine (JVM)?

Gosling: One of the nice things about doing scripting languages that way is that they instantly get access to a gigantic library of tools, and they get very highly tuned performance and great interoperability?You can use Groovy and get access to point-of-sale terminal stuff, smartcard stuff and math libraries to do Fourier transforms--whatever gets you excited.

Java was designed for distributed computing and is regularly used for complex jobs. Should Java be used for simpler jobs?
Gosling: Historically, it's worked very well for simpler jobs. There's just sort of a trade-off though--if you make something so that it does really simple jobs really easily, it tends to fall over when you try to do big things.

One of the things that is often not well-appreciated is that Java is really a two-level language: It's the virtual machine and it's the sort of ASCII syntax.

One of the general design directions for Java over the last several years has been that we had really focused on the extremely high end. So if you were a big bank and you wanted to ride a transaction server that would handle $100 billion a night--and there are people who do that--then all the infrastructure in the Java world would handle that. With that came along a loss of simplicity, because there are all these obscure things that you have to deal with when things are that large. You have to deal with robustness as there really is?in this sort of high-end world.

Ease of use has historically been a barrier for Java adoption. What are you doing about that?
Gosling: What we've been trying to do, actually, is rather than attack simplicity by changing the language--because often, if you try to make the language simpler, then you destroy your ability to handle the high-end stuff--we've been focusing our efforts for simplicity...on tools. So, if you look at Java Studio Creator, it lets you drag and drop AJAX components and database accesses and things, and build Web pages very, very quickly.

One of the things that's nice about the way that we do that is (what) the tools generate has all the sophistication necessary. You don't have to actually do anything fancy to be able to deploy this on a large redundant cluster with failover, remote management--all that kind of comes along for free.

But then over time, they get bigger and more complicated.
Gosling: They get bigger and more and more complicated, and you end up with these "fall on your face" transition points, where you have to throw things out.

We've tried to make it so that you can start out in a very simple easy-to-use world through the tools, and then as you scale up, the tool reveals more and more of the complexity.

In the last few years, there has been a lot of interest in LAMP (a Linux software combination) as a development stack, whereas as a few years ago people said there were two primary stacks: J2EE and Microsoft's .Net. Has LAMP become a viable option to what's offered in the Java world?
Gosling: LAMP has certainly become quite viable, and Java works perfectly well in the LAMP world of Linux, Apache and MySQL and PHP. Java actually fits into that mix pretty nicely and gets used in that mix pretty commonly.

In general, I'm philosophically quite a big fan of diversity in the marketplace?I actually personally don't feel a great sense of difference there.

It sounds like you're not necessarily concerned about the emergence of things like Ruby on Rails or more use of PHP or LAMP. These things are not explicitly Java, but it sounds like that's okay, from your point of view.
Gosling: I actually think they're cool. All these things do actually work together. Particularly when you look at some of the flavors of Ruby--like there's one called J/Ruby, which is an implementation of Ruby on the JVM (Java Virtual Machine). That's actually pretty spiffy; they get some very nice stuff there. My one wish with the scripting folks is that on average they aren't weird enough.

What do you mean?
Gosling: Well, if you look at many of them, they kind of look like Java programs.

Meaning that if they're going to be doing something different, they should really do something different from what's already there in Java?
Gosling: I mean it feels to me like there's enormous territory for people to do really innovative and interesting things, and it feels like people are just kind of scratching the surface.

Is Java going to remain a general-purpose language and platform, or is it time for it to specialize in mobile or in server stuff?
Gosling: There are number of paradoxes involved here. On the one hand, you get a lot of power by specializing. On the other hand, you actually get a lot of power by being general, by hooking things together, by having an environment that works on a lot of places, and that's been one of the areas that's been pretty powerful for us.

My one wish with the scripting folks is that on average they aren't weird enough.

One of the flip sides of that is people tend to focus on the technologies. But if you focus on the skill sets of the developers, one of the things that's been really powerful in the Java community is that a developer can learn Java and then work on an app server, work on a transaction server, work on a piece of networking protocol, work on an app in a cell phone, work on an app that's controlling some piece of factory automation, work on an app that's in a smart card. You end up with a skill set that is extremely portable, not just a technology that's portable? It's funny when you talk to the CIOs, CTO crowd--that ends up being a really huge deal.

The Ruby on Rails people are excited about it because it's productive, whereas people will say Java just doesn't have the same productivity for Web development. Why are we still just waiting for that?
Gosling: I think a lot of people who are saying that haven't actually tried any of the high-end Java tools. They really need to sit down and try things like Java Studio Creator?One of the things that's interesting about this debate is that, by and large, the people whose vote gets counted by the press are the people who are the loudest.

The development world tends to have trends that people jump on. Do you want Java to be trendy?
Gosling: Well, eight or nine years ago, Java was trendy. It's gotten to where it sort of transcends trendy. It's really a funny thing, because Java isn't like a thing anymore, it's a whole bunch of different things.

You take things like J2EE (server software), it's become almost sort of the opposite of trendy, in the sense that it's totally mainstreamed, totally proven mission critical. It's very corporate, it has been really seriously battle tested, and for lots of folks it's become a completely safe bed.

It's one of these phased things. I think there are parts of the Java world that have become very trendy--and I don't mean trendy in the sense of the latest style of glitter jeans, I mean trendy in the sense of sort of popular and exciting. Certainly things like cell phone development and NetBeans and Creator and a lot of the tools and the different API stacks like the JAX-WS stuff, we consider all of those to be very trendy.

There are aspects of it that are just rock solid. They're dependable, and they've become as exciting as oxygen. It's there when you need it, and if it went away you would be really upset.