Want to Drive Innovation through Crowdsourcing? Learn the 5 Steps Get the eBook ×

Google Go or Node.js for web development? Which is better?

By will-price In Help Articles

Posted January 27th, 2015

This post has been sloshing around in my brain for a couple of months now and it’s finally time to let it spill out all over the floor. Last July I started digging into Google Go for my Topcoder Cribs with Docker blog post, and found it to be surprising straight forward, powerful and easy to work with. Subsequently, the more Node.js that I wrote, the more I realized how much I liked Go and missed its ease of use. Periodically I’ve asked myself, “is Go better for web development than Node.js and JavaScript”? Unfortunately, I’ve yet to respond to myself.

JavaScript is Dead. Long Live JavaScript.

Don’t get me wrong, I love JavaScript and MEAN is my go-to stack. Roughly 75% of my work is done with JavaScript on the server or client somewhere and I’d estimate that 60–70% of my personal repos are in some flavor of JavaScript. But like most full-stack developers, I’m overwhelmed by seemingly daily releases of new frameworks, testing tools, templating libraries and more. I know the goal is to “JavaScript all the things” but I think we need to stop or take a smoke break from the madness. The State of JavaScript in 2015 provides a great example of the chaos:

As little as twelve months ago is seemed a fait accompli that the modern web would be dominated by Backbone.js (maybe using Marionette), with Grunt as a task runner, Require.js and Handlebars-based templating. Yet six months later, these technologies had all apparently been replaced, if the blogosphere was anything to go by – now, it was all about Angular, Gulp and Browserify. And then suddenly this stack seems questionable too.

We’re all adults here so let face reality. It’s no secret that JavaScript has tons of problems. People either code around the warts or run away from JavaScript as quickly as possible. Reddit has an awesome thread on using Go versus Node.js for servers. It’s a must read for the comments alone.

No one language is perfect or else everyone would be using it and I’d be writing about my favorite cat videos or pudding recipes instead. However, there are things that make Node.js a joy to develop with including modules, npm (a dream compared to Bundler and dependency hell with Ruby), the event loop, a vibrant developer community and the fact that I can bootstrap a new Express app in a matter of minutes if not seconds.

But in contrast, there are a number of usability issues that make me want to chew glass sometimes instead of use Node.js. I frequently have issues with profiling, debugging, error handling, testing and the general asynchronous nature of Node.js itself. TJ Holowaychuk, arguably the most prolific Node.js developer, said goodbye to Node.js and hello to Go last summer for a number of these same reasons.

However, these issue aren’t new and some of the core committers of Node.js are dedicated to solving them. Last December a number of the core committers to Node.js finally became fed up with Joyent’s pace of innovation and release schedule and decided to create a fork of Node.js called io.js. Hopefully everyone involved can get together, site around the campfire, resolve differences and hug it out.

campfire

We ❤ Node.js

At Appirio and Topcoder we write a lot of JavaScript and Node.js for our clients and I don’t see this trend slowing anytime in the near future. However, we’ve been hearing whispers from large corporate accounts about using Go, especially when it comes to building APIs and other backend service running on distributed, cloud platforms. The times… they may be a changing!

Why I Fancy Go

Go is no holy grail. However, for our customers that build and run distributed apps in the cloud, it might be a pretty good fit. TJ outlines some compelling points:

I’m not saying Go is the absolute best language out there and that you must use it, but it’s very mature and robust for its age (roughly the same age as Node), refactoring with types is pleasant and simple, the tooling Go provides for profiling and debugging is great, and the community has very strong conventions regarding documentation, formatting, benchmarking, and API design.

Go feels “scripty” and is very easy to grok with roughly 40 pages of docs. Plus, there’s something that gives me a warm, happy feeling inside when I compile my code into a binary. Maybe it harkens back to my days writing Java where everything was statically typed and I could be fairly confident that things would just “work” and not have to worry about runtime typos.

Apparently we are not the only ones that are interested in Go as the RedMonk Programming Language Rankings for January shows a steady rise in Go’s popularity, moving from #21 to #17 displacing Visual Basic, Clojure and Groovy since the last ranking in June.

Adrian Cockcroft of Battery Ventures (and Netflix of course) stated at DockerCon last month:

“In the role I have now working in a VC firm… about 3/4 of the new stuff that we see is written in Go. It’s really started to take over as the language that new things are written in. ”

One last thing… Go may be poised for meteoric rise as version 1.4 recently added support for Android development. If Go becomes fully supported, you may see a huge increase in adoption similar to what happened to Swift’s popularity when it was unveiled. I suspect mobile developers would much rather develop Android apps with Go than with Java. But, then again, what do I know.