
Learning Rust in 2020 - yannikyeo
https://github.com/pretzelhammer/rust-blog/blob/master/posts/learning-rust-in-2020.md
======
steveklabnik
> When I started learning Rust I made the mistake of following the advice to
> read The Book first. While it's a great resource, it's pretty overwhelming
> for a beginner to get told "If you'd like to learn this programming language
> the best way to start is to read this 20 chapter book!" Most people give up
> before they even get started when they get advice like this. Nobody ever
> told someone to read a 20 chapter book just to get started with Javascript
> or Python. Rust's learning curve is no joke but you gotta give the people
> what they want, and they want to program, not read about programming.
> Programming is fun and reading about programming is not as fun.

As one of the authors of the book, I wholeheartedly agree that it's not for
everyone. Folks should learn in the way that works well for them. I'm glad
this resource exists!

~~~
dpwm
I don't usually like programming books. I am usually easily overwhelmed by
them and I find that they are at the wrong pace for me.

This weekend I read most of the Rust book without much effort and found it
really helpful for getting up to speed with the language, especially the more
novel bits around safety. It took me to the point where I was able to explore
and evaluate the bits of the language I needed with only library docs. I know
that the remaining chapters are there for when I am ready for them.

My experience with the Rust book as made me more likely to consider starting
with a book when approaching programming languages in the future.

Reading other comments, I recognize that I was fortunate to have a project in
mind that motivated my reading of the book and just happened to be an
excellent fit for Rust.

~~~
wwee
As someone who already programs in multiple high-level languages, I feel that
the Rust book hits the sweet spot for me. It doesn't go over basic programming
concepts which I already know, and focuses on fundamental, unique concepts of
Rust. I feel that the scope is pretty close to perfect as well, it doesn't try
to cover every single detail. (The Rustonomicon serves as Part 2 for me)

------
ggregoire
I wish every language had the equivalent of
[https://tour.golang.org](https://tour.golang.org).

Edit: hey thanks to both answers, bookmarking it for later. I'm learning
Haskell right now and it definitely misses something like this.

~~~
steveklabnik
Our version of this is [https://doc.rust-lang.org/stable/rust-by-
example/;](https://doc.rust-lang.org/stable/rust-by-example/;) though someone
recently tried to start a more direct port!

------
k__
Nice!

I just started learning Rust for a WebAssembly project.

The people on the Discord server are nice and quick to answer questions.

The ebooks I found online are a bit hard to grasp. At least for a JS dev like
me.

I mean, for the basics they're okay, but what I'm missing is how to write
"good Rust code". There are always multiple ways to do things (Option/Result,
try!/?/unwrap/expect, loops/map/fold, etc.) and I already produced some
runtime errors, haha

~~~
shred45
I'm not sure how the broader community does it, but the Rust developers that I
know (myself included) will typically get the code working and compiling with
panics and unwraps (especially when working with a new API or just
experimenting) and then do a second pass to "remove panics". This typically
involved reviewing your code thoroughly, finding each panic / unwrap / expect,
and using this to identify how your functions can fail. This is a good time to
create error types for your API and note these cases in your documentation.
You then convert functions which can fail to a Result and all of the unwraps
etc. to ?. This can be fairly mechanical and really gives insight into ways
that your code can fail and edge cases, but does take time.

As far as loops vs maps, I've found that your use case typically guides this.
I think this is the same with other languages like Python. You aren't going to
want to write a ton of complex logic in deeply nested maps and filters. But if
you just need to do something more simple it might make more sense to do it in
a map one-liner.

Edit: The presentation linked to in the other reply appears to confirm this
process of starting with dirty compiling code and then refactoring out the
possible failure modes. It covers a lot more things like using match and
handling errors from other libraries.

------
memco
I've been working through the Rustlings exercises for the past week or two. I
get through a handful at a time (spending 20 min to an hour) and have done
maybe 5 or 6 sessions. It doesn't seem short to me (doesn't seem long either,
but it isn't like I blew through it in a few hours). It can be confusing as
the hints are sometimes really vague. I've cobbled my way through so far and
if I've gotten stuck I just stop and come back to it another day. Usually I
can progress quickly with fresh resolve. It is nice in that it helps you learn
the syntax, but it doesn't seem to help me much with the concepts. I feel this
is in part that when you run `rustlings watch` it doesn't first point you to
the section of the book you're reading it just throws broken code at you and
tells you to run `rustlings hint <foo>` which only sometimes points to the
book. Most of the time you are just given broken code and asked to fix it with
some suggestions of where to look in this specific code. I have completed 53
exercises and am in the process of working on standard library types. I could
go into some more specific details if anyone is curious about my experience.
Hoping to post my annotated work through to github when done, but I could
either copy out the few bits that were particularly vexing or could post the
code with my comments now for people to peruse. One thing I would like to find
is a place to start interacting and asking questions. Heard someone mention
discord so I'll maybe start there or on IRC.

~~~
pretzelhammer
Hi, author here. Rustlings took me only a few hours but I came back to it
after I had already finished reading The Book and finished about ~100
exercises between LeetCode and Exercism, so my experience with Rustlings
wasn't that of a "true newbie". I still think it's one of the best resources
out there, but like anything it can continually improve.

Your feedback as a beginner is very valuable! If you have some structured
feedback for Rustlings please consider opening an issue on the repo. Also, the
official Rust Discord Server is very beginner-friendly and has a #beginners
channel, if you're struggling with anything don't be afraid to join and ask
your question. The invite for the server is here
[https://discord.com/invite/rust-lang](https://discord.com/invite/rust-lang)

------
jonnypotty
Im kind of dismayed that we're told that reading about programming isn't fun.
Also we're told what people like and what they don't. Is this what "people"
like and don't like or what the author likes and doesn't like?

Learning the hard concepts in rust is exactly where the value lay for me. For
some people I guess copying things and getting results without understanding
is rewarding and I'd never say people shouldn't do that but author should not
be telling people not to read. It's terrible advise.

~~~
pretzelhammer
Hi, author here. I enjoy reading about programming and I think it's fun, just
not _as fun_ as programming. I tried to choose my words carefully because I
didn't want to come across like I was bashing reading. Perhaps I should have
said, "reading about programming is fun but programming is even more fun."

Learning the hard concepts in Rust is the best part, but The Book isn't going
to teach you those. The Book, by design, is a very broad but shallow overview
of the entire language. It'll never teach you, for example, why you can't
write a self-referential struct in Rust. That's a lesson every Rustacean has
to learn the hard way: by programming in Rust. And that's what I hope to
encourage more Rust beginners to do: learn the hard lessons by actively
programming in Rust.

~~~
jonnypotty
I get where you're coming here, maybe the concepts in the book weren't
difficult for you, but they were for me. I tried Rust without the book and got
disillusioned so quickly as I didn't have the vocabulary to understand the
docs or a lot of discussion (stack overflow etc) i bought the book and it
openened up so much understanding for me and now I have a couple of Rust
projects on the go.

I guess it upset me a bit because I didn't find Rust fun at all until I had
the book and I could see how your piece could discourage people from buying
it.

------
armSixtyFour
+1 for rustlings, it's fantastic, I went through it right after reading
through the book. The books are good, but it's hard to compete with being
hands on like rustlings is.

