Learning Rust as a C# Developer

December 23, 2015
rust csharp

Choosing a new programming language to learn is difficult. What do I want to focus on? Do I want to learn something low level like C? Do I want to go all out functional and learn Haskell? What about Go? Everyone seems to be glowing about that language. Elixir? I hear Rubyists are really digging on that language, and it is built on top of Erlang! So many choices!

As you’ve probably guessed from the title, I ended up picking the Rust programming language as the language I’d like to focus on and learn about. So lets take a little bit of time to talk about why I made that choice.

A way to delve into “systems programming”

“Systems programming” feels like this mythical place of expert developers writing bare metal code to do things I can barely even understad. It is so different from my day-to-day job that it feels almost unattainable. I’ve never written anything in assembly, I can’t really read hex, and I’ve only barely tried to write anything in C. It really feels like such a daunting task to get into what seems like such a complicated topic.

Fortunatly, Rust really feels like an accessible language that could get me learning about systems programming. I can learn how to manage my own memory, how to write performant code, how to work safely with pointers and many other “low level” bits of code. For whatever reason, Rust just feels like I can jump in and actually do something. I haven’t felt that way with C or C++.

A C replacement

I swear, one day I actually am going to get around to learning C. When I do I’m going to do it the hard way. But until I do, one of the reasons I picked Rust is that it is explicitly aimed at replacing C and C++ as the programming language of choice for prople writing performance critical or low level code. I’ve started and quickly stopped learning C and I haven’t found the motivation yet to stick with it and really learn the language. I’m sure I will eventually, but I think the barrier to entry has still been too high for me.

With Rust, I have been able to get going pretty quickly in the language and start to learn bits and pieces about Rust while doing interesting things. I’m sure I could also do this with C, but so far I just haven’t had the willpower to stick with it. Rust, on the other hand, has kept me very interested and very motivated to learn the language.

No GC

Another specific reason I chose Rust was that I wanted to try out a language that does no garbage collection for me. Throughout my career as a developer I’ve worked in a garbage collected language, and honestly it is pretty awesome most of the time. But, since it is the only thing I’ve used before and I want to learn lower level programming skills, I have to learn how to walk away from garbage collection and learn how to manage memory myself.

Modern language features

As a final deciding factor, the language features that Rust provides are very compelling to me. Generics are available and I am familiar with how to use them in C#, Traits (i.e. Interfaces for C# people), pattern matching, etc. are all language features that feel very compelling and interesting to use.

So there you have it, a few of the reasons that I’ve decided to spend time really trying to dig in and learn the Rust programming language. I have much to learn and will likely be sporadically sharing what I’ve come across so far here on this blog.