Cyberithub

An Introduction to GO Programming Language for Beginners

Advertisements

In this tutorial, we will go through a quick introduction to GO Programming language. GO is created by small team within Google made up of Robert Griesemar, Rob Pike and Ken Thompson. All of the three creators has been around for a while and worked on some of the major key projects in the past. For example - Ken Thompson designed and implemented the first Unix operating system in 1973. He also played a key role in development of Unicode.

Why Create a new Language ?

At the time when GO was not created, there were three key designing languages mostly in use at Google. Those were Java, Python and C/C++. While all these languages are powerful in itself but not enough to handle the limitations encountered at the Google at that time. For example, Python is a very easy to use language but is very slow when it comes to running applications at Google Scale. Java is very quick but its type system has become increasingly complex over time.

Similarly, the same thing was with C/C++ language. They are quick as well but over the time its type system has become increasingly complex and with notoriously slow compile time it was almost difficult to use this. Also at the time all these languages were created, the entire focus was on building single threaded application and there was barely any focus on multi threaded applications.

So the concurrency feature that we see today in these languages are more or less patched on later. Soon it was quickly realized that it is almost impossible to overcome all the limitations and fix the problem encountered in long run and hence a need for new language was felt. From there starts the journey of designing a new programming language called GO.

An Introduction to GO Programming Language for Beginners

An Introduction to GO Programming Language for Beginners

Also Read: 10 Most Popular GO Command Examples in Linux

GO provides some of the important features that programmers were desperately looking into other available designing languages at that time. First of all, GO is a very strong and statically typed language. This means that type of a variable cannot change over time. So basically it means if you declare an integer variable a to hold an integer then it will always hold an integer. You can't put boolean or string in it. And then the statically typed means all the variables has to be defined at the compile time.

Additionally, there are lot of focus has been given to built up a community to support the language. This is simply to make sure GO keep moving forward. One of the important feature which is always the center point of this language is its simplicity. The community made sure that this language should be simple and easy to adapt by any developer. Another important focus of this language is its compile time. A lot of modern code requires fast code building, testing and compilation. This is easily achievable in GO as it is comparatively faster than other programming languages.

Garbage collection is one of the fundamental problem for any developer to deal with when it comes to managing your own memory. In some of the cases like in a stock market where number of BUY and SELL order has to go simultaneously, garbage collection problem can go out of hand. So in a situation like this GO comes to our rescue. GO is also known as garbage collected language which means that although you can manage your own memory but you really don't have to. GO runtime will take care of that for you. This feature is also the part of the simplicity approach that the language provides.

The problem of concurrency is not new for any language but it so happens that almost all the major design languages before GO provides an external patch library to use the concurrency feature. However GO has this feature in-built in the base language and you don't really have to import any library to use that.

Finally, GO compiles down to a standalone binary or a self contained binary which means when you compile your GO application, everything is going to be bundled inside that single binary. So all the GO dependent libraries and runtime are going to be bundled in one binary. So that you can take this binary and run anywhere you want. This will help reduce the dependency of the functionality of your application on any external DLLs, SO or any other such thing like that in order to make it work.

There are many resources available that you can check to know more about the GO language and understand how it works. One of the first places to start with is through its official website. You can write your first GO program in below yellow box and click on Run to execute it. You will see the output below.

An Introduction to GO Programming Language for Beginners 2

Similarly you can also set up the language in your local system quite easily and start working. I will show you the steps to set up the GO environment on Linux System in my next tutorial.

Leave a Comment