The Rust Review: Starting Your Rust Journey with Galin Kostov

4 min

Welcome to the fifth edition of our Rust Review series, a deep dive into the world of Rust programming guided by industry experts. In this edition, we're thrilled to introduce new guest bloggers making waves in the Rust community. Join us as we explore their insights, experiences, and the stories behind their code. This chapter offers a genuine look into the practical side of Rust development.

Meet Galin Kostov, a seasoned backend developer with over a decade of experience in NodeJS and TypeScript. His journey into Rust began with a curiosity sparked by its acclaim for systems development. Despite encountering challenges in a fluctuating job market, Galin's commitment to Rust never wavered, driven by the belief in its future significance in systems and blockchain development. Join us as Galin shares his first-hand experiences and invaluable insights on mastering Rust.

About me 

I've been a backend developer my whole career. I've been developing in NodeJS (and TypeScript) for over 10 years now. But I’m not just your regular “web APIs dev”. Throw in a bunch of DevOps, systems design & architecture, distributed systems, and you'll get a picture of me. 

That is why, when I heard of Rust, and how everyone praises its suitability for systems development, I naturally got interested. 

I first heard of Rust from an ex-colleague who left a NodeJS job for a Rust job. This was back in 2021, one year after the “DeFi summer” when Rust jobs in the Blockchain industry were super hot. Blockchain startups were hiring devs for Rust positions even without prior Rust experience! 

Unfortunately, by the time I learned Rust well enough to get hired with it, we had entered a bear market and the employment market was cold. 

Nevertheless, I stuck with Rust, because I knew it was going to be the future of systems and blockchain development! 💪🚀 

What does Rust give you? 

To me, there are four main, most important things that I found beneficial and superior in Rust to any other language: 

  1. Strong typing
    I know I know… other languages have this as well, but I will just mention it anyway. If you're a backend dev used to NodeJS, and then you've switched to using TypeScript, you will know the advantages you get with strong typing. JavaScript can give you a lot of headaches with issues like random undefined situation when you're chasing down a bug. And that happens because the language is loosely-typed and sooner or later you mess up by passing the wrong parameter somewhere. This will never happen with Rust. 

    2. The (in)famous borrow-checker
    This is something new to the industry, that Rust introduced. The Rust compiler takes care of checking whether anywhere in your code you are accessing memory in the wrong way. That's why they say Rust is a memory-safe language. If you've worked with C, C++ or Go, you'll know what I’m talking about. Let me try to explain in plain English through an example… Variables (and everything else) in computers are stored in memory at certain slots/addresses. So, if I have variable foo that has value "bar", then that value is stored at memory address e.g.0x123Generally, variables are passed to functions by value. This means that only the value of the variable is passed to that function or in other words, just "bar". This in turn means that inside the function, if you update the variable with new value, f.e. foo = "bazzz", the change is only happening inside the scope of that function, and doesn't affect the original variable that was passed: 

// we use JavaScript as an example 

const foo = 'bar' 

function changeFoo(inputFoo){ 

inputFoo = 'bazzz' 



changeFoo(foo) // prints 'bazzz' 

console.log(foo) // prints 'bar' 

In languages like C, C++, Go, and Rust, you can pass a variable by reference. This means that you don't pass the value of the variable to the function, but instead you pass the memory address of the variable, namely 0x123. That allows you to change the value stored on that address directly. This happens by passing to the function a pointer to the memory address of that variable. 

When you do that (pass by reference), if you’re not careful when you change the value of the variable, you can really mess up some logic of your program and sometimes it could be hard to find the issue. As a result of bugs related to such memory mismanagement in large applications, this can lead to the loss of big amounts of money. 

Now, going back to the borrow-checker… What it does is it allows a variable to be changed by only one owner at a time, and this check is done already at compile time. This way you have a clear separation between acts of reading and acts of modifying the value of a variable. 

Bonus info: I called the borrow-checker infamous because it's one of (if not the) hardest concepts to grasp for newcomers to Rust. 

3. The compiler
I've not experienced such a helpful compiler with another language. The error and warning messages come with clear explanations about what and where exactly it went wrong. And you even get suggestions about what or how you can improve to fix the compilation issue. It's like the compiler is your friend! 

4. Cargo 
The package manager. Do you know npm? Well, cargo is to Rust as npm is to NodeJS. But it comes with a bunch of extra cool features. First, it has all the built-in commands to deal with compilation. Then, it also has built-in commands for running tests. 

But what is even cooler (and what blew my mind the most) - it has a built-in code formatter and a linter! This is one thing I've only seen in Go so far - you have an industry-defined standard for code formatting. Pretty or ugly, hate it or love it, it's there and everyone is using it and no one is arguing about it. Just focusing on the code. 

My suggestions for steps to learn Rust 

I'll be short and straight to the point here because there are no workarounds. Rust has a steep learning curve and you just have to grind through it to learn it. 

I started with the LetsGetRusty YouTube channel. It has a series of videos starting from the basics to explaining complex topics. So, it's very suitable for beginners. Nevertheless, I didn’t find it very useful, because learning by watching video content is not my thing. But if you're one of the people who soaks in knowledge from video content - you should give LetsGetRusty a go! 

What worked well for me is a different path: 

Firstly, I read through the whole book of RustByExample. It is something like a shorter version of The official Rustlang book. What I like about RustByExample compared to the official books is that it focuses on the most important things and every explanation is based on code examples. So, I literally just read through the whole of RustByExampleto get a good grasp of the syntax. Because Rust introduces a lot of new paradigms in the world of coding. I knew I was not going to remember everything from the book, but it didn't matter that much. I knew that reading the whole thing would give me a very good overview of the syntax, and whatever I didn't remember, I would know exactly where to come back and search for. 

Afterwards, I went through quite a few of the development steps in the Comprehensive Rust course by Google. It is very similar to the RustByExample book but has actual coding exercises. It's very neat and useful to slowly get your hands dirty with the language. 

And last but not least (or maybe even most important) - I started coding real things. Throughout my career of over 10 years in software engineering, I've always found it most useful to do actual coding of real-world apps when I need to learn a new technology. But it's hard to come up with an idea for an app to code, isn't it? Especially for a systems language like Rust or Go. Coding just another web API isn't that interesting… Well, you're in luck, because I’ve found the best place to get ideas for real-world apps to code. And they come with step-by-step guidance on how to actually do them. I introduce to you the Coding Challenges by John Crickett (I promise this is not a paid promotion 😄). It's up to you how many of them and which ones to do. But, of course, the more - the merrier. 

And there you have it. It took me about two months to go through these not-so-simple steps. And I actually did get a job with Rust afterwards and was pushing out production code in less than two months. 

So, actually, Rust is not that scary, honestly. 🙌 

Hit me up on LinkedIn, if you want to connect.