Google have declared a new programming language – Go. Contrary to how the title might read, this post is not a tirade about the abundance of programming language – I just like this sort of expressions (and Google could have easily named Go as YAPL instead 😉 ). On the contrary – I’m all for a large selection of good programming language to choose from, and a programming language coming from there, like any other Google product released, definitely warrants a more serious test then what I can offer in this rather quick post.
But I actually found out about Go from a friend that asked about it, didn’t mention Google, and gave me a link to the home page at GoLang.org where Google is not mentioned. So my review below was not influenced by any Google hype, and on the face of it, after reading through about half of the tutorial and a couple of other documents, I don’t like it.
It is basically a C variant with garbage collection, some support for objects, a different type system (possibly better, definitely simpler then C++’s) and internal support for threading and asynchronous IPC. I don’t like the fact that it has “native types” and “reference types” but requires the developer to know the difference and care about it (use new() vs. make(), Slices vs. Arrays, etc.) unlike Java which has similar issues but cares much less. Go is obviously built to compile fast and run fast with minimal considerations for coherent programming, and also to play into a few select people limited sense of “easy to program” – and the contrived syntax does not help.
Go also tries to adopt some useful features that were introduced in dynamic languages such as tuples, functions as 1st class values and closures but in this C variant this only makes the syntax more contrived and less understandable, possibly due to the designer’s aversion from using parenthesis to group stuff(1).
I can see how it could be used to write small services instead of writing them in C or C++, and the benefits of that, but I would be very careful writing large software projects in this language, or small system administration tools.
The problems Go presents for large software development are in code reuse: lacking any sort of inheritance (not even Ruby-style mixins, though those would be obvious here) providing multiple implementations of an interface is going to be a pain. It looks like they prefer to implement polymorphism using services (as APIs or communication protocols) that reduce code duplication by importing functionality from packages – hardly what I’d consider sane for a large software project. Using flat packages (a-la C) for managing code is doable but allows developers to easily make a lot of mess and if I was designing a programming language with support for better code management I would have done it differently.
Its only benefits I see of Go are built-in multi-processing semantics with asynchronous communications, and possibly the small footprint which I guess would only interest people that have limits on the hardware they can deploy (small embedded systems, mobile devices, etc.). If you are planning to need these things, then by all means – go ahead and learn it, otherwise I suggest putting time into a more mature language with better semantics – like Ruby. It may be slower performing but it will allow you to deploy software faster and maintain it better.
After I’ve seen the Google blog post, I’d also like to comment that this new programming language came from several rather well known people:
- Rob Pike is one of the fathers of UNIX, author of programming books and well known hater of object oriented design.
- Ken Thompson is also one of the fathers of UNIX and responsible to a large degree for C (and many of its horrors).
- Russ Cox is like the previous two one of the people responsible for Plan 9, the failed UNIX sequel from Bell Labs.
- And a few other folks who with a quick Googling I did not find any interesting information about them other then the fact that they work for Google :-).
All in all, a respected group that I feel will allow the Go programming language develop into a mature programming language on its own. But at the moment, I suggest staying away from it.
- for example, compare
var a,b = genTuple()vs.
var (a,b) = genTuple()[↩]