Why you need to learn Go

Since its public release in 2012, Google’s Go has grown in popularity at an impressive rate. In 2016 it became TIOBE’s programming language of the year, confirming its status as a go-to language for fast-moving projects. But what’s the reason behind its success?  

Mina Andrawos, is someone who understands the appeal of Go more than most. He first used Go in 2013, learning the language in his spare time by building simple projects but quickly found that Go was useful for tackling more complex challenges. Andrawos’ experience and love for Go led him to work with Packt to create the video courses ‘Mastering Go Programming’ and ‘Modern Golang Programming’. With these courses he was able to share his knowledge with other developers and engineers – and perhaps played a small part in its huge success over the past few years.  

Andrawos cites Go as a key language for a world in which the way we build and deploy software is changing rapidly thanks to trends such as microservices and containerization. It’s a language that is well-suited to the changing nature of today’s tech stack. This means its impact can’t be ignored by software engineers.

But if you’re still not sure what the fuss is all about, Andrawos explains the key reasons why Go stands out.  

Less code, more performance  

You can build performant applications in Go with less code than the equivalent Java or C# application. Applications written in Go don’t need a language runtime or virtual machine to run like Java or C#. Go is cross-platform and can even run on numerous operating systems including low powered platforms. Compared against dynamic languages like Python, Ruby, or Javascript, Go applications are always much more performant and easier to deploy.   

A unique philosophy  

Go follows a unique philosophy to building software that is different to almost all mainstream programming languages like Java, Python, or C#. This invokes a new, but powerful thought process to address challenges in software design. Go, for example, doesn’t have the concept of ‘classes’, however you can still write object-oriented code in Go by making use of types and interfaces.     

In Go, interface inheritance is not explicit, as in you don’t need to explicitly say that ‘object A’ is a child of ‘interface I’. The language would internally build this relation from the methods that are implemented by ‘object A’. Go also approaches the concept of concurrency quite differently than most popular programming languages. It encourages ‘communication’ between concurrent code instead of sharing memory.   

An easy money-saver  

A key demand in the software industry that never goes away is the need to write software that can handle large amounts of load while saving costs and time. I think one of Go’s key differentiators is its ability to build performant applications with less development time, as well as the ease of deployment of Go applications. This provided benefits for both the open source ecosystem as well as backend software for modern enterprises.    

Go’s ability to handle large amounts of load with less memory and CPU cycles translates into savings in servers and hardware costs. There are stories of organizations going from 30 servers to just 2 handling the same load by migrating to Go. Imagine the cost benefits for your projects, your start-up, or your enterprise!!  

It can go it alone  

Go is cross-platform and needs no virtual machines or any additional software to run in the target servers. You just build your Go application, obtain a native binary for your application that targets your platform of choice, then you just copy the binary to the target server and run it! This ease of deployment makes Go a prime technology to utilize when building microservices and distributed software.  

Go enjoys a standard library that provides tons of features out of the box to build modern software applications; you can build web servers, communications software, encryptors, or applications that support JSON and CSV without needing any third party packages. 

Enabling innovation  

For the open source ecosystem, Go empowered the creation of new bold open source projects like Docker, Kubernetes and Ethereum, among others, which made use of the language to revolutionize the software industry.    

For modern enterprises, Go enabled companies like Google, Uber, and even SpaceX, to build modern backend software to power their future ambitions while keeping their developers happy and engaged.    

Feel like giving Go a…go? Here’s what you need to know  

Go adopts a different approach to software design in general than what would be considered common practice in languages like C# and Java. For developers to migrate to Go and start building efficient software with it, they will need to first learn Go’s special building blocks like structs, slices, goroutines, and go channels among others. They will need to invest some time reading about Go’s concurrency patterns which - in my opinion - is very important to understand when it comes to building sophisticated applications in the language.  

The concept of ‘slices’ is very important to learn in Go, because when not used the right way, some memory leaks might occur. Slices serve as the dynamic arrays in the Go universe. 

Another worthy mention is the need to understand how inheritance and object orientation works in Go. In Go there is no concept of ‘classes’. Most developers are also used to the idea of long inheritance trees where classes keep inheriting other classes. In Go, this works differently, as you can either implement an interface or you can ‘embed’ a type inside another type. But you won’t have n classes all inheriting each other like in other languages.  

Go is a fun and easy to learn language that allows you to build very sophisticated and performant applications at the fraction of the time it will take to build a similar application with Java, C, C++, or even C# - why not give it a try?

Mina Andrawos, Engineer and Author at  Packt 

Image Credit: McIek / Shutterstock