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

Rust

6013 readers
3 users here now

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

Wormhole

[email protected]

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
32
Why Rust is easy (www.linkedin.com)
submitted 1 year ago by snaggen to c/rust
 

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
[–] [email protected] 9 points 1 year ago (3 children)

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.

[–] GuybrushThreepwo0d 3 points 1 year ago

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

[–] [email protected] 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.

[–] GuybrushThreepwo0d -1 points 1 year ago

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 7 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 5 points 1 year ago (1 children)

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.

[–] [email protected] 5 points 1 year ago (1 children)

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

[–] [email protected] 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 3 points 1 year ago

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

[–] einsteinx2 1 points 1 year ago (1 children)

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

[–] snaggen 3 points 1 year ago (1 children)

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

[–] dinodroid 1 points 1 year ago* (last edited 1 year ago) (1 children)

Some of this applies to Go too. But it has easier learning curve to begin with.

[–] [email protected] 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.

[–] tiny_fingers 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).