avatarDavid Lee

Summary

The article presents a debate on whether developers should choose Rust or Go as their next programming language, with opinions from experienced programmers.

Abstract

The article delves into the ongoing debate between choosing Rust or Go for backend programming. It collects insights from seasoned developers who use both languages in various contexts, ranging from web development to game development and systems programming. The discussions highlight Rust's steeper learning curve, its credibility in areas dominated by C++, and its ability to operate without a garbage collector. In contrast, Go is praised for its simplicity, ease of learning, and strong community support for cloud and DevOps tools. Some developers recommend learning both languages to leverage their unique strengths in different projects, while others advocate for focusing on Go and revisiting Rust later due to its complexity. The article also touches on the performance aspects of both languages and their suitability for various types of projects.

Opinions

  • Rust has a challenging learning curve with comprehensive onboarding materials like "The Book," but it's worth the effort due to its ability to prevent common programming errors.
  • Go's syntax is straightforward, making it quick to learn and suitable for web applications, automation, and cloud services, with a vast array of community libraries.
  • Some developers argue that Rust's powerful features, such as ownership and borrowing, are overhyped for most project needs, especially when considering the time investment to learn the language.
  • Rust is seen as a more "exciting" and "powerful" language that can teach developers about programming concepts and memory management, but it might not always be necessary for the level of performance it offers.
  • Game developers generally recommend using C++ or other specialized languages for game engines, viewing Go, Rust, and C as less relevant for game development.
  • The article mentions a research project that resulted in an operating system written in Go, challenging the notion that Go is not suitable for systems programming.
  • Go's fast compilation times, easy concurrency model, and overall convenience make it a preferred choice for rapid development and maintenance, while Rust shines in scenarios requiring precise control over resources and state.
  • Some opinions suggest that both languages serve different niches and that learning multiple languages can broaden a developer's skillset and problem-solving capabilities.
  • Zig is introduced as another language to consider for low-level programming, with some modern concepts similar to Go, although it is noted to be in early development stages with potential documentation and stability issues.
  • The debate includes a perspective that neither Rust nor Go is truly "low-level," as both are compiled high-level languages with abstractions that keep them above languages like C and assembly.
  • Rust has a lot of traction but few long-lasting projects, with some developers experiencing difficulties with its async model, whereas Go has a track record of successful and impactful projects in the dev ecosystem.
  • The choice between Rust and Go may depend on the specific needs of a project, with Go being suitable for more general programming and Rust being advantageous for systems programming and performance-critical applications.
  • Rust is compared to Go in terms of performance, with Rust offering the potential for optimized code execution, but Go providing a more straightforward development experience with faster feedback cycles due to quicker compile times.
  • Rust is described as a language that combines functional programming concepts with systems programming, designed for high-performance domains, while Go is positioned as a medium-level language aiming to replace languages like NodeJS and Python for certain use cases.

Rust or Go (heated debate version)

My last article on Rust or Go seems unable to conclude the debate so there it goes the continued version here.

If you want to know what the first article is about, please go below:

This continued article aims to help those developers choose which one to pick as their N+ backend programming language, no matter you are a junior or seasoned programmer.

I have collected discussions with many seasoned programmers in the community who use both Go and Rust, and below are the selected scripts of their opinions and they are really amazing even some are quite controversial.

Rust has a much harder learning curve. You are ready to write good enough Go with just going through the Tour of Go. Can’t say the same about Rust, they do have some great on-boarding guides like “The Book”, but it’s quite a read. At the end of the day, they are just tools, no one will judge you for trying both.

Game dev here! Unless you’re writing an engine or really attached to a certain language, your best bet’s gonna be C++ if you really, really want to use a low level language, but you’re honestly gonna be a lot better off learning C#, Godot/Gdscript, or some other engine with a specific language. Go, C, and Rust are pretty much just a waste of time for 99% of Gamedev.

There’s also the old(new) joke of “Rust has 500 game engines written in it and 2 games”

Learn both. No one is writing kernel modules in Go, and writing web servers in Rust is pretty painful.

i.e. I really haven’t found a whole lot of overlap though with programs… Go excels at some and Rust excels at some.

Agreed, but just as a fun fact, here’s a research project that resulted in an OS written in Go: https://pdos.csail.mit.edu/projects/biscuit.html

Rust is gaining a lot of credibility in areas where C++ is the defacto language and once you start going through a Rust training that goes over all of its features, you start to quickly see why and how it differs from many other modern language out there.

Go’s dead simple syntax is attractive, the huge community of libs and official SDKs offered in Go for the various DevOps tooling, cloud providers, etc. makes it a natural choice for writing various types of web-based apps.

I personally use both. Java for “enterprise” apps when we need a “business language”. Go for automation, and Rust for lower level tooling or WASM apps development. Use the right language that fits your needs. In the end it’s just tools.

