Golang: An Introduction

Golang - An Introduction

Recently someone asked me, “So, what is Golang, anyway?”

Simply put, Golang — a popular nickname for the Go programming language — is an open-source language developed by a team at Google, along with outside contributors from the open-source community, and released in 2009. The idea behind it was to create a language that combined the development speed of a dynamic language, like Python, with the performance and safety features of a compiled language, like C or C++.

My colleagues at Primitive Logic and I have used Golang coding in numerous projects across several different industries. For example, we used it to build new modules for a client in the staffing industry that reduced maintenance and support costs. As a result of that project, we improved IT’s ability to support business needs and enhanced the data provided for strategic decision making.

What Makes Golang Different?

I find that Golang makes it easy to build simple, reliable, efficient software, and there is a huge change in syntax compared to the basic Java language. Golang does not require any initialization, definition of the type of the variable, or definition of the type of the output data from its methods. It supports polymorphism through interfaces that can be implicitly implemented.

How Popular Is Golang?

GitHub recently performed an analysis based on the pull requests they receive throughout the year, and Go ranked as the sixth most popular language, up 7 percent from the previous year. The Golang developer community in China is growing dramatically, and companies like Alibaba and Huawei use it heavily in their production stacks.

Golang's rising popularity can also be seen in an escalating number of Google searches for the term:

Golang searches in Google 2009-2018
Source: Google Trends

Why Do Developers Love It?

My fellow developers and I appreciate Golang for its simple sophistication. If a directory shares more than one .go file, for example, all the methods and variables are available across all the files in the entire package, even the private ones. Golang will also auto-space every line as you code, so you don’t have to worry about where your curly braces are located.

Of course, Golang has its limitations as well. It does not support, for example, overloading operators, overloading functions, optional parameters, or exceptions. These omissions result in a code that is easier to create since it is less abstract.

My colleagues and I would describe Go as a clean, elegant language. It’s less verbose, which makes it easier to call libraries. It compiles to a single executable, which makes deployment easier, and compilation does not need complex XML configuration — just go build. I find Golang's compilation speed to be quite fast, as no VM is needed to execute, and garbage collection is pretty good.

Another feature I appreciate about Golang is its support for concurrency — running sub-program components at the same time — using goroutines and channels. (Goroutines can be initialized and implemented by using f(0) in the programming code.)

Server Side IO Performance

Source: https://peabody.io/post/server-side-io-performance-node-php-java-go/

Who Uses Golang?

The Go programming language is used extensively in building blockchains, requiring as little as 200 lines of code. Other companies that use Golang are Adobe, BBC, BuzzFeed, Dell, Facebook, Novartis, Uber, and Yahoo.

Golang and Primitive Logic

While no one programming language is a perfect fit for all situations, my colleagues at Primitive Logic and I have discovered that Golang works quite well for certain types of projects. For example, if you need multithreading (simultaneous accessing of data from a common database through multiple connections at different phases of execution) for a client-server chat application, Golang might be a good option to consider. It also offers huge advantages in situations in working with modules where concurrency is a bottleneck, and its speed of compilation makes it well suited for DevOps applications.

If you have questions about how Primitive Logic’s developers leverage the latest approaches to help our clients succeed, just give us a call.

Mohammed Zubair is an experienced software developer with a proven history of delivering results in the big data industry. He is skilled at building ETLs in Hadoop and programming in Golang and Java.

Mohammed Zubair, March 2018