Saturday, September 11, 2010

Introducing Go

I think that for many of those from the climate change blogs, Go is a new language that will be needed for this project. In this post, I will introduce the basic concepts of the language. I will point out however that the best place to learn more about this language is through their website (in particular the tutorial and the effective go page). Also some of the blogs on the blog roll have some particularly good articles about Go, especially Andrew Gerrand's blog.

Go was developed at Google and released as an open source development in November 2009. The designers (Robert Greisemer, Rob Pike and Ken Thompson) have quite a pedigree and many were excited just by the fact of who designed the language. Since then, a strong community has grown around Go and many people are finding that it is quite powerful and expressive.

Some of the basic features are that it doesn't have classes like C++, but you can create methods attached to c like structs. This allows some of the functionality of objects, without the complex type heirarchies. In the same line of thinking, there is no inheritance in Go. There is an interface declaration however, that allows similar constructs to be built and yet be quite simple to use as well.

Another feature of Go is it's Concurrency constructs. It has a keyword to launch a small lightweight thread of execution. This is called a goroutine and it allows a parallel thread of execution (see the go site for details of it's implementation). Go also has a channel type in order to pass information between various goroutines.

The interesting part about goroutines and channels, is that it allows a programmer to define very concisely the work needed to be done by any given goroutine, and also defining it's interaction with other goroutines through the channels. The real strength of these concurrency constructs is they provide a manner to logically describe the work that needs to be done. I'll try to add some examples applied to some GCM calculations and how these constructs can link together to be very powerful.

There are a few aspects of go that could be troublesome for this project however. Go is a Garbage Collected language. Generally I think this is good, especially in a concurrent language like Go, however there are some issues related to high performance calculations where it could be a nuissance. It will be something to pay attention to and I'm hoping to get some help from the current Go community to tackle these issues.

Another issue (right now) is that go's support for windows is not complete. While there has been some great strides, the best bet to run Go is to run it on Linux or Mac. This is being actively worked on by the Go community and I'd expect it to improve rather quickly. I'm quite hopeful that by the time there is any meaningful coding happening on GoGCM, the windows support will be a non issue.

I'm certain there will be other issues as the project moves forward, however I truly believe that the benefits of Go outweigh the issues. I'm looking forward to learning more about Go as others get their feet wet and take on the various challenges for this project. I encourage those who want to learn go to look at the documentation on their website and to engage the go community. I think you will find it well worth the effort.

My next post will be in the next day or two and will discuss the strategy of GoGCM. How will the design be fleshed out, how it will be compared to other GCM's (will it be baselined to an existing model) and what will it try to achieve.

No comments:

Post a Comment