I replaced all Java “enterprise” use with Go and I’m extremely happy. Faster to develop, easier to troubleshoot, better performance and way lower memory consumption.

There are several cases where I too would choose to go over java for “backend” web development of the simplicity of Go and in the end anyway it’s all containers, so the resulting container image is even more minimal. My reality is a lot of shops here are either java or .Net in the finance or insurance sectors that are big, so to convince them to write Go will take some impressive convincing that I personally can’t sometimes justify, because “if it works why fix it”. I’ve successfully introduced TerraTest in various teams to test Terraform, so that’s a way to get them to test the waters of Go and see how they appreciate the language. So far, that’s been very positive.

We do have smaller fintechs using Python Go or Typescript for the backend code, it’s a great opportunity when you’re writing new code for new apps and you have a mass of devs who want the latest and greatest and are willing to take risks for big gains.

Go: go build and you get a static binary

Python: Download all this shit, make sure your version is correct, make sure the paths are correct, hope it works. Also hope that the version required doesn’t conflict with any system usages of python.

Don’t be afraid to learn some rust, set it aside, then come back later. Its a very complicated language and to use it effectively you will need to understand a lot of advanced concepts. By contrast, Go was specifically designed to be relatively easy to learn.

My recommendation would be to focus on Go, but come back to Rust as you have interest. The more languages you know the more you will be able to gauge their strengths and weaknesses and apply them to situations where they fit.

Others will disagree, but i recommend *not* to just stick with one language. Learn many. It will expand your horizons. Languages come and go out of fashion so we always need to be open to learning.

With all that said, i think for learning Go my best teacher has been just trying to build different utilities that I use in day to day. With a relatively narrow focus then i will try to adapt it with different techniques i want to learn. For example, lets say i build a small TODO app. if i want to learn about go routines, i might restructure part of it to use go routines, etc.

For getting deep into types, this is a good source of inspiration for how to start thinking about types. This example uses Typescript, but the language is irrelevant https://v5.chriskrycho.com/journal/making-illegal-states-unrepresentable-in-ts/

Best of luck, have a fun journey

I started serious programming with Go as my first language, and I think I spent 2–3 days before I learned all the Go syntax. It was that easy, and the Go syntax and compile error messages were so simple to understand when learning.

I then got a Go job, and tried to visit Rust 3 times separately before it finally clicked.

So setting Rust aside and revisit it later when you’re more ready actually worked well for me.

Go is both more low level (less abstract, more imperative) and less low level (not as close to the metal, garbage collected, no unsafe blocks) than Rust. If you’re going to do backend work I find Go is a perfect tool, but Rust is a more “exciting” and “powerful” language so to speak, and it will also teach you more about programming and let’s say semi-automated memory management (if that’s a reason why you’re interested in “low level” languages in particular, but keep in mind both are way more abstract than C.)

In terms of speed, Rust can be faster but Go is already very fast, and crucially it compiles much (much!) faster than Rust. In terms of paradigms, Rust is more functional by far, but efficient Rust requires (mindful) use of mutable references, so it’s never going to be an un-GC’d Haskell.

Also, concurrency in Go is very easy but async Rust is kind of messy and has a lot of conceptual overhead for what it is. So if you want to get stuff done you can get going with Go quickly, but I feel like Rust is still worth learning.

rust has a high learning curve, but it is very rewarding to learn becuase of how many new concepts you learn. Go is very straightforward and easy. I use go for work, but rust for personal projects (I did use it professionally in my last company for a small project though but at the moment not) becuase it just makes you think in a different way. Can go achieve the same level of speed as highly optimised rust? Probably not, rust operates at the same level as C and C++. But do you really need that sort of speed ever? Also probably not.

Learn both and expand your knowledgebase. Why do you need to pick a single language?

Understanding different programming paradigms will broaden your skillset as a developer. You will eventually reach a point where you can determine for yourself which language will be useful for specific types of projects VS having to ask others.

I use several different programming languages on a regular basis, for different purposes: Python, C++, C, Kotlin, Go, Rust, JavaScript, etc.

I work with Go and am currently learning Rust out of my own interest.

From what I’ve learned so far, the unique selling point seems to be its way of managing references (preventing memory leaks) without needing a garbage collector. The lack of a null concept is kinda related too and seems borrowed from the approach used in functional languages.

There are other benefits that are mentioned in various articles. So far my impression is that Rust is a little overhyped, although I may be wrong as I’m still learning. I’m saying this because I feel that, if you know what you’re doing as a developer, the kind of errors that Rust seeks to prevent at all costs will have a very tiny impact on your development time and the end result, so I don’t feel it’s worth learning an entire language just to deal with them. Not needing a GC is also beneficial, but there are very few types of software projects in which the performance gain makes a tangible difference.

