Sunday, August 14, 2011

Why Go ?

After all, we have C and C++ when we need performance, Java and .NET for complex business oriented projects, Python and Ruby for nimble and flexible applications. Why should there be any need for another language?
Because C, our main system language on which nearly all other languages are built, is more than 40 years old and is getting less and less adapted to our distributed, networked and multicore computing world. 
Go is an attempt to make a new foundation for the coming computing era, by proposing a C for the 21st century. Such an immense undertaking could only be successful when initiated by a team of distinguished software engineers and backed up by a big company. 
And that is the case: the designers of Go are renowned software pioneers, creators and co-creators of Unix, C, Unicode and the Java hotspot compiler, namely Ken Thompson, Rob Pike and Robert Griesemer. The backing company is Google Inc., which has, considering its immense software and hardware infrastructure, a big business case for a  language which could improve upon C++, Python and Java: and indeed Go is already in use within Google itself since May 2010.
Go is not a completely new or experimental language, instead it combines good things from different existing languages and software engineering principles, thereby improving on many of the shortcomings of the above mentioned languages.
Let’s make this clear with a few arguments:

1)      Go is completely free and open source, so you don’t owe Google anything (except your gratitude if you are so inclined); it isn’t bound to Google and could grow also outside of it (just like C was not bound to Bell Labs). It runs on Linux, OS X and Windows.

2)      An important design point is simplicity: Go has a familiar syntax for developers accustomed to C++, Java, and .NET, but it is very much cleaned up, made concise, less keywords and constructs but more powerful. The code layout obeys a few simple rules and is imposed by a formatting tool (gofmt), so no fruitless discussions about code layout styles anymore, and the code is very readable, which is of the utmost importance in large projects.

3)      It is a statically typed language, so most of the infamous runtime errors of dynamic languages are caught at compile time. It compiles to native code, with execution speeds at this moment superseding Python by a factor of 5 to 100, nearing C++ speeds within a factor of 2, and still improving. And it compiles extremely fast, contrary to the well known heavy compilations of C++ projects. So again well suited for large demanding projects, and accelerating the development life cycle.

4)      Go doesn’t allow you memory tricks in programming, saving the programmer from this league of errors. Programs execute in a Go runtime, which is not as heavy as the Java or .NET virtual machines, but which amongst other things takes care of garbage collection, so frees you from memory management and leaks. And it gives you reflection capabilities !

5)      At the same time Go does some type inferencing like dynamic languages, thereby reducing the clutter of declaration statements and giving it a Python-like feel.

6)      Go is object oriented, but not in the classic style of C++ / Java / .NET. Instead of a heavy weight class-hierarchy system, it uses lightweight but powerful types and exploits the interface principle to its extreme. This makes for reduced and very general library code.

7)      Functions are first class citizens in Go, not as much as in the typical functional languages like Haskell, F# or Scala, but higher order functions and closures are used widely in Go-code, also increasing its abstracting powers.

8)      Go is built from the ground up for concurrent and parallel execution on multicore and networked machines. Built in are goroutines and channels, the tools which realize a programming paradigm based on communication, not on locking.

9)      It is suited for cloud programming, being enabled in Google App Engine. At the same time it runs on ARM processors, making possible future smartphone applications.

10)   Go has, certainly also because of its open source character, a strong, lively and active community of contributors to the language, building packages or projects in it or experimenting with it. Real life examples of usage of Go in other organizations can be found at http://go-lang.cat-v.org/organizations-using-go

Give it a try. On this blog will appear more means to guide you with that.