Suns Gosling: New Java Flavors Brewing - Page 3

-oriented programming ">

Speaking of DARPA and technology they have funded, whats your position on aspect-oriented programming?

AOP is kind of a complicated one for me, because AOP is one of these things where the theory sounds really good. I actually mostly like the theory. The way it turns out in practice tends to be pretty dangerous. Its fraught with all kinds of problems. You know when the AOP folks talk about AOP they list you like three or four use cases for AOP and they actually mostly make sense, although they have problems in the details. But there actually arent very many use cases outside of that. And when you find people who are using AOP, the average ones that Ive talked to have been using it for things that are just like incredibly inappropriate. Its like a really, really, really bad idea to be doing what theyre doing. And so I feel very conflicted because on the one hand I basically like the concept, but I dont think that the research community has really figured out how to encapsulate those in a mechanism that really works for people. Its like giving them a chainsaw without any safety instructions.

Marc Fleury of JBoss says he thinks Enterprise JavaBeans 3.0 is an example of AOP in some respects.

Yeah, well there are a lot of things that one can think of as examples of AOP in some respects. The debugging framework in Java is an example of AOP in some respects. Theres a performance monitoring facility in 1.5.1 that looks a lot like AOP—I mean that kind of instantiation of interesting uses … of AOP. And because theyre narrowly focused they actually manage to be really safe and useful. [Otherwise,] it feels like handing razor blades to children. Youve got to have razor blades to shave your beard, but oh my God, dont let five-year-olds do craft projects with them. And of course most of the people out there using AOP arent 5-year-olds doing craft projects, but theyre easily tempted. It just seems to me that that theres just a better way.

Can you talk a little about support for scripting? How is Sun expanding that?

Well, theres a set of APIs for interacting with scripting languages that appeared in 1.5. Lots of people have actually used Java itself as a scripting language. If you build the frameworks right, Java … actually works pretty well as a scripting language. We tend to use all kinds of scripting languages—whatevers out there.

Do you have any favorites? For instance do you like Groovy?

I think Groovy is pretty interesting. I think theyre being fairly conservative. I think they could be a little more outlandish and get a little more interesting.

In what way?

I remember sort of reading through their syntax list and saying, "Oh, why didnt you do this and why didnt you do that?" There were some things about the way that they did sort of the equivalence of declarations and some things about the way they did case switch statements … I sort of felt like writing them this long letter and saying, "What? Why didnt you do it this way?" You know … (laughter). So they actually had some neat stuff in there.

But I like Groovy a lot. We sort of got into political hot water when the whole JavaScript thing happened. So weve tended to try to have sort of an arms length relationship to anything having to do with scripting. Were happy to use scripting; we do a lot of scripting ourselves …. I actually did a pretty nice scripting language; at least I think it was nice, back in the early days. And I threw it in the trash can when the whole JavaScript thing with Netscape happened. And you know, in retrospect, ugh, what a bizarre thing to have done. But, you know, its water under the bridge.

Next page: Will Sun join Eclipse?