Go is a wonderful language and I honestly can’t recommend it enough. Wonderful syntax, great performance (although not perfect) and incredibly convenient.

If you are interested in more low-level programming with manual memory management I would like to throw Zig (https://ziglang.org) into the mix. A while back I started trying to learn it after using Go almost exclusively for the last couple of years and I like it a lot. It has some modern concepts similar to Go (like defer) that just makes it nice to write. Just be aware that Zig is in early stages of development so documentation and stability can be rough at times.

You can learn both. It doesn’t hurt to learn more than one language. Actually, learning a lower level language might teach you of new concepts that make you write better Go code :)

I’m sorry but neither of them are low level programming languages. Both Go and Rust are compiled high level languages. Both allows you to do some low level programming (may be Rust more so), and both can be considered as lower level than let say Java, Python, Ruby, JavaScript, etc. but neither are low level programming languages. Even C is a high level programming language.

I would answer your question with a question. What do you need or want? If you want to have more performance for some microservices or tools, etc, both can be very powerful and I really don’t think Rust’s performance gain is worth the steep learning curve over Go. If you want to do systems programming, especially want to do kernel hacking, Rust would be better over Go, because you’d have to deal with GC if you choose Go.

I would start with Go for more general programming and would play with Rust along the way to see it is worth the switch.

Rust has a lot of traction but there are very few successful lasting projects written in it. There is a lot of hype, people love it initially and then find out they need async and their world fall apart. The hype we see is mostly built by people writing in Rust on their own time for fun. The story is different in production.

On the other hand, Go has many successful & lasting projects that changed the dev ecosystem (kubernetes, docker, fzf, and so on) especially in the system programming world. Interoperability with C is good, async is made easy, and it compiles to native code.

IMHO Go is there to stay, Rust has been out there for 10 years already, it will grow but the core problem it solves is nothing new and mostly revolves around developer CX.

Go is low level in terms of few language features and keeping the language simple and discouraging layers of library abstractions but is GCed. Rust is low level in terms of having no GC and allowing you to microoptimize code but the language features push you towards a ton of abstractions.

They are often compared but apart from both compiling to an easily deployed statically linked binary and having excellent tooling, they are not similar languages imho. Rust is basically going to be much better suited if there is a framework to solve the exact problem domain you want to solve, or if you are doing something where you can and want to exactly model every possible state your program can be in. Rust works best when the problem domain is difficult but very well understood before you start.

Go is better if your problem domain is not completely explored while still simple enough that you don’t need complex libraries for it beyond “here’s a function that takes this concrete type (including pointer types) and returns this concrete type”. It shines when you want to avoid opaque abstractions from layers of libraries that change the way you write code and make it difficult to optimize or refactor what you have.

Go is great for producing code that is accessible to other people who may not be familiar with the exact stack you use, for code that will change maintainers a few times, or as a language that can quickly be introduced in a team to fill the compile-to-binary niche.

Also Go has fast compile times to the feedback cycle is much shorter, so that the dev cycle feels a bit more like a dynamically typed language especially if you use any with runtime type checks/switches. Rust has significantly longer compile times, but also has much, much better compiler error messages as long as you avoid macros.

Rust written with an eye toward performance will always be at least as fast as the go version if the programmer knows what they’re doing. Rust was designed to replace C++, Go was designed to replace NodeJS and Python as well as some stuff that never should have been C++ (java or C# would have been more appropriate).

Go is what I like to call a medium level language, alongside Java, C#, and Erlang. They are performant enough for most tasks, but make some tradeoffs away from being a pure systems language in the name of developer friendliness. These include a garbage collector, transparent references (yes, go does that to), and some more structured ways to do concurrency.

Rust is a what happens when you make an ML variant a systems language. It has a mix of functional programming and systems programming which is fairly unique among modern languages. It was designed for kernels, browsers, databases, etc, the places where performance matters most. It just so happens that the functional DNA and a lot of community effort made it usable outside of those areas without gigantic amounts of effort.

If you want to learn a low-level language, you want C/C++/Rust. Go is not a low-level language and was never designed to be one. Typed isn’t a yes/no question, it’s a spectrum. Assembly on the far end with “everything is just bytes in memory” and Idris and Agdra with their “if the program can crash we will refuse to compile”. There aren’t really any low-level untyped languages except for assembly, simply because assembly code is kind-of typed (at least for every architecture I’ve ever written in) as well and you need to do casts. I would actually recommend you start with C until you feel comfortable with it then move to Rust. If you go straight to Rust you won’t understand why some of the design decisions were made. Rust is also a fairly large language, and is generally of the mindset that people writing Rust are fairly experienced already. You don’t want to have to learn low-level concepts at the same time as functional concepts.

If you want to learn some Rust:

Golang
Rust
Web Development
Programming
Coding
Recommended from ReadMedium