Originally written on 2023.12.05
After reading more about why people seem to hate this language, I found that most of it was several years old and seemed to follow a pattern I saw with Go; old habits die hard, and learning a new language often comes with bias.
Most of the complaints were from people not taking the time to really learn Rust, sometimes starting with large and complex projects early on. Many times I’ve seen people trying to stick with familiar design patterns and fail because they just don’t translate very well, if at all. I was guilty in the beginning, feeling overwhelmed by the weird syntax and never really taking the time to LEARN, hence this second round of exploration. While it feels quite similar to C and C++, it is not like other languages once you get past the very basics.
The very concept of “ownership” was new to me, but The Book was very clear about the how and why, making sense of “references” on the first pass through that chapter. Pointers have always been a source of great confusion for me, so it’s nice to just “get it” the first time without having to read the same chapter (or even the same paragraph) multiple times. Apparently a lot of Java developers struggle with the “borrow checker”, often resorting to the use of ‘unsafe’ to bypass (and defeat the whole point of) an otherwise safe and sane feature. I don’t know what kinds of problems other people are trying to solve with Rust, but if it seems necessary to bypass the borrow checker, probably in most cases the program should be re-factored because it’s written in ways that just don’t make a lot of sense in Rust. Of course I’m no expert, so by all means do your own research before taking potentially bad advice from me.
Technically I have used some object-oriented facilities before, without even knowing it. Apparently they’re called “methods”, and they’re only used when it makes the code simpler and cleaner than plain-old functions. Rust makes heavy use of methods, so the ‘impl’ keyword was easy to pick up. It also provides encapsulation, so by that logic Rust has “objects”… This is not something I’ve had to use, but I hope it makes sense like interfaces in Go.
Neither Rust nor Go offers inheritance, which is probably for the best because it seems such things are cause for all sorts of problems in C++. Instead, Go relies on “composition”, while Rust has “traits”. Having little experience with anything other than “methods” when it comes to OOP, it stands to reason that learning how Rust handles that paradigm should be easier for me, if ever there comes a time where it’s actually necessary (which is unlikely).
In spite of its supposedly steep learning curve, I’ve been picking up on it rather quickly (to much surprise), so it seems it may have been wise to NOT learn the arcane ways of Java, C++ and other… OOP languages… We’ll just skip the bashing because it really doesn’t serve a useful purpose. Now just to be clear, this is not meant to imply that I’m somehow superior, because really I suck at coding in any language, regardless of paradigm. Rather, it seems that lack of experience has resulted in a smoother transition because there’s little bias. Much of what makes Rust “difficult” for many people is just different forms of otherwise familiar concepts. For me though, it’s all shiny and new, so the old habits that might get in the way are entirely absent.
There are some things I don’t care for, such as the preferred formatting and how slow the compiler is when building seemingly small and simple tools (which often drag in A LOT of crates!). Aside from the quirks, there are some good ideas in this language. It may not be the easiest to learn, but I don’t think it’s that difficult either, just very different. I’ll keep tinkering with it and see if I have better luck than with C, which has been a consistent pain in the ass even for small and simple things.