Golang V/s Java & C++

Going the Golang way
August 11, 2020
Interview Series
Online Assessment and Phone Screen
August 13, 2020
Show all

Golang V/s Java & C++

Hello friends, I believe that you have gone through the first article of the Golang Series. This is the second article and we are going to continue our discussion regarding Go. The first article included my experience about learning Go. I also mentioned the key factors regarding Go which has made it a popular programming language. So let us now continue our Go journey. Let’s Go!

Will GoLang overtake Java and C++? This is the question that programmers are asking because of GoLang’s increasing popularity.

A lot of people have asked me this question. Today I will try to answer this question as per my understanding and experience regarding the language itself.

An honest, bold, and straightforward answer to the above question is “No, GoLang won’t be able to take over Java and C++ completely due its own limitations” But on the other side, I would also like to inform that GoLang will gradually eat up some of the projects that have been written in Java or C++. I will explain why I come to this conclusion.

Let me begin by answering the first question. Will Go replace C++?

Go was introduced to public 5 years ago. But originally, it has been around for 8 years.

If we consider the effects of Go on C++, then I would like to tell you that Go hasn’t even made a dent in C++ market share till date. On the other side, C++ has just grown exponentially considering the last couple of years. Especially after C++ 11, the growth has been quite impressive.

If you compare Go and C++, then C++has many advantages for now. This is because Go has never been a great alternative for C++.

The biggest issues with Go is speed!

There are several benchmarks that should be considered while comparing the performance between Go and C++. Please have a look at the link in the manuscript.

Go vs C++ g++ | Computer Language Benchmarks Game

If you consider Go, it has exceeded on only one benchmark where there is a comparison between single-threaded implementation and multithreaded implementation. Other than this, Go has proved to be 2 to 5 times slower on every other benchmark. If you prioritize C or C++ in the first place, such a deficiency in speed would never be accepted.

Let us consider the newer languages such as Go and Java. These languages provide garbage collection, dynamic typing, and other facilities. Such facilities make it easier for the programmer to write as well as implement programs. On the other side, there is an additional processing overhead. It will degrade the performance of any application. 

Go’s implementation is quite new as compared to C++ compilers. The ones who are C++ compiler writers have had more than 20 years to refine as well as optimize their implementation in terms of performance. 

So when it comes to performance critical systems like embedded trading, game engine, etc, low-level hardware real-time programming, C++ is very important. This is the reason why Go cannot replace C++ presently and in the upcoming years. 

Let’s move to the next question. Will Go replace Java?

Currently, Java is largely being used for building large-scale enterprise applications to such an extent that there is a J2EE industry standard formalized. This standard extends the Java standard edition with specifications supporting enterprise features. These features mainly include web services and message services.

Comparing Go and Java in terms of libraries and ecosystems, Java would certainly win. Unfortunately, Go doesn’t have an equivalent library or ecosystem. For example, there is nothing by Go that could be compared to Java’s Enterprise JavaBeans, Java Servlets, etc. Definitely, Go needs to introduce such things if it needs to compete Java’s ecosystem or Java’s community. Java gives a choice of standing on the shoulders of other people’s code and this is what keeps Java alive.

When it comes to Enterprises, they don’t favor reimplementation of services because of comparative language popularity. There is a very high switch cost for large Enterprises. This makes them extremely conservative.

People have invested a lot in Java and tossing it away won’t be a good idea. Also, Java has never been fundamentally wrong. Not just Enterprise applications, Java is also used widely to build desktop GUI applications. And in this space,  we don’t see that Go has anything to offer, certainly nothing better than Java

So the next question is, where is Go going to be used?

We have already discussed that Go won’t be successful in replacing Java or C++. It’s like Facebook couldn’t replace Twitter! The thing is that each language has its own domain of expertise. No other language would be as good as that particular language in solving the particular problem. So where does Go excel? In which domain? What is Go meant for?

Go is a systems programming language and is meant for large, distributed systems and highly-scalable network servers. Go excels in writing network servers where the program in any language, often spends its time twiddling its thumbs waiting for the network. but Go has something known as Goroutines which handles millions of network requests simultaneously. Please refer to the previous article for more information regarding Goroutines.

I view Go as a general-purpose replacement for C++ or Java for systems tasks and Go plays an important part when it comes to building highly-scalable I/O systems. Goroutines can easily replace thousands of lines of C++ or Java code which includes thread management, callbacks, and state machines. For such tasks, Go is simply the best! I believe that Go has the capacity to eat up many C, C++, Java projects. Middle-tier projects would benefit a lot from Go. By middle-tier, I mean that Go is capable of swallowing the middleware or the infrastructure based system like service discovery, service broke, message-oriented middleware, etc.I can say that Go is an expert or has a sweet spot when it comes to writing network servers. Especially in scenarios when the program spends a lot of time waiting for the network irrespective of any language.

Such systems don’t include complicated business scenarios and aren’t tightly tied to the underlying operating system. So the final outcome of Go being used in the middle tier would be that C and C++ will remain at the bottom or core level, Java will be pushed to a higher level while Go will be sandwiched between them at the middle-tier. This is the reason why Go will be used more in the future.

I would also like to discuss the ongoing trend

Nowadays, a lot of software stack is being rewritten or written in Go. New servers are being built in Go and many are thinking to migrate their existing codebases to Go. Some of the Google technology is also using Go. For instance, there is a system known as Vitess. It is a MySQL scaling infrastructure system.  Vitess scales the MySQL cluster for Youtube. This is written in Go. Another example is Kubernetes. It is modeled according to Google’s internal systems and allows users to schedule the running of Docker containers over a cluster of machines. Kubernetes is also written in Go. You might be thinking that Go is just limited to Google but it’s not the case. Go is now powering a huge chunk of tech giants like Cloudflare, Dropbox, Netflix, and more.


This article is the second part and final part of GoLang series. So in this article, we discussed the current scenarios and the future of GoLang as compared to existing languages like C++, and Java. This article answers questions like “Will GoLang overtake C++/ Java ?”. After that, we have answered  the question about “What GoLang is actually made for and regarding the future of GoLang”. The article offers a transparent and straightforward comparison between GoLang and the modern languages. GoLang certainly eradicates many problems with the help of features like GoRoutines. I believe that GoLang has a great future within its scope and my experience says that it is going to be huge in terms of application. So do believe in GoLang and start solving your problems.

Check out the first article of GoLang Series

Tao is a passionate software engineer who works in a leading big data analysis company in Silicon Valley. Previously Tao has worked in big IT companies such as IBM and Cisco. Tao has a MS degree in Computer Science from University of McGill and many years of experience as a teaching assistant for various computer science classes.

Leave a Reply

Your email address will not be published.


get free access to this free guide, downloaded over 200,00 times !

You have Successfully Subscribed!

Level Up Big Data Pdf Book


get free access to this free guide, downloaded over 200,00 times !

You have Successfully Subscribed!

Jenkins Level Up

Get started with Jenkins!!!

get free access to this free guide, downloaded over 200,00 times !

You have Successfully Subscribed!