To Go or not to Go.
GoLang from the Perspective of C and Python Programmer.
Introduction.
Why Python?
One of the most popular languages today is Python. And with good reason. You don’t need to have so much boilerplate code. The code itself can be semantically understood. The best of them all? There’s modules for every little thing.
With the release of Python 3.7, there’s even more that Python can do. It can be used for Asynchronous programming using ‘aync/await’ structure — something which was Javascript’s yard until now. The only disadvantage that you can have when using a language like Python is speed. It’s common knowledge that Python is almost 5 times slower than C++.
C- the Granddaddy of Programming Language.
C is one of the oldest programming languages. It is still included in Course Curriculums for many Colleges (including my own). The best reason one can give for using a language like C is that it is close to the core. It provides portability, speed and more control over the programming construct.
Which is why, the importance of C when it comes to Operating Systems and Embedded Tech is second to none. Naturally, if you can master your way around a language like C, you can do it for any language. Any problems with C has been well sorted by its successors like C++ and Java.
Where does Go fit into all This?
Compared to languages like Python and C, the programming language Go is still very young. It was developed by Google and released back in 2009. That’s just 10 years ago. The fact that it was developed by the Legendary Ken Thompson along with Rob Pike should tell how much Google wanted to have a language more suited to its needs compete with the likes of C, Python, JavaScript and Java.
Make no mistake, I like Python, JavaScript and C. But it’s Go that I love. There are many reason for that. The one that influenced me the most was that when I code in Go, it made me feel comfortable. I didn’t have to write so much as “System.out.println()” for just printing a line. I didn’t have to worry about pesky “;”s or indentation in my code. It felt like a cross between Python, C and Java. And let’s face it, it’s the little things like this that make life perfect.
GoLang or Go.
There is a misconception of calling Go as GoLang. The former is the proper name for the language, the latter is just an abbreviation for Go+Language. With Go, you have to write a bit more code than your typical Python but not as much as C++ or C. The thing that makes Go so popular is the implementation of concurrency in Go. The only other popular programming with support for concurrency is Java. Please do not confuse Asynchronous Programming with Concurrency. They are different. You can read about it here. There’s also a bit of a difference between Concurrency and Parallel Threading and you can get it at the aforementioned article.
I didn’t mean this article to be a full-on guide about every thing in Go. I do intend to write a series of articles on how you can get started in Go. This piece, however, was meant to give you a slight insight into why Go Is becoming so popular. Here’s the result from the 2019 StackOverflow Developer Survey which lists Go as the third most wanted language right after Python and JavaScript.
To Go, definitely.
Here’s the list of reasons why Go has become so popular in that span of couple of years:
· Fast and Potable.
· Go code can be compiled to JS.
· Useful for Web Development.
· No need for Frameworks for Web Development. You can develop a simple REST server or even the complete backend.
· Implements Concurrency using Go Routines.
· Moderate Level of Boilerplate code.
· Extremely Useful for Chaincode development.
The last bit there won’t be understandable if you are not familiar with Blockchains and Hyperledger Fabric.
There are many more reasons why you can choose to switch to Go from other programming language. And I intend to explore them in the upcoming articles. They are meant to help you get started with the Go Programming Language. I would try to give analogies here and there to help you relate with constructs in other programming languages.
There are not many modules available for Go as is the case with Python. But the performance perks cannot be ignored here. Not to mention, the unavailability of modules and libraries should appeal to the open-source developer in you. It gives a unique opportunity.
The community of Go is not that large (compared to the Python and JS base), but it is rapidly growing and you can be a part of it.
References:
· https://eloquentjavascript.net/11_async.html
· http://web.mit.edu/6.005/www/fa14/classes/17-concurrency/
· https://insights.stackoverflow.com/survey/2019#technology-most-loved-dreaded-and-wanted-wanted