Re:Ask HN: How long did it take you to become comfortable wi...
by bitbasher on Saturday November 16, 2024 @05:37PM
(#42160015)
Thanks.
I have a copy of Programming in Rust on my desk! I'm slowly working through it (it's quite the tomb). I have also been reading the 'official' Rust book online (it's lighter and more of an introduction).
I'm a bit more hands-on so I have been doing the reading while doing actual coding. I have built a few web APIs with actix and working through coding exercises (https://rust-exercises.com/100-exercises/).
I feel the biggest issues I'm having are around ownership and lifetimes, especially in a long running process with many pieces (like an API server).
I tried reading "The Rust Programming Language" book, but had difficulty with it.
The book that worked for me was "Programming Rust": https://www.oreilly.com/library/view/programming-rust-2nd/97...
The way that it explained things made more sense to me and helped me to understand many of the design decisions behind why Rust works the way that it does.
But reading books only takes you so far. You need to write code and read code to understand through experience. I took a C program that I wrote at my job and rewrote it in Rust. It was a revelation: in writing the Rust version I discovered many bugs that were not obvious in the C version simply because of Rust's detailed approach to error handling. The Rust version was much easier to understand and maintain and is the one we use now.
I was originally very skeptical of Rust, but if you write software in C or C++ and then write comparable software in Rust, it makes you want to use Rust every time instead. Rust code helps prevent errors of all types that C and C++ allow. Rust tooling and the ecosystem of crates are so much easier to use.
Here is a quote from "Programming Rust" that I found motivating: