Sunday, 22 April 2018

Beyond Java: Programming languages on the JVM

If there is any language that is a known and proven quantity for developers, it’s Java. Enterprise developers, web developers, mobile developers, and plenty of others besides, have made Java ubiquitous and contributed to the massive culture of support around Java.

What’s more, the Java runtime, or Java Virtual Machine (JVM), has become a software ecosystem all its own. In addition to Java, a great many other languages have leveraged the Java Virtual Machine to become powerful and valuable software development tools in their own right.

Using the JVM as a runtime brings with it several benefits. The JVM has been refined over multiple decades, and can yield high performance when used well. Applications written in different languages on the JVM can share libraries and operate on the same data structures, while programmers take advantage of different language features.

Below we profile several of the most significant programming languages created for the JVM. From Kotlin and Scala to Jython and JRuby, these languages offer simpler and flexible ways to complement Java, or powerful alternatives designed to replace it.

Kotlin
Created by JetBrains in 2010 and open sourced in 2012, Kotlin is both more concise and safer than Java. You can think of Kotlin as “Java, but simpler.” Its syntax is less verbose than Java’s, and it often compiles faster than Java code. Kotlin also permits functional programming styles not currently available in Java, and has safer and more elegant ways to handle null values. Android developers are increasingly choosing Kotlin over Java for app development on that platform.

Future plans for Kotlin go beyond the JVM. One project involves compiling Kotlin to machine-native code by way of the LLVM framework.

Scala
Like Kotlin, Scala was created to make Java developers more productive. Scala combines functional and object-oriented programming in the same language, making the functional paradigm accessible and useful to Java ecosystem users. Plus, Scala syntax hews closer to Java than functional alternative Clojure, whose Lisp-like syntax can be disorienting to the uninitiated. The mix of functional and object-oriented paradigms is a big part of Scala’s appeal.
Currently in the works is Scala Native, a variant of Scala that runs outside of the JVM on bare metal, by way of LLVM. But it’s still too early to be used for production.

Clojure

Developer Rich Hickey wanted to build a functional language in the Lisp family for the JVM, and he created Clojure to scratch that itch. Clojure is intended to make it easy to write concurrent, high-performance applications, useful wherever Java runs, but allowing a different set of programming styles than Java traditionally supports. One success story of note is Puppet Server, which was migrated from Ruby to Clojure.

Groovy

Originally developed by Pivotal, but now under the stewardship of the Apache Software FoundationGroovy builds strongly on existing experience with Java while offering features inspired by dynamic languages like Python and Ruby. Groovy is one of the languages directly supported by the popular Jenkins continuous integration server, and one key web framework, Grails, is built with it.
Future versions of Groovy will embrace features in newer versions of Java and the JVM, like Java 8 lambda syntax.

Jython and JRuby

Jython and JRuby are implementations of Python and Ruby, respectively, for the JVM. Jython is compatible with Python’s 2.x branch. JRuby is compatible with the relatively recent Ruby 2.3. Both dynamically compile to Java bytecode and can interoperate freely with other JVM languages, Java in particular.

Other JVM languages

  • Ceylon: Developed by Red Hat, Ceylon was devised to address some of Java’s issues, like its verbosity and its ties to some of the underlying mechanisms in the JVM. Ceylon can be compiled to run on the JVM, on the Dart VM, or on Node.js.
  • Frege: A version of the functional language Haskell for the JVM. Frege code compiles to a Java class and interoperates with Java generally, but can take advantage of Haskell-style immutability and functional paradigms.
  • Eta: Another Haskell variant for the JVM. Its touted advantage is that it can use packages from Haskell’s package repository, Hackage, for maximum compatibility with the Haskell ecosystem.
  • Haxe: Haxe compiles to the JVM as one of many possible targets, including the web, mobile devices, and bare metal. Its syntax is reminiscent of Java, and it can interoperate with other Java libraries if needed when compiled for the JVM.
  • Fantom: A language with implementations for both the JVM and the .Net CLR, Fantom provides APIs that abstract away the differences between both platforms. Fantom can also be compiled to JavaScript, and in theory it can be deployed to any number of other targets.
https://www.infoworld.com

No comments:

Post a Comment