One of the things I really like to do is learning new languages. So after leaving it on the back burner for almost a year I decided to really concentrate on the Mark Summerfield’s Programming Go book that I had since before printing (I had like 4 different rough cuts that I never started reading for serious). The book is very good, and is doing a fantastic job on giving me the basics on the language, and I am starting the more advanced chapters and not feeling totally lost.
Go contrasts a lot with the ones I use day-to-day (mainly python and ruby). It’s statically typed, compiled and uses pointers, so the growing pains are understandable. Like trying to print an URL but discovering that you can’t simply wait for the language to cast that down to a string automatically. I still get a lot of compiling errors just because I try to skip steps or use the wrong type on the wrong part.
There are some nice parts. Go doesn’t really do exceptions (unless it’s an exceptional behavior), so the traditional ‘ask forgiveness later’ thing will not help here. What Go and it’s standard lib and the good 3rd party libs do is always return at least an error code on it’s functions. So most of the time you will have things like this:
1 2 3 4 5
So you catch errors as they happen, instead of catching an exception 4 levels higher with a lot of crappy stack trace. Error messages in the Go standard library are also very good, no more cryptic voodoo and Googling just to discover wth is that message.
As soon as I got a little confidence on at least how to organize a Go program I decided I wanted to try and start doing some small things, some book exercises and what not. So I got inspiration from XKCD and created the Is it creepy? site. Want to know if that person is too old or too young for you? Check it.
Note that the code is available on Github so if you want to check how Go looks, go ahead. Remember that this is a first program, and also that I over engineered some simple parts to check more advanced techniques (for my current level). Now I have some more ambitious plans for projects, but those will need to wait a little more reading and practice.
Thanks to Yves Junqueira, that annoyed the hell out of me until I finally started putting effort in learning the language.
PS: Changed the theme to light solarized. I like it.