Advantages And Disadvantages Of Golang (Go)
Go, often referred to as Golang, is an open source programming language from Google, and made its first stable release in 2011. Robert Griesemer, Rob Pike and Ken Thompson first initiated the design for Go in 2007, and it was open sourced in 2009.
Point to note: Golang is inspired from languages like Modula, Smalltalk, Oberon, Algol, Pascal, C and Newsqueak.
The programming language is inherited from Oberon language, while the syntax was inspired from C, the OOP from Smalltalk. The concurrency was taken from Newsqueak.
It’s time to Go
The main reason why Google’s Golang became so popular is that it presented a few good advantages when compared to other fast languages, for example, C.
Go combats these problems to a certain extent and does provide some advantages to the user. Of course, there are some cons as well, after all, you have two sides to the coin.
1) The credentials
Google finances Golang. And it has some real geniuses as its creators, Robert Griesemer, Rob Pike and Ken Thompson are already known for their contributions in Unix, JVM, C, B etc. Interestingly, the belief is that the language was built to combat the problems of the past, and to anticipate future challenges.
2) It’s easy to learn
If your team of developers are looking to shift from their old language to a new one, Go would be a good choice because there is only a slight change in the syntax, as it looks almost similar to other learned languages. The documentation is also easy to follow. The team can master it within a matter of few weeks, sometimes even hours if you are using the standard library. Writing a simple command-line app and simple HTTP server is all a piece of cake.
Concurrency is notorious for being difficult, but luckily with this open source programming language concurrency is tractable and very easy. The developer can finish the requests faster, freeing the resources for hardware and network much earlier.
4) Open source by nature
If there are any issues, gophers, as the Golang developers are called, will detect and correct the issues, so they are easily solved before they become an issue.
5) Garbage collected language
The language makes it easier for the developers to perform activities like memory management. It handles all the runt work by itself.
6) Static code analysis
The programming language completely depends on static code analysis. For example, godoc for documentation, glint for code style listing, gofmt for code formatting and so on. The Go tools are implemented as stand-alone command line applications, so they can be integrated easily with any coding environment. The language does a good job of static code analysis, and it covers your back, so that makes it trustworthy.
7) Comes with built-in testing tool
Developers love the fact that the language comes with a built-in testing tool and the fact that it has the simplest API. The efficacy of this tool makes it easy to test and profile executable codes. Advanced features like running tests in parallel, marking the tests and so on are also available.
8) The language is fast
The simple structure and syntax is definitely an advantage, and developers find it easier to learn. Additionally, it is devoid of type inheritance and classes. This makes it easier for you to release a product in the market quickly, and even better, maintain it.
9) Compiled directly to machine code
As Go has no Virtual Machine, it can compile directly to the machine code, if you can exclude Go’s intermediary assembly. This makes it really fast. Additionally, you can compile cross-platform to Windows, Android, Linux and many more.
10) Cute mascot
If looks present some significance to you, you will fall in love with the cute gopher mascot that is the identity of the language.
A few companies that already use Go:
- The New York Times
- The Economist
According to Tiobe Index, The Programming Language Hall of Fame went to Go in 2016. Check the image below:
GitHub also presents the list of popular programming languages. Go is in the first 15. Check it below:
1) A young language, so it is still developing
Being a very young language, developers might find it difficult to make maximum use of the libraries. They might have to write the libraries themselves and there aren’t many books or online courses to help, while in doubt.
2) Absence of manual memory management
Manual memory management is important, and the lack of it could lead to overhead garbage collection, issues like pauses, which in turn could lead to system programming.
3) Too simple
The simplicity of the language could be an issue, as it makes it superficial. And in an effort to make it simple, the language wasted several years of programming language progress.
4) Error handling isn’t perfect
Though error handling is not perfect in Go, the imperfectness of it could get you. Solutions are still being searched for, and proposals have come up for error handling.
5) Runtime safety is not that good
Go is safe, but it doesn’t deliver the level of the safety that Rust provides. The safety level is compile-time only and to a certain extent runtime. Go focuses on the speed of production, and Rust concentrates on the safety aspect.
Other cons include operator overloading, and problems in code duplication and metaprogramming because those cannot be statically checked.
Go is definitely a good choice when you are on a new project, or planning to improve the next one. Once you get used to the Golang development, you can make it mainstream, because its advantages are far superior when compared to the downside.
It helps you build complex apps in the timeline and budget and can easily handle 1000 concurrent requests per second, which can be notoriously difficult in other languages. After all, you can build your own products without using any third-party services.
Picture Source: Flickr.com/ Waldherr/ tshein
The author: Reema Oamkumar is engaged as a thought leader at www.Software-Developer-India.com which is a part of the YUHIRO Group. YUHIRO is a German-Indian enterprise which provides programmers to IT companies, agencies and IT departments.