32
Why Rust is easy (www.linkedin.com)

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.

top 15 comments
sorted by: hot top controversial new old
[-] Anders429@lemmy.world 8 points 1 year ago

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

[-] open_world@lemmy.world 2 points 1 year ago

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

[-] tatterdemalion@programming.dev 6 points 1 year ago

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.

[-] snaggen@programming.dev 5 points 1 year ago

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.

[-] taladar@sh.itjust.works 5 points 1 year ago

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,...

[-] open_world@lemmy.world 2 points 1 year ago

I couldn't agree more. Dealing with bugs in test/production is so much worse all across the board in my experience.

[-] jersa@programming.dev 3 points 1 year ago

Man, this might even motivate me to stop putting it off and just jump on the train.

[-] dinodroid@programming.dev 2 points 1 year ago

Some of this applies to Go too.

[-] taladar@sh.itjust.works 2 points 1 year ago

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.

[-] einsteinx2@programming.dev 1 points 1 year ago

I’m genuinely interested in reading this blog post but looks like you forgot to link it

[-] snaggen@programming.dev 3 points 1 year ago

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

[-] einsteinx2@programming.dev 3 points 1 year ago

Thanks, yeah looks like it was a Memmy app bug. I just opened the post in a browser and the link is there.

[-] tiny_fingers@programming.dev 1 points 1 year ago

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).

this post was submitted on 06 Jul 2023
32 points (94.4% liked)

Rust

6055 readers
94 users here now

Welcome to the Rust community! This is a place to discuss about the Rust programming language.

Wormhole

!performance@programming.dev

Credits

  • The icon is a modified version of the official rust logo (changing the colors to a gradient and black background)

founded 1 year ago
MODERATORS