Wednesday, June 30, 2010

First Impressions of golang

Another language? 
Yep golang or just go depending if you want to find anything from a search result. For me I write mainly in Python, Java, Javascript. Python as my GOTO (pun intended) language because I can write thing extremely quickly and sometimes even cleanly. Java for embedded platforms and GWT. Javascript the language of the web so that mean almost all developers use it (or should be). It is inevitable that a new language will replace older ones but I think there are two things that might have delayed the creation of golang and ultimately what I intend to use it for.
The first and largest is if Java continued to evolve not just its libraries but significant syntactical changes. Java from a completeness of implementation is great and the toolset is wonderful. Java requires way to much code volume. Code generators help however the code that is not generated has to access a majority of the generated code and no matter what there is a feeling of bloat. All the performance improvements in Java have yet to make development feel faster.
The second thing is Objective-C lack of popularity. Maybe because like Darwin it has a kinda of open source aspect to it but really the only significant implementation is proprietary implementation by Apple. Even though the IPhone has help its popularity it has reduced it openness and reduced its ability to become a general purpose language.
Golang fate could be similar because Google could be the Sun of Java (even more bad punning) or the Apple of Objective-C. Golang is not currently on that projection but I would not rule it out as a possibility.
Golang's Niche
I would like golang to replace everything I use Java and Objective-C. There is a lot of Python code that I think should be in a statically typed language but for various reasons mainly time I will note rewrite but golang would be great. Even though golang is very productive to develop in for a static language, on occasion my face slams into STATIC TYPE. For real stable API's that could have a real a large amount of dependent code I can see it will fit nicely. Until I get proficient with it I am going to try to keep working with it on simple projects.
Tasty Features
Terse Syntax
With exceptions of languages like Perl less typing is better. Golang shines in this manner. It is the most terse static typed language I have ever programmed in. Refreshing from a Java perspective and surprisingly close to Python.
Type System
I must say I really loved C when I first learned about stucts and header files to define functions. There is something really solid about the type system that I haven't felt since a C header file except more terse. Make me never want to see another Java interface in my life.
I am a bit of a server performance geek and well what can I say channels are just awesome. I have yet to write any code with channels but it is one of the things I am most excited about. I plan to use it when I write a golang driver for Riak. I would like to write a WSGI inspired web server in golang that I could access from Python and that is where I look forward to testing the mettle of channels.
When it come to code it is all about "hitting the ground testing". The development tool gotest makes this fast and easy.