Why Go?

in Development

Today, we are happy to announce the launch of our new Go course, On Track With Golang! In this course, you’ll learn how the Go programming language can help you quickly and efficiently leverage the power of modern computer architectures and systems programming.

In this post, we’ll talk about three features that make Go a language worth learning: the Go compiler, static types, and concurrency.

The Go Compiler

Go is a compiled language, meaning we must run our source code files through a compiler that reads source code and generates a binary, or executable, file. This executable file is used to run the program.

Source source compiling into an executable

Examples of other popular compiled languages include C, C++, and Swift. Programs written in compiled languages are transformed into low-level machine code and can perform extremely fast. Compare this with interpreted languages, like Ruby, Python, and JavaScript, or even languages that generate byte-code, like Java and Erlang. In order to run programs written in these languages, we need access to all of the source code files, and a runtime environment must be installed prior to execution.

With Go, that’s not necessary. We can simply tell the Go compiler which machine architecture our program will run on, and it will generate a single, self-contained executable file for us. This means that in some cases, deploying a Go application to production essentially involves moving an executable file over to our production server.

Static Types

If you’ve written code before, then you’ve definitely worked with data types, including numbers, strings, and booleans. In Go, operations with data types are validated during the build process before we run our program. This leaves less room for unexpected surprises during runtime and places Go in the category of statically typed languages.

Static types can also help our programs use memory more efficiently. By assigning specific data types to our variables, the Go compiler can determine ahead of time exactly how much memory space is needed to store values assigned to those variables.

Concurrency

Many existing languages support concurrency and parallelism by working with operating system threads. Sadly, working with threads is also very complicated. To address this issue, the authors of Go decided to make concurrency part of the core of the language. Using goroutines, which are special functions capable of running concurrently with other functions, we can write concurrent code in a much simpler level of abstraction. We never have to deal with threads or manually share memory. Instead, Go provides built-in data types that allow us to “share memory by communicating across goroutines.”

These are just three reasons why I believe you should learn Go. Play our On Track With Golang course to start learning Go today, and let us know what you build in the comments below!

Code School

Code School teaches web technologies in the comfort of your browser with video lessons, coding challenges, and screencasts. We strive to help you learn by doing.

Visit codeschool.com

About the Author

Carlos Souza

Developer, Instructor and Metal aficionado.

Might We Suggest