Subscribe / Unsubscribe Enewsletters | Login | Register

Pencil Banner

Java forever! 12 keys to Java's enduring dominance

Peter Wayner | Oct. 22, 2013
Haters and hipsters beware: This cross-platform curly-bracket relic never lost its app-dev mojo

The disks are not limited to raw video footage. The extra features and interactive tools can be revised and enhanced with pure Java code. The disks are mixtures of compressed video and compressed Java byte code. You can do quite a bit with the Blu-ray standard.

Key to continued Java dominance No. 7: Curly brackets just work
Lovers of trendier languages like Ruby, Python, or CoffeeScript enjoy disparaging how Java (and C) require programmers to hit those curly bracket keys again and again, explicitly delineating the beginning and end of each block of code. Parentheses, curly brackets, even the square ones — all are anathema to these folks. (I don't like them myself and am still nostalgic for the way some versions of Lisp let you close out everything with a square bracket.)

But changing punctuation doesn't eliminate complexity. If anything, it hides or whitewashes it. Using white space like tabs forces you to intuit what you can't see. That's fine for an if statement that triggers one line of code, but it's hard when several layers of nesting are involved. When I write Python, I find myself counting and recounting the indentations. Just because it looks like English doesn't mean it's as easy to understand as an English sentence.

Key to continued Java dominance No. 8: Groovy
If Java programmers must have a cleaner, simpler syntax with dynamic typing, they don't have to run to a newfangled language. They can use Groovy, a neat hack with a preprocessor that produces Java byte code. The language is also fully integrated with Java, so you can mix in calls to Java libraries in the middle of your Groovy. It's like a shorthand for writing Java code.

This flexibility lets programmers engineer their way out of problems. When Groovy is slower — often the case when using dynamic method invocation — the programmer can always rewrite the important time-wasting core in Java.

Key to continued Java dominance No. 9: The JVM
The JVM was built and optimized to run the kind of typed code with static scoping that the Javac compiler produces, but somewhere along the way language developers realized the JVM could run other code, too. As long as the compilers produce legitimate Java byte code, the JVM doesn't care what language goes in. The developers of Haskell, Scala, and Clojure jumped on the Java bandwagon by building their compilers to do just that — and they're only a few of the higher-profile examples of symbiosis the JVM enables.

The attraction is obvious. Sun/Oracle does the work to create the cross-platform environment, and everyone else benefits. Sun/Oracle engineers smooth out the differences and worry about compatibility, then everyone can run whatever we like.


Previous Page  1  2  3  4  5  6  Next Page 

Sign up for CIO Asia eNewsletters.