Java forever! 12 keys to Java's enduring dominance
By Peter Wayner | InfoWorld | Published: 13:40, 21 October 2013
It's easy to forget the value of any given technology once its buzz has arced across our collective consciousness and died a fiery death beyond the hype horizon. Take Cobol, that "Mad Men"-era relic -- just like fish past its prime, as the hipster tech pundits say: worthless, smelly, out of date, bad for you. Java may be the next enterprise mainstay to find itself on the ropes of "relevance."
The book sales are a distant memory. And Java's middle-age utility is no longer sexy enough for the magazine cover spreads. Nearly 19 years since Java's launch, the application development cognoscenti are wandering around the luring bazaar of Node.js, Objective-C, Dart, Go, and the like, wondering, "Java? Is that Web 1.0 era artifact still here?"
A quick search of Dice.com job listings says you bet -- in a big way. Whereas listings for iOS-related jobs top out around 2,500, Java pulls up more than 17,000 listings. The Dice numbers are far from a perfect measure, but anything suggesting the Java job market may be some seven times larger than that of the unstoppable force of hype in the developer world is not bad for a relic.
Maybe that's because Java offers a better business plan than giving 30 percent of your revenue to Apple off the top and crossing your fingers in hopes that your app makes the top-25 list. Truth is, Java has always tackled a grander problem than helping angry birds get back at some pigs. It's a foundation of a number of platforms, designed to deliver a smooth way for software to run efficiently on more than one chip architecture. That solved problems for the server programmers, client programmers, and embedded programmers all at once.
Before we forget Java's many vital contributions to computing and its role today, here are 12 definitive reasons why Java is not only surviving but actively thriving in its post-buzz existence.
In other words: Don't call it a comeback; Java's been here, dominating, all along.
Key to continued Java dominance No. 1: Resiliency in the face of (often dirty) politics
The tech world never gave Java a shot because its enemies were many and well-armed. Regardless, the language flourished. Many of those surprised to see Java still here have surely spent too much time listening to the haters and not enough time understanding its success.
Microsoft was Java's first big enemy because the company saw it as the most worthy successor to the unity MS-DOS offered. Redmond bad-mouthed Java from the beginning, fighting it tooth and nail. Java never found the traction it needed on the desktop, in part because the magic Java virtual machine took too much time to start up. Despite the tiny delay, Java applications run well enough on Windows to be functional.
For some inexplicable reason, Steve Jobs never embraced Java, even when the Mac was largely ignored by everyone except Adobe. Java compatibility could bring in plenty of code, but Apple always treated it as an afterthought. (Yes, iOS smartphones are smoother than my Android, so maybe Steve had a point.)
Java has also suffered many internal squabbles. IBM loved the language but was always battling Sun. Its decision to call its wonderful IDE "Eclipse" was not warmly received by those at Sun, who never figured out the business world like the folks at IBM.
Through all of this and many missteps by Java's own creators, Java still proliferated, finding a fruitful home on the server and serviceable hold on the desktop. Every technology has to swim against political currents, but in Java's case it swam harder and further, proving it is often a good choice for the job.
Key to continued Java dominance No. 2: The magic of threads
One of the strengths of Java's virtual machine has always been its ability to juggle multiple threads with ease. The JVM is optimized for large, multicore machines, and it will often handle hundreds of threads without buckling. This flexibility is what attracts other languages to come up with cross-compilers and emulators, so they can run on top of the JVM.
This power is also what attracts many of the high-traffic websites. They can write code that runs on their desktops, then use much of the multicore power available on the server.
Ruby is one of the modern competitors to Java that attracted many converts to its cleaner, more English-like syntax. Yet when Ruby lovers need high performance, they turn to JRuby, a version that emulates Ruby in Java providing much better performance under heavy loads with many threads. The Sun engineers got something right when they sweated these details.
Key to continued Java dominance No. 3: Java as first programming language
Religions, armies, and nations thrive by building loyalty when the people are young. Java is the lingua franca for Advanced Placement Computer Science, and this means it is often the first language that students learn. This sticks with them, through the good and bad. When they learn new languages, they see strengths and weaknesses relative to Java. If they become converts -- many do leave the Java fold -- they still base their opinions on what they learned in that first class.
Java has many advantages for teaching computer science. Some programmers hate specifying the type for the data, often calling it "belts and suspenders" programming. That may sound paranoid, but it's a great way for beginners to learn what's going on inside the computer. Asking them to spell out the type of data gets them thinking about it. Then the compiler can catch their errors when the variables don't line up correctly.
Some of the trendiest languages have been moving away from curly brackets because maintaining them can be annoying. That may be true, but they're useful for new programmers who need to understand nested blocks. Curly brackets help the newbies unpack all that nesting.
There will also be some who want to push their own language, and in most cases, their pet language is more relaxed without the strictures and rules of Java. They have a good point, but they miss the fact that the simpler, cleaner syntaxes have their own dangers that become apparent later. Some find the belts-and-suspenders approach suffocating, but Java pushes better habits from the beginning. The neophytes can handle the relaxed and more dangerous constructs when they're better trained.
Key to continued Java dominance No. 4: (Close enough) cross-platform compatibility
Java wasn't the first language to target simple cross-platform compatibility, but it's been the most popular. That's not to say it's perfect -- a missing library or an incompatible version will crash the code. You can't take your latest JRE 1.7 code compiled for a desktop with gigabytes of RAM and run it on a Java ME phone. It's not that compatible.
But Sun and now Oracle have done the best they can making cross-platform compatibility work most of the time. When it doesn't work, the reasons are usually understandable. If you use the right versions of Java and make sure there's enough memory, it will work. Java developers can use their desktop tools to create the code and move it to the destination, be it a phone or a server. If the compiler includes the right libraries and checks for the right versions, the code will run. That's invaluable.
Key to continued Java dominance No. 5: Sustained success on small chips
Java may never have built up a big following on the desktop, but it found a warm embrace in the mobile world -- the market segment that happens to be exploding. The Android platform is built on Java from bottom to top, and it is now easily outselling the iPhone.
This dominance is not new. The slimmed-down version of the language and VM known as Java ME was widely used on many so-called feature phones, those almost-smartphones that number in the millions throughout the world.
When you mix them all together, Java's dominance is stunning.
Key to continued Java dominance No. 6: Blu-ray
Java was once called "Oak" and designed for the set-top boxes that Sun wanted to dominate. That didn't exactly work out according to plan, but Java managed to find a nice place in the living room. The Blu-ray standard is built around Java, and anyone who wants to add extra content to a Blu-ray disk must get out the version of Javac compiler.
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.
Microsoft borrowed this idea (and much more) when it created C# and went out of its way to build compilers for most of the major languages so that the C# VM could run them all. C# programmers say they can write in many different languages -- as long as they run it on a VM via a Windows box. Quelle flexibilité!
Key to continued Java dominance No. 10: The NoSQL revolution, built in large part on Java
A long time ago, a database was an inscrutable black box that stored information and answered queries quickly and efficiently. Then came the NoSQL revolution, and programmers realized they could write their own database and tailor the code to their needs. Many of the most significant NoSQL tools are written in Java. Cassandra, Lucene, ElasticSearch, HBase, and Neo4J are just some of the NoSQL options often mentioned. Then there are some like acid-state, which is written in Haskell and runs on the JVM.
These tools are usually open source and ready for integration. Some developers run them as independent jobs; others compile the code into their own stack like libraries. In either case, Java's status as the lingua franca for the database layer ensures that life is a bit easier for the Java developers. They have to worry less about little glitches that come from character encodings or line terminators. This means that Java developers can enjoy the fruits of the NoSQL revolution.
Key to continued Java dominance No. 11: Minecraft hooks into postmillennial mind share
The hipsters in the Brooklyn may sneer at Java, but Java programmers had beards first. And while the Ruby fad continues to garner its own share of fans, the generation after them is falling in love with Java. Why? One word: Minecraft. It's written in Java. If the kids want to extend Minecraft, they need to learn Java to build the plug-ins. This ensures the next generation of programmers learns Java first.
Key to continued Java dominance No. 12: Open source
Sun was always one of the leaders of open source, but it hesitated to completely release Java. This didn't stop Java programmers from releasing many great libraries and projects with very loose open source licenses. The Apache project continues to deliver great Java code with a license that doesn't require much in return.
Sun finished releasing most of the code under the GPL in 2007; since then, the company and its eventual new owner Oracle have tried to be what it thinks of as a good steward of the language. Oh sure, that public façade didn't stop Oracle from dragging Google into a legal mess, but otherwise, the platform is largely open and free.
Haters abound, but Java rolls on
Java certainly has its share of problems and Java haters will abound, spilling their blood all over online comment boards. The garbage collector can cause hiccups and jitter. The typing system is a chore and can't stop truly bad code. The annotations are too complex. The features don't evolve as quickly as they did in the past. Curly brackets add clutter. The list is long and often justified.
In the end, this is one of the advantages of Java. It runs everything and is open to change. You can replace most parts of the libraries with your own code if you need different functionality. The language is open source and very flexible. Whatever limitations the language and the platform have can be solved relatively easily. This means that Java programmers continue to be some of the most productive. Even though the books no longer dominate the best-seller list and the software updates don't come as frequently, Java continues to live and even thrive.