Why I like Go

It’s no secret amongst my colleagues that I’m a big fan of Go.  I’ve been following it for a few years and I finally got to use it in production last year when I introduced it to the micro-service architecture stack at my current client.

The language I am most familiar with is C#.  I also have experience with Java, JavaScript (browser and more recently Node), a little Python and even some Erlang (there was an episode with VB.NET in the distant past, not my choice and we try not to talk about that).  So why do I like Go so much?

The value of technology is in its application, not in and of itself.  The value of a tool is what it enables you to achieve, how efficiently you can achieve it and the quality of the result.  All tools require an investment of resources.  The value of the tool is the delta between that investment and the result.

From my starting point Go required little investment to become reasonably proficient.  It’s genealogy is C so as a C# hack it looks familiar, but the syntax of a language is actually a fairly trivial matter.  The lack of inheritance was an easy adjustment to make as before Go appeared on my radar I was tending to often prefer composition over inheritance anyway.  Dependency injection; an easy concept to grasp but not quite so easy to implement in C# or Java.  It requires careful consideration with regard to interfaces, where they are defined and there are a myriad of containers to choose from.  Great once you are up the curve easy enough but still there is a curve.  The implicit interface model in Go takes a lot of this pain away.

If Go has a killer feature it is CSP.  You haven’t earned your stripes until you have tied yourself in knots working with mutexes and threads.  If you haven’t seen Rob Pike’s presentation Concurrency is not Parallelism then I suggest you do if this is a topic that interests you.  Likewise the excellent Seven Concurrency Models in Seven Weeks by Paul Butcher is a must read.

Go hasn’t come down to us from an Ivory Tower.  Go is an open source project with a vibrant community contributing to Go itself as well as it’s ecosystem but it definitely has a very coherent ‘story’, clear design goals and is very strong on idioms.  One example of this is Go fmt.  Discussions about how to format code are IMO a huge waste of effort.  The only value is in consensus.  Go defines how the code is laid out, discussion over before it began and everyone has the same layout, perfect.  Contrast this with JavaScript today;  A million and one ways to do the same thing and at least two versions of the syntax kicking around.  This isn’t a JS bashing post, there are good reasons why it has become that way.  As a insightful colleague of mine with a sharp wit that spends his days knee deep in Node and React said “you just stay there safe and warm whilst I’m out here in the wild west!”.  He has a point.

I have rambled slightly here.  It feels like the sort of post I will revise again and again over time as I have definitely missed some important details out in this first pass, but I started it with a single point that I wanted to get across.  When I learned the other languages I know I felt like I was putting a lot of effort into learning that language.  Over the years I learned the greater lessons around patterns, TDD, CI, code/package de-coupling, the value of immutability, IoC, SOLID and probably lots of other elements that slip my mind right now.  Concepts and ideas that transcend a particular language.  Go let’s me employ them all without getting in the way and as such that delta between tool investment and result is high.  That is why I like Go, it doesn’t get in the way or make me jump through hoops, it just let’s me express what I need to express without objection.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s