Thursday, July 5, 2012

Trying Go

Go What?

Google I/O just finished last week and one of the more interesting announcements for me was the official version 1 release of Go (or golang).  I've been keeping tabs on this programming language for a while because my team is challenged by a flux of massive amounts of data.  A modern programming language that natively supports concurrency seems like a good candidate for our processing systems.

Right now, our backend is a library of several programming languages, but most of it is in Python and C.  Some people called Go a good mix of Python and C, so having something in between the high level Python and the low level C is something worth exploring.

Initial Impressions

The last time I coded in any flavor of C was 10 years ago, with Python (and a little bit of Perl) as my main programming language for the past 10 years (and it is only on occasions when I need to code, I'm originally a reverse engineer, so it's my job to de-construct software, not build it).

If you're expecting Python-like syntax in Go, you'll be disappointed (like I am).  The syntax and programming convention is very much like C - curly braces, pointers and all.

If you're used to Python's implicit type conversions (list items can be treated as strings), then again, you'll be disappointed.  Go has very strict typing, and converting a list item into a string is the first wall I hit playing with Go.

Go is also very strict with imports and unused variables.  It just won't let you compile if you declare a library/package or variable that you didn't use.

But other than these initial eccentricities, Go is a language that is easy to play around with.  I already have around 150 lines of  Go code in 2 days of converting a 50 liner Python code.  And during this time, I'm already playing around with concurrency within Go.

As expected for a young language, documentation is not very detailed and sample code is not abundant.  This is probably my major gripe against Go at this point in time.

Lastly, I'd like to link to Graham King's article on darkcoding.net about his experience with Go, which is a very good summary on things you should and should not expect from Go.  I suggest you go over and read it to check if Go is suitable to your requirements before you invest in the time it takes to explore Go.

I'll be blogging about my adventures in Go in the next few weeks so stay tuned if this is something that you fancy.

No comments:

Post a Comment