Why I changed my mind about rust
Tags: rust
Published: 2023-08-07 07:40:02

---
title: Why I changed my mind about rust 
published: true
description: The language improved, but most importantly, I changed
tags: [rust]
---

## Article::Article
Five years ago, I heard about Rust, I even tried it. I thought it was cool, but I was not transcended, and did not pursue learning this language. At the time it seemed like a lot of work for only a few advantages. It just felt like a more complicated, less mature, C++ that enforced good practices and with some nice keywords (still waiting for pattern matching in C++).
   
Recently, I gave the language another chance (and also after my brother kept telling me how awesome it was working with it every time I saw him haha) and this time it was a very pleasing experience and I loved it! I don't even see myself use anything else on my pet projects if I have the choice.

In this article we'll see why I changed my mind.

## Evolution of the language
The first and most obvious thing is that the language evolved, the borrow checker improved and there is lifetime elision meaning that it is more readable and faster to type code.

The [try! macro](https://doc.rust-lang.org/std/macro.try.html) is gone thanks to the [error propagation operator](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator) `?` becoming stable, and it is really wonderful to use. It combines very well these libraries like [thiserror](https://crates.io/crates/thiserror) or [anyhow](https://crates.io/crates/anyhow). Error handling is now easy.

The community has grown and is now quite big, meaning that there are a lot more library about almost everything.

There are probably a lot of things that changed, like the async stuff, but I'm not there yet and this part does not aim to be exhaustive and it is more about my experience.

## My evolution
### Who I was
Even if the language has changed, I changed even more. ~~Now I have programming socks and a cat eared headset.~~ Back then, I did not even graduated, I had a some knowledge about C++, a little bit of Javascript and Python, that was it. My only work experience were 2 internships of 4 months and during both internships I worked on brand new projects. The dream! No legacy code! 

### Who I am
I now have a bit more experience, I worked part time during my last year of school, and I graduated 4 years ago. During this time, I worked mainly in C++ and with old code. I even found once code that was older than me (I'm 26).

![Meme, image with archeologists with caption saying that's how I feel when I see code older than me](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f4768wvlfgwntu2dferw.jpg)

Don't get me wrong, old code does not mean bad, but technical debt if not handled can be a mess. Also coding practice changed, smart pointer were not widely used by then, etc.

But most importantly, I learned that even the best devs can write bad code sometimes, maybe they were tired, maybe they were pressured to do it very fast. In the end, sometimes bad code end up in production, it is painful to look at and even more painful to debug. (I'm looking at you the deadlock that happens only in release mode)

![Meme, dog with PTSD from horrors in legacy code](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/okpwyi62qwxzm59p5q2b.jpg)

I could write a lot more about my experience, but to sum up, if good practices are not imposed, the devs won't always use them and using them won't magically solve the problems from 10 years ago.

### Now I can enjoy the features of rust
I'm not here to complain about the code I worked on, overall, it were all good experiences, but what I want to say is that now I understand better the challenges in the industry. I finally see that I was not matured enough to appreciate it. I think that Rust solves a lot of them and that's why my mind changed about it.

## Article::~Article
The language evolved, but most importantly, I changed too. I finally really understand why a language like rust is needed.  
Now I loved it, maybe that's just the honeymoon phase, I'll keep you posted in my future articles. 

## Sources
* [https://crates.io/crates/thiserror](https://crates.io/crates/thiserror)
* [https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator](https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html#a-shortcut-for-propagating-errors-the--operator)
* [https://doc.rust-lang.org/std/macro.try.html](https://doc.rust-lang.org/std/macro.try.html)
* [https://crates.io/crates/anyhow](https://crates.io/crates/anyhow)