The aim of this article is to tell about a programming language Go (Golang) to those developers, who are interested in it, but haven’t risked studying it. The story will be told on the basis of a real sentence that represents RESTful API web-service.
I had a task to develop a backend to the mobile phone. The service is quite simple. It’s a mobile application, which shows posts of the users that are near the current location. Users can leave their comments to the posts and they can be commented as well. It’s like an original geo-forum.
I wanted to use the Golang in some serious projects. The choice was obvious. This language is extremely suitable for such tasks.
Main Golang advantages:
- Simple and clear syntax. It makes code writing a pleasant task.
- Static typing. Allows avoiding mistakes, made inadvertently. Simplifies the code reading and understanding. Makes the code unambiguous.
- Speed and compilation. Go performs much better than other scripting languages, while consuming less memory. The entire project is compiled into one binary file, without dependencies. And don’t worry about memory management since there’s a garbage collector.
- Step away from the OOP. There are no classes in the language, but there are data structures with methods. Inheritance is changed by an embedding mechanism. There are interfaces that don’t need to be completely implemented. You just need to implement the interface methods.
- Concurrency. Concurrent computing made easy, smart and without a headache. Go routines (something like threads) are light and don’t consume much memory.
- A well-stocked standard library. The language has everything necessary for the web-development and even more. The amount of exterior libraries grows all the time. Besides, you can use C & C++ libraries.
- Possibility to write in functional style. There are closures and anonymous functions in the language. Functions are the first-order objects. They can be transferred as arguments and used ad data types.
- Trustworthy Founding Fathers and a strong community. Rob Pike, Ken Thompson and Robert Griesemer stood at the origins of the language. Now it has a strong community and constantly develops.
- Open Source
- Charming mascot