Ready, set, Go! A discussion of Go as a backend technology

In the past few years, Ruby on Rails has long been considered one of the most standard backend technologies — however in the past few years there has been a shift towards using more Golang or Go as a backend technology. This article aims to discuss the advantages of using Go, from the perspective of a software engineer new to Go that is finally making the shift from Ruby on Rails.

What is Go?

Go is a programming language designed by the Google employers Griesemer, Pike, and Thompson. The intention for creating the open-source language we know now as Go — is that Google needed a faster language. The developers at Google were maintaining literally zillions of lines of code and updating that code, and the time needed to continually upload that code into programs that were deployable was substantial. According to the Golang website the mission was to “eliminate the slowness and clumsiness of software development at Google, and thereby make the process more productive and scalable.” Thus Go was born. Now it is described as “ a compiled, concurrent, garbage-collected, statically typed language developed at Google.”

Go has caught the attention of many developers because of the features including garbage collection and the language’s abilities to take advantage of multi-core computers. These features that combine to create one of the fastest backend technologies to date. Additionally, many developers with a background in C or Java have been able to adopt the technology pretty easily as most of the procedural approaches are very similar, even if the syntax and keywords are just a little different.

Why am I switching?

In the past, primarily I have used Ruby on Rails for the construction of backends for my projects. However, after reading a studio’s test results about the average amount of seconds that that Golang can save you in usage compared to Ruby on Rails, I’ve definitely been more attracted to use of the technology. Golang can allow you to avoid speed-constraints you will often find in thread-based technologies. It can make those clunky projects faster, and making the change isn’t that difficult if you have a background in Java or C.

First impressions:

Go may have some syntax issues to grasp — but a lot of the concepts really are the same if you have a background in Javascript or Java. For example, using a for loop in Go actually looks very similar to a for loop in Javascript:

A for loop in Go:

for i := 1; i < 5; i++ {

}

A for loop in Javascript:

for (i = 0; i < 5; i++) {
}

Though there are small syntax changes, a lot of the construction of these basic loops is the same.

In addition, variable declarations are incredibly similar in both languages. Instead of using let, use var to declare variables in Go.

Declaring a variable in Go:

var name = “Hope”

Declaring a variable in Javascript:

let name = “Hope”

Even function creation is incredibly similar.

In Go:

func returnOurValues () (first string, second int) { 
first = “How many cakes do we have?”
return
}
//Returns "How many cakes do we have?" and 0
var first, second = returnOurValues()

In Javascript:

function returnOurValues () { 
let first = “How many cakes do we have?”;
let second = 0;
return {first, second};}
let {first, second} = returnOurValues();

Though in a Golang function, arguments and their types have to be declared after the function name inside the parentheses, the construction of the function looks very similar. Variable declaration is similar as well and the return process differs in syntax but conceptually is the same process. “second” in the Go function will return 0 because variables set without an initial value are set to their zero value, which is 0 for integers.

CONCLUSION

Go can really improve the speed of your programs, and it is a transition most programmers can find really easy due to the procedural similarities with Java and C. This week I began to delve into Go from a very shallow perspective, but I do plan to transition one of my biggest programming projects (The Spotify Demo) to the Go backend technology in the next week. If this article peaked your interest in Go, be sure to check that out! If any of you are interested in a full tutorial involving Go or have any other requests/suggestions, leave a comment or contact me through my Linktree!

Audio engineer with 8+ years of working with Grammy-winning teams, full-stack engineer specializing in React/Redux and Javascript. https://linktr.ee/hopegipson

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store