From C++ to GO? Let´s go!

OutreachPrague
Outreach Prague
Published in
3 min readMar 27, 2023

This is the story that quite a few of our backend engineers went through. Those used to C++ needed to learn and switch to GO. The transition is not as hard as it might seem at first sight. Listen to Alexandr´s story to make your own opinion!

You might be surprised at how similar the two languages are. They both are statically typed, compiled general-purpose languages. Thus they are not that far apart.

What are the main differences you will notice as an experienced C++ dev?

There are some advantages of GO, which you might see first-hand. One that Alexandr mentions among the easiest to spot is no stack overflow with GO. How is that possible? The safety features in GO make some of the decisions for the engineer. Like automatically resizing the data you use for a stack, copying it and making them ready for use, with no need to debug the overflow.

Another obvious thing is the built-in concurrency model inherent to GO language itself (CSP — Communicating Sequential Processes). And another one is part of the syntax. When assigning multiple values, GO makes it easier to spot new variables and is helpful when returning the error from functions easily.

On the other hand, coming from C++, you need to get used to how the defer statement is used and when. Once you get used to it, it can help you clean your resources without the need to throw exceptions in. Alexandr mentions that he misses the const value, which is not present in GO and library implementations. It is one of the few pain points he mentions…

Learn more from video

TL;DR

With 10 years of experience with C++ and about a year with coding in GO, Alex sums his experience: GO is much faster for development and makes it hard to create specific types of security problems. C++ is slightly faster and has better predictability.

And the takeaway?

The switch to GO is not that hard, as the logic and syntax are very similar plus it is much easier to learn than C++.
You will need to get used to some differences in how things are done, but
it will free you of security troubles that you will not be allowed to cause within GO.
Remember: Developers are not experts in languages but in the problem domain.

Alexandr recommends these reads if you want to know more:

A journey with go

A C++ developer looks at Go (the programming language), Part 1: Simple Features

Do you need the perfect programming introduction to GO? Try “The Go Programming Language” by Brian Kernighan and Alan Donovan.

--

--

OutreachPrague
Outreach Prague

Building Prague community of a US startup. Sharing news and experiences on latest technology and our life here in Prague.