NODE.JS VS. JAVA: AN EPIC BATTLE FOR DEVELOPER MIND SHARE
If you’re old enough to have been around back then, you might remember Java’s early, epic peak. It left the labs, and its hype meter pinned. Everyone saw it as a revolution that would stop at nothing less than a total takeover of computing. That prediction ended up being only partially correct. Today, Java dominates Android phones, enterprise computing, and some embedded worlds like Blu-ray disks.
For all its success, though, Java never established much traction on the desktop or in the browser. People touted the power of applets and Java-based tools, but gunk always glitched up these combinations. Servers became Java’s sweet spot.
Where Java wins: Rock-solid foundation
Java has its share of new features and options, but for the most part it is a stable platform. That makes life much easier for developers who are building something to last.
Where Node.js wins: Ubiquity
Where Java wins: Better IDEs
Java developers have Eclipse, NetBeans, or IntelliJ, three top-notch tools that are well-integrated with debuggers, decompilers, and servers. Each has years of development, dedicated users, and solid ecosystems filled with plug-ins.
Meanwhile, most Node.js developers type words into the command line and code into their favorite text editor. Yes, some of the best text editors like Atom have elaborate collections of plug-ins that do almost anything, but even then it feels like Node.js is more old school than Eclipse. Soon we’ll be replacing our mouse with an Atari joy stick.
Some developers use Eclipse or Visual Studio, both of which support Node.js. Of course, the surge of interest in Node.js means new tools are arriving, some of which, like IBM’s Node-RED offer intriguing approaches, but they’re still a long way from being as complete or as dominant as Eclipse or IntelliJ.
The weird thing is that the developers don’t seem to use these tools. The command line was supposed to disappear 35 years ago with the arrival of the Mac, but no one told the Node.js developers. The options are there. WebStorm, for instance, is a solid commercial tool from JetBrains that incorporates many command-line build tools.
Of course, if you’re looking for an IDE that edits and juggles code, the new tools that support Node.js are good enough. But if you ask your IDE to let you edit while you operate on the running source code like a heart surgeon slices open a chest, well, Java tools are much more powerful. It’s all there, and it’s all local.
Where Node.js wins: Database queries
Meanwhile, many Java developers use SQL. Even when they use the Java DB—formerly Derby, a database written in Java for Java developers—they write their queries in SQL. You would think they would simply call Java methods, but you’d be wrong. You have to write your database code in SQL, then let Derby parse the SQL. SQL is a nice language, but it’s completely different from Java, and many development teams need different people to write SQL and Java.
To make matters worse, many Java coders use elaborate libraries and schemes to convert the data from the SQL query into Java objects just so they can recast it into templates. It’s a crazy process, and ultimately pretty wasteful.
Where Java wins: Types
Many of the introductory programming courses continue to use Java because many serious programmers tend to like statically typed code both for the simplicity and the safety. The code just feels more rigorous after the compiler catches the obvious bugs.
Where Node.js wins: Syntactic flexibility
Where Java wins: Simple build process
Where Node.js wins: JSON
When databases spit out answers, Java goes to elaborate lengths to turn the results into Java objects. Developers will argue for hours about POJO mappings, Hibernate, and other tools. Configuring them can take hours or even days. Eventually, the Java code gets Java objects after all of the conversion. And when it comes to configuration, the Java world still clings to XML and even offers two major parsers to give developers more reasons to fret.
Where Java wins: Remote debugging
Java boasts incredible tools for monitoring clusters of machines. There are deep hooks into the JVM and elaborate profiling tools to help identify bottlenecks and failures. The Java enterprise stack runs some of the most sophisticated servers on the planet, and the companies that use those servers have demanded the very best in telemetry. All of these monitoring and debugging tools are quite mature and ready for you to deploy.
Where Node.js wins: Desktop
Where Java wins: Handhelds
Android apps are often written in Java and 90 percent of the new phones run some version of Android. Many people don’t even use desktops any more because the phones are good enough for everything.