5 Reasons for Programmers to Consider Go/Golang

Thinking about adding a new programming language to your toolset? This article describes several reasons why Google's Go may be a great option.

The Go programming language was a language built inside of Google to solve a few specific issues [2][4], but has since found widespread adaption outside of the company. Learn why Go might be the perfect tool to add to your programming repertoire. 

1. Developer Efficiency

The popularity of dynamic languages like Python and JavaScript has risen primarily due to their ability to have developers easily pick up the language and develop complex applications with them quickly. Go looks to achieve some of the same simplicity of getting started as well as the ability to create complex applications where the onboarding process is simple. The go development team strived for a language where repetitiveness is kept to a minimum while allowing high levels of expressiveness. An interesting fact is Go was developed by primarily C++ systems developers with ease of use in mind [4], however, with the last developer survey, they found Python and JavaScript developers to be at the top of the list of developers switching to Go [3]. They also found that Web Development is leading the way as a use case followed by systems programming. Simplicity is seen in the language from the most basic elements including variable creation. Go is a statically typed language like C++ or Java with duck typing for variable creation and assignment. Duck typing is typically a feature left for the dynamic languages. Fans of dynamic languages occasionally describe languages such as Java as verbose. There are many benefits of a statically typed language such as compile-time type checking. Go looks to take from a number of lessons learned and incorporate them into a modern programming language built for productivity. An example below shows a new variable is created named “variable” of type int which is determined since it is being initialized with an int.

Simplicity is also seen in some of Go’s more salient points. Go does not do “typical” Object Oriented Design(OOD). Since OOD’s inception it has been seen as a cornerstone of software development patterns specifically emphasizing in information hiding, encapsulation, and polymorphism. Languages like C++, Java, and even Python emphasize their usage for what’s considered high quality software for each language. Although OOD is an extremely popular design pattern it is not the only approach for quality software design. Composition is another pattern that can be used and is the pattern that is encouraged with Go. It also implements some language features that bolster this approach. An example of this is how Go uses interfaces. There are two primary approaches to how this can be used. Typed Interfaces and un-typed interfaces.

Typed interface (From example in [5])

Untyped Interface

https://gobyexample.com/interfaces and http://jordanorelli.com/post/32665860244/how-to-use-interfaces-in-go both do a great job breaking down interfaces. The key take away is you can define interaction with code yet to be defined. These construct’s free developers from chicken or the egg scenarios the can bog down or complicate designs.

2. Team Efficiency

This concept is often forgotten about when comparing languages. When writing complex software, it is seldom done alone. The easier it is to onboard new team members the easier it is to get productivity against your bottom line. Some legacy languages are straightforward to learn and easy to write in such a way only a “tribe” of people easily understand. The concepts around “Idiomatic Go” have arisen to keep Go code readable and easily assessable. These concepts are practiced throughout the standard library, and when possible codified into tools such as “go fmt”, and “go vet”.

3. Fast Compilation

This one is especially appreciated by former C++ developers whose projects have grown to significant sizes. Long compilation time can be an efficiency killer for any developer cycle.

4. Managed Run time dependencies

Built go code results in a file. Your Go binary. The same source can be built to run on a wide number of systems and what’s most interesting is everything the binary needs is self-contained. These means the binary does not rely on the state of the host system and cannot conflict with the software packages already installed. From a deployment perspective, this makes go a breeze. No install scripts, packaging dependencies, worrying about conflicts, or run-time package incompatibility problems.

5. Rational Concurrency

Concurrency has been handled in the same core ways for a while. Message passing or data sharing. Major libraries such as MPI (Message Passing Interface) and POSIX Pthreads have been common patterns for achieving concurrency. Pthreads uses the shared data model while constructs such as MPI follow the message passing model. Go opts for a message passing model through its goroutine and channel constructs. Rationalizing about concurrency is much easier with these building blocks. While, they do not remove the need for synchronization and synchronization-based constructs such as atomic operations, mutex’s, semaphores etc., proper use of Go should minimize them

Have we convinced You? What do you love about Go?

Let us know in the comments below!

 

References

2018-07-24T11:28:17+00:00

Leave A Comment