Biz & IT —

“My favorite programming language:” Google’s Go has some coders raving

Go is fast, powerful, and "beautiful," developer says.

“My favorite programming language:” Google’s Go has some coders raving

Todd Kuehnl has been a developer for nearly 20 years and says he's tried "pretty much every language under the sun."

But it was only recently that Kuehnl discovered Go, a programming language unveiled by Google almost four years ago. Go is still a new kid on the block, but for Kuehnl, the conversion was quick. Now he says "Go is definitely by far my favorite programming language to work in." Kuehnl admitted he is "kind of a fanboy."

I'm no expert in programming, but I talked to Kuehnl because I was curious what might draw experienced coders to switch from proven languages to a brand new one (albeit one co-invented by the famous Ken Thompson, creator of Unix and the B programming language). Google itself runs some of its back-end systems on Go, no surprise for a company that designs its own servers and much of the software (right down to the operating systems) that its employees use. But why would non-Google engineers go with Go?

This is just a picture, but you can try Go within the browser at golang.org.
This is just a picture, but you can try Go within the browser at golang.org.

Kuehnl is the head of engineering for Beachfront Media, which recently announced a new platform called Beachfront.iO that serves video ads to mobile devices and tablets. Kuehnl spent three months leading development of the platform, saying he chose Go in large part because of how it enables concurrency, the ability for computations to execute simultaneously and interact with each other while they're running.

Beachfront.iO "needs to service millions upon millions of requests a day, upwards of 5 to 10 thousand transactions per second and do this very reliably," Kuehnl said. "I was looking at different stacks and doing benchmarks to figure out how it would be most productive and most performant … and that's where I came across Go."

The code written in Go performs all the heavy lifting on the back-end, including load balancing and choosing which ads to serve up when and where.

"The issue for PHP and even Node.js is obviously you're trapped in a single-threaded situation and what I really wanted was to be able to do a lot of things concurrently," Kuehnl continued. "My options were to go with something like Java, where you have more memory overhead, or I could go with something like Go that was built from the ground up for concurrency and using very modern patterns."

Kuehnl said Go combines those modern concurrency patterns with the "static execution speed of C or C++" but with "a more compositional feel, a script kind of feel. … I started first with the idea of trying to pick the most high-performance modern language, but as I explored it more the beauty of the language presented itself."

Beachfront runs its video ad service on Ubuntu Linux servers hosted in the Amazon Elastic Compute Cloud. Go performs well even on cloud-based virtual machines (albeit large instances with 16GB of RAM), Kuehnl said. This allows Beachfront to minimize one of the pain points of advertising—lengthy delays that cause users to give up and move to a different website or app. "With Go, I'm able to have an ad up and running within 200 milliseconds, which is orders of magnitude faster than some of these legacy networks," he said. Go's compiler is so fast "it's almost like working in an interpreted language," he said.

He's not the only one

Google unveiled version 1.1 of Go earlier this month, promising a big speed boost. (Kuehnl said he's already using the new version.) Google, which is also developing a JavaScript alternative called Dart, declined an interview request from Ars about the future of Go. Google noted, however, that Go is used internally by the company for "core infrastructure services; cluster management; large-scale distributed processing, including some uses of MapReduce; [and in] tools for software development."

Google pointed out that Go is the 24th most popular language on GitHub, and that interest in Go is growing rapidly on Google Trends. The language is being used by a variety of companies including BBC, Bit.ly, Canonical, CloudFlare, Disqus, Mozilla, and Tumblr.

At least one project using Go did end in failure. That was a Kickstarter-funded game called "Haunts: The Manse Macabre." The developer blamed much of the trouble on Go itself, but his descriptions seem to indicate the problems were mostly self-inflicted through poor planning and version control. The developer cited "the shifting code base of the Go programming language" and the fact that the language is "new and not well supported." But he also noted that the code his team developed is "buggy and incomplete" and that the original programmer on the project took on a new job and "has not responded to additional requests for aid or insight into solving" the fundamental problem that the game code can't be compiled.

Go has worked out well for numerous other users. A developer named Dotan Nahum recently used Go to build a remote management system for the Raspberry Pi called Ground Control.

Nahum told me via e-mail that he chose Go for its "performance, concurrency, and simplicity." Ground Control required a Web server and monitoring daemon, and his options "were to either go with C and write a pure C-based solution, or use something I knew was the closest thing to C in concept and offered great performance (in its recent version): Go."

Nahum wasn't sure how Go would work on the Pi's ARM architecture, but it turned out the Pi "took everything I threw at it without any problems."

Nahum further stated:

Being polyglot for a long time now, I use the right tool for the job. Instead of being stuck fitting square pegs into round holes (which sadly many programmers do), I keep exploring more and more platforms and languages in order to gain high expertise in those and understand what situations call for the right platform and language.

In my opinion Go gives you great performance—which is easy to verify yourself and is more or less a fact; but what's more arguable is that I think it gives you great concurrency. More precisely I think it gives you great concurrency, and simple concurrency, for the amount of effort you put in.

I see Go as simple in general, too. It doesn't try claim it is a superstar like other languages have in the past, it has simple language constructs (in my opinion), and the ecosystem is very humane—from the documentation to the developers' general approach. I think you can attribute those properties to languages like Ruby and Clojure too—I see Go as a distant relative.

Go still has some growing up to do, though—no surprise given how new it is. Nahum said alternatives like Ruby and Node.js have more complete ecosystems and that Go's packaging and dependencies could stand some improvement. "If you make a few searches, you'll see some confusion there and several alternate solutions for what exists right now to specify your dependencies," Nahum wrote. "Some say that it's just a matter of people not getting it right, and some say that it shouldn't work the way it does right now. I'm not so fond of the way it works right now, but I can also make do for now—it could have been much worse (I don't want to say which language I'm talking about :)."

Kuehnl noted that Go is probably not yet the best choice for creating desktop apps with graphical user interfaces, or for gaming. "I think Go fits best for what it's really being used for in Google, which is back-end services, back-end processes, data analysis, things like that," he said.

Kuehnl watched some video lectures and read documentation about Go when he was learning the language, and said it didn't take him to figure out how best to use it.

"There's sort of a C kind of feel to it but it's definitely different, it's got some influences from Haskell and some other languages in regard to some of the concurrency aspects," he said. "I found Go to be very natural really within a few days. What I love about Go is it gives all these powerful concurrency patterns and you can get really creative with it. At this point I don't have to think about it. I just think about the problem I'm trying to solve and there's a lot of really elegant ways to go about it with Go."

Channel Ars Technica