DEV Community

Lena
Lena

Posted on

Why I changed my mind about 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 is gone thanks to the error propagation operator ? becoming stable, and it is really wonderful to use. It combines very well these libraries like thiserror or 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

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

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

Top comments (1)

Collapse
 
pgradot profile image
Pierre Gradot

Rust is clearly a langage I would like to try on a professional project. It seems very promising!