Have you ever heard that Rust is difficult and has a steep learning curve?
In this blog post, the author will explain why he believe that is wrong and, in some cases, easier than some other programming languages.
I think this article is spot on. A lot of people I know were turned off from Rust because the compiler was so much stricter than what they were used to, which tends to frustrate experienced devs quickly, in my experience. But it’s not that the compiler is overly strict; the errors it catches would almost always become problems later. It’s just that reducing the number of compile-time errors doesn’t feel like progress as much as reducing the number of run-tine errors, because you haven’t actually run the program successfully.
Once you use Rust for a long time, you adapt to the compiler and can get things to compile much quicker. That’s where the satisfying part of programming in Rust comes. You get to where you write code and it just works, first try.
You get to where you write code and it just works, first try.
Eh, I write plenty of Rust code that doesn’t work. But at least I haven’t had a segfault in a while
Yeah, I think Rust ends up front-loading so many of the problems/frustrations you’d end up having, at the benefit of having much better, safer, and performant code in the long run.
You get to where you write code and it just works, first try.
Eh, I write plenty of Rust code that doesn’t work. But at least I haven’t had a segfault in a while
The first figure showing color-coded effort is close, but I would say Rust’s blue “business logic” portion should be smaller. Pattern matching and linear data types can encode a state machine so much more accurately than C. You’re more likely to get the business logic right the first time if you know what patterns to use.
I think the author is correct about the compile / test ratio being drastically shifted in rust vs other languages. One thing to have in mind regardng this, is that in larger companies testing may be performed by a dedicated team. Hence, a shift to rust will give the impression of a much higher workload for the developers. In reallity the workload should be pretty much the same since the bugs from testing still needs to be fixed, but that will be spread out over a larger time span due to going by the test team first.
The other thing to consider is that any bug that makes it to the testers or even to production code takes so much more effort to fix than if you had caught the same bug early on. No communication overhead with the testers, no fixing corrupted data in the live database, no scheduled downtimes,…
I couldn’t agree more. Dealing with bugs in test/production is so much worse all across the board in my experience.
Man, this might even motivate me to stop putting it off and just jump on the train.
I’m genuinely interested in reading this blog post but looks like you forgot to link it
Must be some glitch or something, the link is there for me… but here is the link anyway: https://www.linkedin.com/pulse/why-rust-easy-tue-henriksen
Thanks, yeah looks like it was a Memmy app bug. I just opened the post in a browser and the link is there.
Some of this applies to Go too. But it has easier learning curve to begin with.
Go is very different from Rust. I haven’t fully learned it but I have tried to find some bugs in some of the Go tools we use and Go code makes it very hard to find the actual business logic in between all the low level stuff that would be abstracted away in Rust.
As someone learning Rust right now (reading through The Book and doing rustlings), most of the basic concepts have been straight forward and easily carried over from the languages I currently work with.
However, as someone who hasn’t touched c or c++ in the 20 years or so since university, the ownership stuff has made my brain hurt. That section in The Book has been a real slog for me and I’ve had go through that section several times now, but still haven’t truly ‘got it’ yet.
All that said, I do like the compiler helping ensure I’m writing good code and in that regards, I can see why the author says that Rust is easy. Instead of beating your head on a desk trying to track down some obscure bug, with Rust, there’s a good chance it’ll tell you where the bug is and why it won’t let you compile (at least based on my beginner understanding).