Tuesday, April 19, 2022

“Go” is the way to go!

 




“Go” is the way to go!

By Bruce Afruz 

With a revolution in cloud computing and the flexible infrastructure to implement multi-threading and asynchronous programming, it's time to move on and GO with the stream! 
GOLANG or simply GO is a language that offers us this ability out of the box, here are some facts about GO and I liked to share it since it became my language of choice for a while now. 


What Is Golang

Golang is a programming language that is also popularly known as Go. Google LLC created this programming language in 2007 to improve the productivity of their programming systems that were using multiple cores and networked with large codebases. The result was a programming language with exceptionally high performance that improved the readability and expression of code written by developers and engineers at Google.
What Led to the Development of Golang?


Rapid Growth

In the first decade of the 21st century, Google LLC was experiencing high exponential growth in all aspects. Google needed heavily programmed resources to manage data using very large codebases to keep their systems running. Scalability was the main challenge that Google was facing at the moment. Google needed to develop a standardized resource to be used by software engineers when working to maintain hardware and software through code. By then, Google stored all its source code in a monolithic repository. That means any form of change planned to be introduced had to be verified. In case the new code had an error, the performance of the rest of the system would be compromised. All these problems triggered Google towards creating a build system that conforms to their way of doing things. The proposed system would allow their source code to be compiled and run on multiple machines in parallel. 



Slow Compilation Speed

Google was struggling with code optimization because the build time for languages like C++ was very long. Since Google used heavy systems, the compilation time often lasted several minutes for a successful build. Google engineers and developers tried using Java and C++ to write threads that allow memory sharing. An evaluation was done, and the issue was too complicated. Writing concurrent code in two different languages is a complex undertaking. The code for the system was often not optimized. It was very difficult for programmers to identify mistakes in the code. Running concurrent processes with millions of requests per minute back in 2007 meant that programs would become hungry for resources. The solution for slow compilation speed was implemented by coming up with an asynchronous model like the use of Node.js. The thread is not blocked whenever a function needs to perform an input/output operation. That, in return, makes the whole process highly effective.


Difficulty in Managing Code


Java and C++ were the only viable programming languages available to support the systems owned by Google before 2007. Both languages were bad at handling classes. They made the code less readable because a code developed by one developer was not readable to another developer. Managing dependencies in code was a big problem, especially in C++. Even when programmers managed to read the code, it was very difficult for them to decide what to add or remove from the code. This complexity in managing code made Google start thinking of an option for building readable and manageable codes. 
Features of Golang
Golang is a revolutionary language that combines the convenience of several other programming languages like Java and Pascal and communicating sequential processes (CSP). These are the outstanding features that define Golang.


Syntax


The design of the Go language was simplified to the extent that only minimal syntax would be used to execute operations. For over 15 years, no complex syntax operations have been introduced. That means Go developers do not have to keep up with new trends and syntax updates in programming languages like Java and C++. This feature makes Golang very easy to learn, use and remember. Different programmers also use syntax in different approaches. Golang uses very simple syntax making the code readable by different programmers, and they understand how it works. This is in favor of Google, which has thousands of engineers and programmers who need to understand the same code without misinterpretations.


Compile Speed

The advancement of Golang ensured that it spent minimal time compiling even when working with large codebases. Golang can compile raw code to a machine language very fast. The feature that makes Golang achieve fast compilation speeds. It has an in-built ability to quickly analyze dependencies to prevent similar files from being uploaded repeatedly. Golang makes minimal interactions with the hard drive because it uses the most recently requested files at runtime. This programming language is among the few ones that perform complex code compilation at maximal speeds. 


Unit Tests

Golang can recognize the dependencies that exist in a package. Golang does not initiate a recompilation whenever a resource is requested. This is only done where dependencies of the previously compiled resource remain unchanged. During the consecutive compilations, Golang uses the most recent compiled resource. Unit tests are launched quickly because compiled resources are readily available. These results usually are stored in the cache. During runtime, only the parts that experienced any change are recompiled.


Memory Management

All programs that Golang executes at runtime are stored in the random-access memory (RAM). At the end of each compilation, Golang creates an executable file in the form of machine code and stays on standby, waiting for the next time it is called. Golang also has inbuilt memory management capabilities that decide what to keep and what to clear from the memory. The programmer should not get worried that any part of the memory of the machine they are working with is full of programs that are not being used. This is what makes programming much easier because proper memory management enhances the performance of the software. 


Golang Use Cases

This language is open-source for developers to learn and apply. They can create multiple solutions for problems that we face every day. The language is excellent for web development, especially when the goal is to design scalable and secure applications. Developers who want to build and scale cloud systems should consider using Golang. Developers also use Golang to automate site reliability engineering (SRE) tasks. The language can also enhance multi-platform applications and create command-line interfaces.


Takeaway

Go, or Golang, was developed to solve problems that Google was experiencing before 2007. The language development was successful, and now developers are using the language to create solutions in multiple areas. These areas include; web application development, web security, cloud computing, graphical user interface (GUI), and designing interfaces for command lines. The Go community on the internet has snowballed over the past decade, making it a widely accepted language where developers can get assistance to help them when working on their projects. 


ARE YOU READY TO GO?

Just visit: https://go.dev/doc/tutorial/getting-started and let's GO!





References
Boyd, W. (2021). What is Go? An intro to Google's Go programming language (aka Golang). Retrieved 18 April 2022, from https://acloudguru.com/blog/engineering/what-is-go-an-intro-to-googles-go-programming-language-aka-golang
Web Development Team. (2022). An introduction to the Go (Golang) programming language. Retrieved 18 April 2022, from https://kruschecompany.com/golang-features-pros-cons/
Olszak, J. & Rusinowicz, K. (2022).Why Golang may be a good choice for your project. Retrieved 18 April 2022, from https://codilime.com/blog/why-golang-may-be-a-good-choice-for-your-project/