Are you ready to code in Go?

Are you ready to code in Go?

Go came somewhere in 2007 by a team of programmers in Google. When Go was designed some of the most commonly used languages for development at that time were Java, Python, C/C++ etc. All of these languages in itself had some core strengths and were very equally powerful but suffered from some of the shortcomings as well which led to urge for a new language - GoLang.

Need for new language: Go

Let's quickly have a look at some of the limitations that existing languages suffered from.


Python was always popular language due its simplicity, ease of use, code readability and a lot more. But its an interpreted language which makes it not suitable for applications scaling to a great extent.


Java on other hand might be quick useful for building & developing different types of applications but its type system is really complex. As it was initially designed as a language for simpler single threaded use-cases. But eventually with increase in number of real time use-cases to solve additional features were layered into language thereby increasing its overall complexity and making it difficult to use in some scenarios.

C and C++ on other side was also quick and most popular language for long time. But its sluggish compile time and its type system makes it equally complex to build softwares. These complexities can impact overall software development time, productivity of development cycle and eventually lead to more bugs which requires lot of efforts in code fixing.

So, all the legacy code that was developed using these languages needs far more attention and had the burden of managing this legacy code base. Also, a lot of languages when designed there were hardly use-cases of multi-threaded applications. Hence, concurrency patterns were patched at some point later on in these languages. So if one needs to work in highly parallel, highly concurrent environment sometimes it can be challenging using existing languages.

What Challenges: Go addresses?

Based on some of the bottlenecks that we have discussed above its very important to understand how Go addresses some of these concerns or it was just an add-on like any other language. Let's discuss some of the improvement areas where Go made its mark over other languages.

  1. Code Simplicity - It is less complex and tries to re-use or borrows lot of benefits from existing languages. Programmers need to navigate through lesser lines of code thereby saving lot of time in reading the code.
  2. Powerful Performance - Shorter development cycles, faster compile time, easy to manage and support, providing lot of speed advantage as it directly compiles to machine code.
  3. Strong & Statically typed - Go inherits this feature from other existing languages. All of the types of variable are declared at compiled time & cannot be changed.
  4. Less verbose - Less code like developer don't really have to make compiler understand what's the type of variable etc.
  5. Designed for multi-core processors - Designed for modern era of cloud computing.
  6. Garbage collected language - Go runtime manages memory. Lot of attention was also paid to reducing the time when apps pause during garbage collection.
  7. Built-in concurrency - To address existing languages concurrency concerns, Go has built concurrency primitives into the base language itself rather than adding any additional library imports like its done in other languages.
  8. Compile to standalone library/binaries - When go application is compiled its compiles and bundles everything into single binary. No dependency on external libraries and DLL's to run your application properly.

Go real-time use-cases

It's actually Go's versatility and speed that makes its a language of the hour which is being used for some of the top-notch use-cases by different industry giants. To start with if we talk about Google's services like Google earth and Youtube they were rewritten in Go after go was designed. Let's take another example of Dropbox which replaced its legacy Python code with Go for its file hosting use-case. And if we talk about leading password manager that is 1Password it also uses Go for its backend server. Let's take another real-time example of Uber from our day to day life. Many of the Uber's services are written in GoLang like Geobase, matching riders and many other services uses Go.

Let's create a simple program to greet in Go -

// Main special package - entry point to any go program/application
package main
import "fmt" // format

 // global variable declaration
 var greet string = "Hello, World !!"

 // main function
 func main() {
 fmt.Println(greet)
 }        

If you want to try out some more code in Go, use Go playground: https://go.dev/play/

To discover more about different Go packages and libraries visit: https://pkg.go.dev/std

To get some of the latest updates and discover what's going around in Go join Gophers slack community: https://blog.gopheracademy.com/gophers-slack-community/

Conclusion

Hence, Go is that Swiss Knife that has cleared most of the overhead and clutters that has accumulated so far by different programming languages in last few decades. In this game of Go, migrating to Go might be somewhat time consuming, would need some effort to get hand-ons with it. But it could be great choice for companies looking for some steady growth, for development of servers, systems, databases, API's, web-development and a lot more. GoLang can also serve as bridge for integrating a legacy system into cloud.

Roshan Deorukhkar

Entrepreneur, Front-End Architect, UI Architect, Leadership, TDD, Javascript (Angular/React/Vue)

1 年

Amazing ????

要查看或添加评论,请登录

Karuna Puri的更多文章

社区洞察

其他会员也浏览了