Categories: Technologies

Go as a Modern Language for WEB

Over the past couple of years, there has been strong growth of a new programming language: Go, or Golang. Most would agree that learning a new programming language can drive a developer crazy. In spite of that, I started studying Go 4-5 months ago and I would like to tell you why I believe it is worth learning and mastering this new language.

Go is a fast, multi-platform, and effective programming language for general purposes, created by Google (authors; Robert Griesemer, Rob Pike, and Ken Thompson). Google has the largest cloud infrastructure in the world and it is still expanding. Google created the Go language to solve its own problems with support for scalability and efficiency, the same problems you will face when creating your own server. On the one hand, it has a set of standard features, which consist of programming languages, strong static typing, garbage collector, ability to manage both values and pointers (almost C-like). On the other hand,  Go language is simple, with a perfect actor-base system model of concurrency (goroutines which uses approximately 4 kb of shared memory and channels – mechanism of synchronization between goroutines). At the same time, it supports classical patterns like mutexes and callbacks. There is also a pretty entertaining pattern of inheritance (using structures), which is more transparent than the classical OOP, but a bit unusual at first. Also, Go does not require any virtual machine, as  a result you obtain source code compiled into binary.

How it works

In performance for the web (ready-made frameworks), Go ranks just under Java, C# and C /C ++ along with Node.js. At the same time, Go’s resource consumption is significantly lower than that of Java and the performance is much larger than that of Python or Ruby.

This language is compiled and statically typed. This allows you to identify mistakes long before production. For example, errors in Python are detected only by direct testing and, if there are no tests then the system is not reliable. Here errors are excluded at the compilation stage.

Thus there are two benefits, the first being the speed of compiling or running the interpreted, and the reliability of the compiled languages. The second benefit is that on top performance you have multi-paradigm (you can write code in a functional style), simplicity and low resource consumption. For these reasons Go is a good choice for developing microservices and web applications.

Here is a tip – do not be afraid of typing and compilation. In 100% of cases, you do not have to declare a type as a variable in the code – it is set automatically when you assign it a value. You do not need to declare variables in advance. It is necessary to point out that Go has good packages for web development out of the box.

 

Is it worth learning?

This is a question that can be answered briefly and definitively. The Go language is absolutely worth learning.

  • First, because this is one of the simplest languages to learn. There is hardly any  grammar and abstractions in Go, so you can master it at the initial level over the weekend. Of course, the language has a lot of holes and traps,  but they are  quickly resolved.
  • Second,  Go is beginning to permeate our daily lives. Over the past year alone, a lot of projects have been written on Go in github and more and more corporations have started to use it. It is awesome to have such a popular tool in your knowledge base.

Today many Google services were  written in Go: SPDY proxy for Chrome on mobile devices, download server for Chrome, Android SDK, Google Earth, YouTube Vitess MySQL balancer. Also the Go language is used by Docker, Kubernetes, Heroku, Amazon, Tumblr, and SoundCloud.

Benefits of Go

Though Go differs greatly from other object-oriented languages, it enables you to have the high performance of C/C++; the enjoyment of coding like Python/Perl; and profound concurrency handling like Java. I would recommend learning Go because limited hardware causes developers to write a very efficient code and they must know the hardware and optimize their program according to it. As a result this optimized software works on cheaper and slower hardware like  IOT equipment and eventually brings benefit to the end user.

Here are some resources recommended for learning Go:

Leave a Reply

Your email address will not be published. Required fields are marked *