Meet Golang: An Introduction, and Why It Looks so Attractive

As a curious and passioned developer, I like to keep my skills up-to-date with the latest trends and technologies. Often I find my self staying up all night to try a new language or platforms…

Recently I lost a couple nights of sleep to do some experiments with Go, a language that is growing in popularity and that sounds really interesting. Created by Google in 2009 as an open source project, the version 1.0 has seen the light in 2012.
Go is a C-like family, but he had some unique features that deserve to take a look at.

Why Go?

According to the official website, […] Go was born out of frustration with existing languages and environments for system programming […] Again from the same source, Go is an attempt to take the ease of interpreted, dynamically typed languages (like python) with the efficiency and safety of a  statically typed, compiled language.
Go is designed to be fast; it provides built in support for networking and  multicore computing; it has a lightweight type system, concurrency and garbage collection by design.
For many reasons (simple type system,no type inheritance, simple grammar parsing, etc.), compiling a Go program is well optimized and efficient, especially when compared to C++.

How Go programs are compiled and run?

This point caugth my attention. Unlike Node or Dotnet Core, Go programs doesn’t need any runtime or environment to be installed.
Go programs are compiled ahead of time to native binaries. Each go binary includes a language library that acts as a runtime providing stack management, concurrency, garbage collection and other services required by the language itself.
Being all this stuff included in the executable, Go programs doesn’t need a virtual machine or a runtime to run.

Concurrency rocks in Go

Concurrency is  one of the most attractive features of Go.
It’s based on a dedicated primitive called Goroutine, a lightweight execution context that is multiplexed among several threads managed by the Go runtime. This relieves the developer of any complexity when dealing directly with kernel threads.

Go is a Technology Enabler

Thanks to its core architecture and design, Go is a technology enabler. With Go, using many modern technologies and tools is a breeze. It plays very well with containerization and fits perfectly many modern programming techniques, like Microservices.

Objects in Go

Well, if you search on Google about this point, you’ll find a lot. Go has not been designed to function as a traditional object oriented language, so you won’t find classical OOP implementations behind it.

Go fully supports objects idioms and the practical application of OOP but without the heavy load of classical hierarchies and complex inheritance structures. Inheritance has always been a debated point in OOP (because of the risk of writing long tail of classes) and Go follows the modern approach of object composition over object inheritance.

Go has no explicit definition of classes. A class is implicitly defined by writing a set of methods (functions) which operate on a shared type.  The type may be a struct or an user-defined type.

See it in action:

 

Conclusions

The project itself is rapidly growing: despite of its short existance, Go has a notable collection of libraries that covers a wide range of topics, making it really attractive to developers.
Its maturity in the development life-cycle is well represented by a rich set of built-in tools.
Thanks to the valuable effort to make complex things easy, and all the above listed points, Go is becoming more and more popular among developers and cloud providers.
Apart from the initial excitement for exploring new things, I believe that Go can really be the next  new language to learn.


Image credits:

The Go gopher was designed by Renee French. (http://reneefrench.blogspot.com/) The design is licensed under the Creative Commons 3.0 Attributions license. Read this article for more details: https://blog.golang.org/gopher

Leave a Reply

Your email address will not be published. Required fields are marked *