Why one developer switched from Java to Google Go

Go excels for building system-level software

While Java may be a good choice for building business software, Google's Go language has advantages when it comes to building systems software, says a Java developer at Pivotal who has become a Go advocate.

Go has benefits in areas like packaging and modularity and concurrency, said Matt Stine, a platform engineer at Pivotal, which uses Go in its Cloud Foundry cloud platform. "If you're trying to solve problems in the sweet spot of Go, which is large, high-performance, server-side software, I'd say it is a very strong, natural choice."

Stine said Go is "fairly boring" and not really an amazing, modern, feature-rich language, but all the same, "you can do some pretty exciting things with it." He described Go as a kit for building systems-level software. Rather than requiring add-on frameworks like other languages, developers can embrace the standard Go library.

To handle concurrency, in which many items are managed at once, Go has built-in capabilities, unlike Java, where tools were bolted on as libraries, Stine noted. "In Go, in the fabric of the language syntax itself are the features necessary for me to do concurrency in a first-class way." Go also makes it easy to return multiple values, said Stine.

Go also offers closures and maps, which associate values of one type -- the key -- with values of another type, are a built-in data structure in Go. Stine also praised the construct of a slice in Go. With a slice, an array is wrapped to provide a more convenient interface to sequences of data. Most array programming in Go is done via slices.

Semi-automatic resource management in Go is offered via the defer keyword. "Instead of having to create, do stuff, and then close at the bottom, I can immediately say, 'Run this function after the rest of the function completes'," Stine said.

Stine stressed that Go has the advantage over Java when it comes to packaging and modularity, which is much simpler in Go than it is in Java. "[In Go], all types and functions have to belong to a package, but every source file has to declare its package. There's none of this default business. You have to be explicit about what you want."

Java, founded in 1995 by Sun Microsystems, scores tops or near the top in language popularity indexes including the Tiobe, PyPL, and RedMonk language popularity indexes. Go, though, is on the rise in the RedMonk index, coming in at 21st place in the June rankings. Go was ranked 30th in the July Tiobe Index.

Copyright © 2014 IDG Communications, Inc.