Why you must learn Go You ask? Or better yet… why learning Go would change your perspective in a few ways on your usage of programming languages in general.
If I want to finish this here and now, the answer will be – simplicity, awesome concurrency model, amazing community, readability, ease of learning, and simple high raw performance.
I started to hear about Golang around 2019 from my friends who started to use it, and each time I got amazed by the comments about the simplicity, and how the community helps to build it even more, offering tools out of the box that in other ecosystems isn’t that straightforward to use or bring to the table, and many other features and capabilities that made this programming language awesome.
An honest disclaimer before everything that I must say is that I always try in my professional goals, and even my business view approach is that we should always use the right tool for the job, and I’m not necessarily talking about a programming language, I also refer to cloud providers, solutions, frameworks, algorithms, and so on …
It’s like you’re going shopping for a T-Shirt because you know you lost some weight, so for the summer you want a cool and comfortable T-Shirt, but in the end, the seller offers you to buy a warming jacket because it’s on sale after winter is finished, but then the clerk is saying “Winter is coming…” so you must buy one, but of course just kidding, I had to put a Game of Thrones reference there 😉
Anyway, it might be implied so, but I’m not trying to say “Go is the way! Go with Go!” actually, I’m trying to say that Go is an amazing programming language that I’ve grown to love for many reasons, and it can be useful to use it in many occasions in backend applications, but then again, it other cases it might be not useful in cases we need specific use cases in our implementations, depending on old technologies, use the same technology of existing projects to keep the ecosystem the same, or simply simplifying the infrastructure for using a single technology when we must use one language because of an ecosystem it has while the other doesn’t.
This post solely will cover only a few good aspects of Go, so it would just give you the motivation to start reading about it more, and even who knows try to use it.
Table of Contents
Before We Start
I’ve written a few posts in the past about Golang, which was a phase that I wanted to learn more about it, so it was an attempt of mine to learn more about the language but probably could be improved regarding its writing in a few ways.
Nevertheless, there is great information over there, and I highly suggest you check that out as well.
Introduction to Golang
So Why Should We Learn Go?
The question could be for us instead of whether should we learn to Go Go, but rather if must we learn to go.
Today they are many programming languages, and each and every one of them allows to create a robust code base with many features. The issue is that because there are too many tools, it leads to multiple code standards, that are hard to follow, and each library, organization, company, project, probably and so on … has its own standard which leads to learning standards which is all great and all, but takes us from the root important fact that we’re working on solutions, and Go allows in many ways to focus on that more.
Go is striving to allow everyone a standardized way of using its features in a way that will allow everyone who reads the code to understand it, extend it, and change it according to its needs, without experiencing the challenges of a complex code base, but also not experiencing IT-wise issues like dealing with compilers, inconsistent environments, and many more stuff that I’ve only covered the tip of the iceberg.
It might sound from reading this post until now that I’m saying you should ditch every programming language and ditch Go, which I’m not trying to say if that’s what you’ve understood because each language has its own tools and use cases according to the needs.
Go for me personally was an amazing experience from starting to develop in it, to debugging performance issues and bugs, that simply showed me the community and the thoughts of the way it was developed, so I really took it as a programming language that I highly put it in my toolset as a go-to language to use, unless there are contradicting use cases to the solutions needed, and I highly encourage you to discover it as well to see if you like or not!
Simplicity
One thing that is amazing about Go is simplicity.
I’ve had the chance to use multiple programming languages from C++ to Python, some Java along the way, even C#, and also Scala.
All of them in their aspects are simple, but the most simple out of them is of course Python regarding syntax, but of course, can lead to magic syntax if you consider magic methods of objects for example, and so on … so it’s again a personal opinion on that.
The specific aspect of Go is the fact that the language itself is aiming to be as much as simple as possible in the way that it was implemented, and what it offers to the developers.
Why?
By limiting the options, it’s not that we suffer from limitations, but quite the opposite in Go. It’s that way because it wants to offer amazing tools, but keeping things simple so people wouldn’t go on the adventures of developing applications with complex code, and going to a complex not understandable code.
Let’s talk about an actual example. In Go we don’t have objects but structs. Because of that we don’t have inheritance but rather a composition of objects, which leads to not bearing in mind the headaches with inheritance tree, and complexities of that like in C++ we have the diamond problem, and other creatures that grew because of it, and again complex our code in many ways.
Simplicity in Go also comes in the image of keeping things simple in the entire ecosystem, which also leads to a fast learning curve and usage of it.
Eco System
The ecosystem of Go can be summarized in one word. Simply astonishing, because it gives many abilities out of the box.
Just to state a few… I remember that I was developing in C++, and I tried to take a library from the internet, wow that stuff was made out of horror films. I remember downloading the library then it doesn’t fit the version of C++ I was using, although it was mentioned that C++11 was enough, then going to add it to my build process which was a hell of itself, and this was only for adding a library.
What about discovering race conditions, or doing profiling for the code?
Of course, that Vagrant, and tools alike are existing, but because they’re not fully integrated into one another in the image of needing to config everything up and so on … it needs out of a developer a lot of time and knowledge to connect everything up.
Of course that the learning curve to use everything is amazing because it gives a way to understand how everything works under the hood, but really understand it, while many frameworks today aren’t allowing you to even understand that in some cases, so it depends on the ecosystem you’re working at the end, but at the same time allows you to waste a huge amount of time on the non-important topics for you if excluding the learning process out of the picture.
In Go, many tools and applications are already built into the language or tools that come with it. The amazing part is that everything is plug-n-play-wise integrated with one another, which allows us as developers to dig right in, go straight away for the problems, and waste almost no time when trying to get ahead with our challenges while we develop.
I mentioned earlier the subject of race conditions. The runtime of Go actually has a flag that allows us to see the detection of race conditions in Go routines built-in in the Go runtime, which is quite an amazing feat just for that alone. In addition, a profiling tool called “pprof” also exists, and allows us to get graphical graphs and charts that show us profiling analysis for our applications as well.
Regardless of all of that, the fact I can simply type “go get {library-url}” and get it all configured up for me, and straight away use it, is something I highly cherish after the journeys I’ve experienced in C++ as we saw earlier.
Community
Just a few weeks ago, I was at a GopherCon conference. It was amazing because I saw developers across the world, and people with an amazing mindset that simply wishes to contribute to the language and the ecosystem it gives.
The mindset is simply allowing people to develop fast, having high performance, and high readability while doing so.
Because of that, being an entrepreneur-wise mindset, allows for growing fast while keeping good performance for many reasons, some of which we covered above earlier.
In addition to that, the community of Go, just for example if you go to GitHub, you would see so many open source projects with tons of contributors, just so people would use the language due to the features and simplicity of it.
I personally, really like the fact that I almost found anything I’ve searched online on GitHub for Go. Even, I tried to search for projects that I haven’t expected to easily find on GitHub, which I found open source and from the community projects, but on top of all that, Go itself is getting frequent updates, and hearing the crowd or more precisely the community to add more abilities to be built-in in the language ecosystem.
Performance
Oh jeez… we started talking about something curious now.
Go is an ASM language. Meaning, like C and C++ it’s natively compiled to machine code without the need for a Virtual Machine like CLR in C# or JVM in Java/Scala/Kotlin ecosystems.
Because of that, but not only, Go gives an amazing performance overall. It has a GC(Garbage Collector) built-in in the runtime, which simplifies for us the development cycle, while also keeping great performance at the same time.
In addition, because it’s an ASM language, we need to build it according to the OS it will run on, but something cool about Go is that it also comes with tools that allow us the ease to compile it without any headaches like configuration of multiple toolchains, compile it for the right one, and not expect runtime issues of missing symbols in our programs and so on …
It’s really just the tip of the iceberg, but Go excels in this area as well.
Because Go is a native language, and it was of course verified, it has an amazing performance regarding the amount of ASM commands it can execute in a second or over X amount of time considering the benchmarking programs that were run. I’ll be frank that there were a few cases that Go lacked behind in a few tests even behind Java, but for most cases, until what I’ve seen at least, I saw that Go pretty much took a high spot with the group of languages on the performance they get to. Yay Go! 💪
Concurrency
Wow, he hit the cherry on this one!
Go concurrency model is one of the most advanced ones in the market you could say.
It allows the use of user-space threads which run in the OS user space, and by doing so manages them inside the Kernel space more efficiently due to having an additional layer of handling them in the user space by the Go runtime itself like fine-tuning the context switching between the go routines which are Go threads, managing memory more efficiently and many more.
Go concurrency model includes many batters that are already included like communication between the threads, mutexes, advanced tools to sync the threads and also communicate between them, and many many more …
Due to Go coming with a lot of batteries included in the language, it simplifies and also drives us to a way of developing concurrent applications using Go. By doing so, it allows us to have a very simple understanding and usage of its ecosystem for that subject.
I personally found myself pretty easily trying to implement a concurrent application using Go, while doing something similar in other languages wasn’t that straightforward. This is also the status due to the simplicity that Golang tries to strive for 💪
Readability & Simplicity Again
If I’ll take all the subjects we just covered until now, I think one of the strongest points of Go is again the simplicity which leads to amazing readability.
We know that in big projects, we can start creating inside the R&D a new style of using the language regarding the product concerns and the way we develop as a department.
Because of that, it leads to many standards in the code we develop, and a learning curve to understand how to write code in each company.
Go is actually trying to advance the language all the time in a way that will allow the upper needed limit tools for us to develop, while trying to improve and give us more tools inside it.
It does so because the limitation itself regarding what we have in the language limits us from abusing the language, keeping the code simple, and pretty much defining a go-to standard of using the language, so we wouldn’t see any magical beasts in new places that we will arrive to.
Because of this, this allows many developers to get into Go pretty much in a few days, which I personally experienced so myself recently.
This is actually another big win, because this allows for great readability as we have in Python, and ease of understanding of it, which leads to ease of getting into Go for new developers, and doing onboarding for it for new members, so again it’s a huge win for getting inside the language and not getting frustrated with understanding the magical stuff the language has.
Final Thoughts
I personally think that Go is one of the languages to stay and for a while!
As we saw it tries to be simple to use, easy and fast to learn, allows people to learn the new tools pretty easily, and has a lot of batteries already included that also integrate with it e2e.
I think that as of today, we know that C is the language for the kernel, C++ is for user space, and Rust today is starting to get considered as an alternative to C/C++ in a few ways, that even Linus Torvalds, the Linux creator suggested using Rust as part of the Kernel of Linux, so who knows where that could lead to.
I personally also tried using Rust, which led me to like to Go even more after that experience due to the fact of the ease of starting to use it and understanding it pretty much off the bat.
In addition, if we consider server-side languages to build microservices or any server-based solutions, I really don’t see any reason to consider other programming languages, but unless, and it’s huge if… only if there are necessities that Golang doesn’t provide that other languages like Java/C# give because the functionality is already existing in their ecosystem, and that necessity is fitting to our solution ecosystem as well.
I can tell from my personal taste of choice that if I’ll be asked to choose a backend programming language to use, I’d probably use Golang. Why? Because it would allow me to easily integrate any kind of tool, build/maintain my application easily, progress fast regarding features, allow other people to learn it pretty quickly, test the app easily, and many other reasons that will allow me to progress fast and have good quality.
If I do would have cases in which I’ve dependencies that other languages offer functionality that they exist in their framework, or more suiting to them like Keras/Tensorfole e.g., then I’d reconsider and try to think of something else, but if again I’m in a general use case, Golang would my personal choice.
What we’ve covered here is only the tip of the iceberg regarding what Go offers, so I promise to create more posts like this one, and others with more details oriented on Go and how to use it in technical manners 🙏
I also hope, which seems that it will go that path, that Go creators and the community would allow it to grow even more, and improve its footprint in the binary file sizes, but also the overall performance and usage even more so maybe one day we would be able to write a Kernel module in Linux using Go, wouldn’t that be awesome?!
I hope you had a great time reading this piece, and if you have any further questions I would be delighted to answer them.
Also, if you have any opinions or suggestions for improving this piece, I would like to hear
Thank you all for your time and I wish you a great journey!
Reference Links
- Go in 100 Seconds
- TechWorld with Nana long Tutorial on Golang