Saturday, January 10, 2009

Java 7: too little, too late

So I'm reading an article about Java 7, and the new features just don't seem very compelling to me.

For example, look at this quote from the article:
JSR 203: NIO 2 extends and completes the work started in JDK 1.4 in the original NIO enhancements. The most obvious addition in NIO 2 is a complete overhaul of the file-access APIs. Most developers have used and are aware of the long list of shortcomings:
  • No support for symbolic links
  • No support for straightforward or atomic move and copy operations
  • Cumbersome APIs for walking and filtering directories
  • Very limited support for access to permissions and file attributes
  • No API for watching directories or files

Funny how Factor's IO library already has all of those features, with a cross-platform API on top, and more. Unlike language implementors who decided to host their language on the JVM, I don't have to sit around twiddling my thumbs while Sun implements basic functionality.

And then there's this quote from the article:
Given shrinking resources at Sun, the number of significant JSRs, and pressure to release, it seems that it's unlikely that closures will be included in the Java SE 7 release.

"Shrinking resources" indeed. During the dot-dom era, Sun pumped massive resources into Java, hiring an army of mediocre programmers to crank out feature after feature, half-assed API after half-assed API. Now all those bad design decisions, complete disregard for maintainability, and backwards compatibility is really weighing them down, and they're having trouble moving forward. This is why newer, better-designed languages and language implementations are able to evolve so much quicker than Java.

It's 2009 and only now they're adding APIs to work with symbolic links, and move and copy files? And no closures? What a joke.


SDC said...

It would seem languages are best designed by one, two, at most 3 people. The crudload of crud by committee approach fails.

shevegen said...

I think Java has passed its prime/peak already.

Programming languages do rarely really "die", but they may lose out fresh blood. Now this is not the case for Java because so many universities still offer courses, and Java has a solid foundation in economically important areas.

But the really fancy and cool stuff will hardly be realized by Java, and for the guys who want that, they may want to completely ignore Java 7.

drhowarddrfine said...

What, are you going to say Factor is going to take its place? Java is the most used language and isn't going anywhere.

Anonymous said...

I'm mainly a Haskell programmer, but also use C and Perl and Java. I like closures in haskell, and they make sense there, but I don't really think they would make sense in Java. The whole point of Java is that the language core is extremely simple. It's meant to be a feature-less language for people who know what they are doing (and unfortunately is mainly used by college students who don't). Anything you would want to do with closures can (less easily) be done with interfaces.

Unfortunately, I agree with all the problems you list with Java, and I also agree that design by committee is very often ineffective. However, the Java API does have lots of useful things; fast collections, Swing (which is skinnable, fast, crossplatform and very easy to use whilst still looking professional and actually having features) and good threads.

There will always be a place for Java, but it does have its problems.

Charles Oliver Nutter said...

You fall into the trap of conflating Java the language with Java the platform. I don't see any good reason why Java the language needs to have any drastic changes in Java 7, given that there are several other options, many of which perform as well as Java itself and have your precious closures. The NIO/filesystem stuff is obviously late to the game, but JRuby has supported symlinks and other bits for two years now via libffi, and we've created a POSIX-wrapping API others are using as well. We're certainly not "twiddling our thumbs", and you ought to know that having talked with me.

That article also pays little more than lip service to the most important features we're getting: all those associated with JSR 292 (invokedynamic). In the Java 7 JVM, dynamic-dispatched languages could approach Java performance for method calls, as well as have optimized tail calls, fixnums, value types, tuples, and more. Gilad Bracha, former shepherd of the Java language and now critic of where the platform has gone, admitted himself at JavaZone 2008 that invokedynamic would make Hotspot the best dynamic language VM in the world. And the features apply to more than just dynamic languages, since method handles (function pointers hotspot knows about and can inline) and tail calls vastly improving the situation for functional languages like Scala and Clojure.

Dave Newton said...

@anonymous: "The whole point of Java is that the language core is extremely simple."

Radically less simple than many other languages--it's not really all that simple. Compare with Lisp-like, Smalltalk-like, and Forth-like languages whose core actually *is* extremely simple.

pr3d4t0r said...


There are lots of things that could've been done right but Sun keeps missing the bus. This all goes back to what I consider a fundamental Java design flaw: coexistence of objects and primitives. Keeping this in place, along with kludging efforts to maintain backward compatibility, keep holding Java evolution back.

Great analysis, slava. Cheers!


Neal Gafter said...

"This is why newer, better-designed languages and language implementations are able to evolve so much quicker than Java."

Yes, and it's also why newer, worse-designed languages are able to evolve quicker.

jeo said...

C# is similar to java but has both closures and interfaces. I've used C# closures to build a simple but effective domain-specific language. Interfaces don't help with this at all.

