I’ve been programming in Go for a couple of years now, and while it took a little warming to in the beginning, it has become my go to language of choice for its speed, reliability and overall productivity. I’ve used it in projects both big and small, and it has yet to let me down. I’ve picked a few of the things that make Go stand out for me, and that really sum up what makes Go a pleasure to code in.
Robust standard library
A lot of languages and their ecosystems have a level of "third party library" institutional knowledge. "Oh don't use the built-in CSV parsers, use FastCSV". "You're using Thin? You should be using Unicorn". "You're using Node? IO.js is where it's at". This sort of fragmentation is generally due to a less-than-perfect implementation of standard library features, and creates a high barrier to entry for a language. The Go language is renowned for having a rock-solid Standard Library. More often than not, the standard library contains all you need to write your applications. For example, it has a built in 'http' stack that can serve your web applications without breaking a sweat – Google’s download service (dl.google.com) uses this library to serve up Chrome, Earth, Android SDK, and other large Google downloads.Static typing
Coming from a dynamic scripting past (PHP and Ruby) I was initially wary of a statically typed language. After the first frustrations around updating function expectations and returns, I now fear going back to dynamic typing. The type checker is capable of picking up incorrect function names and type assignments. Because I no longer have to write tests to assert the error behaviour of my code when wrong types are supplied, nor check that a method name is even correct, my test suites are able to focus on the expected business logic, not these basic assertions.Fast compilation
Not only is Go a fast language, but it’s optimised for compile time. In reality this means your Go binaries should compile in two or three seconds. This is a serious win for developer productivity. The ability to quickly switch between code and command line when writing applications is extremely important. If a compile takes significant time, it throws a developer out of their flow. Even 10 seconds is enough for your brain to switch off; you switch context and open Reddit or Hacker News, then sometime after the compilation is done you remember to go back and see the results. This constant context switching is not something humans are great at, and your overall productivity is not the best it can be. I've managed to avoid this in Go.Continue reading %Why I Love Programming in Go%
by Mal Curtis via SitePoint
No comments:
Post a Comment