How to Learn Modern Rust(github.com) |
How to Learn Modern Rust(github.com) |
I'm planning to learn Rust next, going to start in a week after a job interview I had already lined up at Google.
I worked with many languages professionally (JavaScript, TypeScript, Java, Python, Go, and now Dart) and many others at the university (C, C++, C#)...
...and Rust is very appealing to me. It's a modern language where the dev tools are straightforward, no need to deal with learning 30 years of legacy conventions, great performance that's on pair with C/C++, yet, at the same time high level and easy to read and reason about. The language is still young enough to make a dent in the ecosystem and build stuff for fun without people whining about JavaScript fatigue. It's versatile, so it can be used (at least theoretically) for web backend, frontend, desktop apps, command line tools, systems programming. It has all the good parts from OOP and FP.
Yes, I'm at least partially responsible for having "xyz rewritten in Rust" almost every day in the top list on HN.
One thing in a bit worried about is the job market, I've been paying attention to job adverts for months and I didn't see many companies that I'd like to join that use Rust in my area (Germany).
Learning it and doubling down on Rust feel like a gamble, but at the same time, I can't imagine that Rust will not be one of the most important languages of the next decade.
I recently added a Rust keyword to my LinkedIn profile and Who's Hiring threads, just to test the waters. Many EU companies of all sizes got in touch with really interesting proposals.
It's a systems programming language, so there are lots of problem domains it can cover.
welp.
As someone new to this industry, I'd love to hear a counter argument to this if anyone has one.
Of course one can also use Rust for applications which previously used Java, and still benefit from a stricter type system and a potential efficiency improvement. But the selling proposition becomes a bit tougher. Con's for adopting Rust are the higher complexity, and a potentially reduced developer ecosystem for particular domains which have a ton of Java/C#/Go/Javascript libraries.
I can’t say I’ve ever known Rust very well, but I knew the basics and decided to wait and see before investing more time until there’s a clear sign that the language is becoming popular outside blockchain.
I don’t regret learning Rust, but haven’t seen any benefits either given my many years of C++ experience.
My approach has been considerably, uhh.. lazier, if you will:
I just read through the rust book available on http://rust-lang.org. It is easy to follow although, sometimes it doesn't fully explain the "why" behind certain things to idiots like me. For that, I turned to a quick online search, which brought up helpful blog posts, Reddit and Stack Overflow posts.
Thats it. Next, I'll try to wrap my head around Actix to create a web server.
Releases tend to bring some minor improvements like functions you wished had always existed or making non-const functions const, but that's pretty much it. Rust is a remarkably stable language.
If you are not specifically interested in super high performance systems level code, my second piece of advice would be to write code that avoids lifetime annotations until you get the basics of the borrow checker down.
For me, this meant writing a gRPC API with Rust using `tonic` with a `diesel` based persistence backend and observability with `tracing` and `opentelemetry`. This gives you a good survey of the basics and you'll learn about all of the core traits and language features in the process.
Maybe I'd reframe it as "just start writing code, and use RC<> liberally to avoid lifetimes until you get a handle on them."
Also avoid async for that first project too.
This started to disgust me so I jumped to sqlx.
I’d say the guide to learn modern rust could be much simpler - read The Book, write some code, and listen to Clippy (the linter) and apply rustfmt regularly.
Almost all Rust code out there looks similar to each other because they pretty much follow this process - follow the standard linter and code formatter. The best part is, each Rust release introduces few changes so it’s easy to stay in tune with best practices.
The substring section[1] looks a bit weird though. If you're learning Rust, diving right into how to work with char indices instead of byte offsets does not feel like the right thing to cover right away. You might really need that, but chances are you don't and would be much better served by a section that talks about how you probably don't want char offsets at all. But even that doesn't seem like you should whack a beginner with right away unless they have a specific hang-up on it.
Beginner string stuff should be talking about string representation and going over the &str and String APIs. And depending on how early you get to it in the overall tutorial, probably using it as a springboard to talk about lifetimes.
But writing code so you can go out of your way to do something that is probably wrong in the first place? Noooooo.
Anyway, sorry to pick at this specific point, but the Gell-Mann amnesia effect comes to mind.[2]
[1]: https://github.com/joaocarvalhoopen/How_to_learn_modern_Rust...
[2]: https://en.wikipedia.org/wiki/Michael_Crichton#GellMannAmnes...
I haven't written Rust in 3-4 years, and trying to get back into it is painful.
I'm actually looking forward to Rust having a few more years under its belt so I can do more than experimentation with it (and yes, I've seen the Oxide stuff, and there is plenty we can call stable right now -- I just want it to be a bit more weathered...).
Rust: started 2006, announced 2010, 1.0 2015
The weathering on the two languages seems fairly similar.
In fact it could be argued that Rust is more stable. Golang is talking about a breaking Go2, Rust has a fairly good forward compatibility story and plans.
In particular, the intricate dependencies needed to do basic stuff, and choosing among many approaches.
I'm either missing something or words don't mean what they used to...
There were substantial changes in work flow and tooling each time I dove in and learned the correct way to do things.
Also, since it was released a lot of patterns have evolved to work around the restrictions the language puts in place, and those are good to learn.
Companies that started before Rust gained critical mass might already have significant investments in one language and don’t want to rewrite. This is the majority of companies. Let’s say GitHub won’t rewrite their main Ruby application, but if they were writing a new code search backend, they might choose to write that in Rust. The majority of GitHub devs would continue to write Ruby.
That means older companies (started before blockchain was hot) are going to skew towards older languages while newer companies are more likely to adopt newer tech.
Still using it for personal projects.
The messaging around the 2018 edition was a little different here, with some attempts to use the edition release as an opportunity to advertise and summarize all the features that had shipped since 2015. But I think folks decided that was confusing, and with the 2021 edition the messaging was toned down.
Informally though, I think there are certainly a subset of people that use "Rust 2021" to mean all of the features included up to that point, even if it's not the precise definition.
Rust has no plans for 2.0 either.
Both are stable languages that have been making steady progress.
The second link has Rob Pike state that there probably won’t ever be a Go 2.