I got interested in the jvm recently, mainly due to the text support in swing (rich text with a pluggable model happens to be something I need), but I'm learning scala and clojure, not tired old java.

Anonymous said...

It's a fair comment to say that it's rather embarassing to only now be getting a properly featured filesystem API for the Java platform. But when you say, "Unlike language implementors who decided to host their language on the JVM, I don't have to sit around twiddling my thumbs while Sun implements basic functionality." True enough, but you would have to do an awful lot of work to get Factor's standard library anywhere near as comprehensive as Java's standard library.

Anonymous said...

"standard library anywhere near as comprehensive as Java's standard library"

You said it. Java has comprehensive library. Java is great! But without closures and other things it won't attract young developers. That is what I don't understand from SUN. There is an awful investment in money and work in Java. I don't really get it. C# can do it and Java don't?

inflagranti said...

You're points about the state of Java and the missing important features may be true, but one can definitely not accuse of "complete disregard for backwards compatibility". There are hundred methods in Java marked deprecated, but still available just for backwards compatibility. All Swing classes still make use of Vector instead of the new List interface. Heck, they crippled genericity by using erasure just for the sake of backwards compatibility!

Lincoln said...

The future of Java is Groovy. There you'll get your closures and "fancy" features, plus complete compatability and interoperation with existing Java libraries. Very powerful.

Anonymous said...

I may be wrong, but closures don't seem to be that big a deal.

Sure, date/time + I/O updates are long overdue, but the new libraries are actually extremely elegant; more so than the competition.

Dave Newton said...

@inflagranti: The post said it was *because* of maintaining backward compatibility that they (Sun) has been unable to move the language forward in ways we might prefer.

Anonymous said...

The Java language is fine and the Java platform is fine. Find me another language that is as fast, can be written and runs anywhere, has such an extensive set of open source libraries, and then I'll consider changing. Until then, articles like this are simply the mental masturbation of supreme asshats.

Anonymous said...

"because of backward compatibility we can't...

I call BS on that.
You can mark a package deprecated in 7 and then remove it in 8.
For example "omg".

Other mistakes (hard to pick worst) include annotations and Map String,String. That makes it less readable and less elegant.

For an elegant lang, take a look at D, done by a famous person that wrote the Wacom C compilers.


Anonymous said...

Ah V., another supreme asshat. Laughed at by the Java community all the way to the .NET community.

Anonymous said...

Anonymous: if you think this is the mental masturbation of supreme asshats then why do you read this blog?

Anonymous said...

its just boring topic, people will use java no matter how much you try to brainwash them. does english language has closures? no, then dont use it!

Live by the closure, die by the closure. closure, closure, closure, closure and closure!! java is dead and closure.

Anonymous said...

I don't "read this blog." I read (past tense) this article. Will I read another by this author? Probably not. He's clearly deluded himself to the point of losing any credibility, and quite frankly it's painful to watch.

devshed said...

Sigh, another "Java is dead" article.. Hey I got a great idea for a blog entry! Why don't you gather all of the companies that develop in and for Java and pitch them on Factor! Ask them about their needs and then post those here. Next to each one, document how you would address this in Factor.

Jared Oberhaus said...

What Java 7 really offers is an open source license (at least most of it is GPL).

And as other commenters mention, much of the benefit of Java is the platform, including the many innovations being made in open source projects. If the language and runtime are completely open, it can continue to survive and flourish, even if Sun doesn't.

Seinberg said...

Well, despite working with Java as my primary language for the past several years, I have to say I agree. If only it was as easy to find positions and well-paid to work with Python, Ruby, Arc, or any of the newer cooler languages, I'd jump ship in a heartbeat.

Anonymous said...

The reason Java was originally successful was that developers needed something at a higher level abstraction than c/c++. And in the mid 90's java fitted the bill. Perl,tck didn't seem suitable.

But i, and most developers, have realised, after playing with javascript,lua,python and even scheme/sml/haskell, that java is semanticaly very,very dull.

Anonymous said...

Hi ! What a funny gathering. Java miss that and that. If NIO is not for your choice so dont use it. Why this rambling? Are you afraid you are alone? Java is the only language on FAST cross OS plattform with all the elements one expect from a language. My God what a gathering . This article is as stupid as it can be.

Anonymous said...

Oh, Java is dead, eh? And how many people actually use Factor?

Java isn't going anywhere for a long time. Look at other languages: C, Fortran, etc. Even languages with serious fundamental flaws (e.g. C/C++) survive. Having fewer flaws (nowadays, when we know more), Java is here to stay. Like it or continue using Factor.

Also, it seems that Java 7 is getting closures.