[HN Gopher] Comprehensive Rust: course used by the Android team ...
       ___________________________________________________________________
        
       Comprehensive Rust: course used by the Android team at Google
        
       Author : ingve
       Score  : 195 points
       Date   : 2023-05-23 18:01 UTC (4 hours ago)
        
 (HTM) web link (github.com)
 (TXT) w3m dump (github.com)
        
       | tripdout wrote:
       | The dive into using it in AOSP is very cool
        
       | mmastrac wrote:
       | I'm very happy I dug into rust half a decade ago. The language
       | has been fun to learn as it evolved futures and async/await, and
       | the future continues to look promising. I've had the pleasure of
       | working professionally in Rust twice in my life (once at Full
       | story, now at Deno) and I can say it's by far my favourite
       | language to work in.
       | 
       | I did some Rust training with Ferrous but by far the most useful
       | way to learn was just picking up a project and building it.
        
         | zokier wrote:
         | I'm glad I've been following rust since <1.0 when it was lot
         | smaller (tbh because it was missing stuff), I don't know if I'd
         | have the perseverance to start learning it today from scratch
         | just because the depth it has. Admittedly having bit of C++
         | background smoothed the curve too.
        
         | echelon wrote:
         | I wasn't aware FullStory used Rust! That's good to know. I was
         | worried I might have a hard time hiring folks in Atlanta with
         | Rust experience.
         | 
         | The more Rust proliferates, the better. It's good at client,
         | server, systems, and so many other things.
        
         | brabel wrote:
         | I envy people who can pick up Rust and just get stuff done.
         | I've tried many times but every time, I find it far more
         | difficult to build things than any other language I know, so I
         | just give up and go back to "easier" languages.
        
           | bandika wrote:
           | What I find difficult is to switch my 2 decade C++ career
           | into a rust job, despite learned Rust and finished some hobby
           | projects touching ui, async and http server/client in Rust.
           | Somehow most Rust job is about crypto currency.
        
           | paxys wrote:
           | I find that a lot of people just pick wrong kinds of projects
           | to dig their teeth into Rust with. It is a systems
           | programming language. If you don't know much about it and set
           | out to build a website, things are inevitably going to go
           | south.
        
             | echelon wrote:
             | Actix and Axum are so easy. They're a drop in replacement
             | for Golang or Flask.
             | 
             | I'd encourage people to start their Rust journey with
             | little web services.
        
           | jbandela1 wrote:
           | I think previous experience programming in C++ can be
           | helpful, in picking up Rust faster.
           | 
           | For me, in large part, the borrow checker is encoding in the
           | compiler rules that you should be following in C++ anyway.
           | 
           | A few hours debugging dangling references or iterator
           | invalidation will make you appreciate what the borrow checker
           | is trying to prevent.
           | 
           | You also have experience knowing the difference between pass
           | by reference, pass by const reference, copy, and move.
           | 
           | Also, if you want to keep your sanity, you will learn to take
           | ownership seriously. Deciding what owns what and whether
           | objects will be owned by the scope (on the stack), be owned
           | by unique_ptr, or be shared with shared_ptr is a large part
           | of designing a C++ program.
           | 
           | Again these all map very neatly onto Rust idioms, and as a
           | benefit are enforced by the compiler.
           | 
           | Coming from a garbage collected language where you previously
           | did not have to care about things like that, and now, not
           | only being forced to care, but having the compiler yell at
           | you for every mistake can be a pretty big learning curve.
           | 
           | However, I would say that not knowing C++ doesn't mean that
           | you can't learn Rust, only that it may take a little longer
           | because you have to learn new concepts with regards to memory
           | management and ownership, and so give yourself some slack and
           | do not be discouraged.
        
           | dceddia wrote:
           | I agree with the OP that the best way to learn it is to work
           | through a real project, but I wouldn't necessarily equate
           | that with "picking it up and just getting stuff done". At
           | least, that's not how it went for me, anyway! I hit all the
           | real roadblocks along the way and it took a good few months
           | before I felt actually comfortable. Until then, it felt like
           | I kept running up against mismatches between how I wanted to
           | solve a problem and how Rust wanted me to do it. It was more
           | difficult to build stuff and I had to rewrite things many
           | times. For background, I had worked with C/C++, Java, JS/TS,
           | Ruby, and some others prior to Rust, and it was the first
           | time in a while that learning a new language was pretty hard
           | even after the syntax made sense.
        
           | echelon wrote:
           | Pick up Actix or Axum and clone() and unwrap() all day for
           | your first month. Write some little web servers for fun. Sqlx
           | is great for sql, and you can do some heavy hitting stuff
           | like media streaming and transcoding as you get deeper into
           | it. It's got good torch bindings for ML too.
           | 
           | Before long you'll be running the compiler in your head and
           | rapidly churning out code.
        
           | yboris wrote:
           | I suspect this is about experience.
           | 
           | I had experience with PHP, JavaScript, and Python, but when
           | at first coding in _Go_ it would take me as much as 10x as
           | long. But with more practice it 's now only about 2x as long
           | as in other languages. Keep practicing ;)
        
             | brabel wrote:
             | I think my experience is actually the problem. I don't have
             | enough patience anymore to spend lots of time trying to
             | understand errors where I have zero idea why it's
             | complaining, when I know the same thing in another language
             | works totally fine the first time I try (and without bugs,
             | it's mostly lifetime issues or the lovely borrow checker,
             | which don't even exist in other languages). But I do keep
             | trying Rust, because the alternatives as I see it, C and
             | Zig, have their own problems that are bigger (C's build
             | tools and lack of package management, very weak type
             | checking and unavoidable UB, and Zig's overall lack of
             | maturity and consequently tooling).
             | 
             | By the way, I can write code very easily in
             | Java/Kotlin/Groovy/Dart/JS/TS/Go/Lisp.
        
               | db48x wrote:
               | Yea, that's a common complaint coming from other safe
               | languages where the safety is accomplished by runtime
               | features (such as garbage collection) instead of compile-
               | time rules.
               | 
               | I think that most programs should be written in easier
               | languages than Rust, since most of the time the
               | engineering cost of creating a system is higher than the
               | cost of running it. You can rewrite it in Rust once your
               | system is large enough that eliminating the garbage
               | collector will save you a few million dollars a year. By
               | then you'll have a complete understanding of the
               | requirements, and you won't have to experiment to get it
               | right. Use a language like Lisp, which is designed for
               | easy and fast experimentation, to write the first version
               | of your software.
        
       | rickstanley wrote:
       | From https://google.github.io/comprehensive-rust/:
       | 
       | > This site uses cookies from Google to deliver and enhance the
       | quality of its services and to analyze traffic. [Learn more] [Ok,
       | Got it!]
       | 
       | No reject? :|
        
       | renewiltord wrote:
       | Cool thing. I currently use ChatGPT to provide me some exercises
       | as I get better at the language. This is more like a presentation
       | that needs accompanying conversation from the presenter.
        
         | beeburrt wrote:
         | > I currently use ChatGPT to provide me some exercises as I get
         | better at the language.
         | 
         | That's a good idea, thanks! I'm gonna do that too
        
       | beeburrt wrote:
       | This seems like an awesome resource, but for a self learner like
       | myself, not so much.
       | 
       | It's assumed that this book is accompanied by an experienced rust
       | dev for a lecturer.
       | 
       | The posted link is to the GitHub repo, here's the link to the
       | book:
       | 
       | https://google.github.io/comprehensive-rust/
        
       | adolph wrote:
       | It is interesting that they have a day devoted to embedded using
       | MicroBit v2.
       | 
       | The older Rust-Embedded Discovery book [0] also used Microbit but
       | the later edition [1] suggests a STM32F3DISCOVERY. For RISC-V and
       | Extensa fans there is also Ferrous Systems' Embedded Rust on
       | Espressif training material [2] which has a coordinated board [3]
       | that has been "cloned" by Wokwi [4].
       | 
       | 0. https://docs.rust-embedded.org/discovery/microbit/index.html
       | 
       | 1. https://docs.rust-embedded.org/book/index.html
       | 
       | 2. https://esp-rs.github.io/espressif-trainings/
       | 
       | 3. https://www.amazon.com/dp/B0B4FPV9FW
       | 
       | 4. https://wokwi.com/projects/new/rust-esp32-rust-board
        
         | zokier wrote:
         | For embedded Rust the biggest thing imho is that Infineon, a
         | _major_ microcontroller company, is officially supporting Rust
         | https://www.infineon.com/cms/en/product/promopages/rust/
        
           | steveklabnik wrote:
           | Don't forget Espressif too.
        
       | RcouF1uZ4gsC wrote:
       | Rust is the first systems programming language since C++ I have
       | seen pushed by multiple large tech companies.
       | 
       | Go was pushed primarily by Google
       | 
       | Swift was pushed primarily by Apple
       | 
       | C# was pushed primarily by Microsoft
       | 
       | I am seeing a push for Rust by Microsoft, Google, and Amazon.
       | 
       | In retrospect, it almost seems that Mozilla closing the Rust team
       | was a good thing for Rust as a lot of the Rust developers ended
       | up at other companies and Rust became more than just a Mozilla
       | language.
        
         | junon wrote:
         | As someone who once despised working with Rust pre-v1, I firmly
         | believe Rust _is_ the future.
        
         | seabrookmx wrote:
         | Honestly all three languages are great in their own ways, but
         | you're right in saying none of them really hit that low level
         | "systems" niche.
         | 
         | I'm a big C# fan but I see very few use cases where I'd
         | consider both.
        
         | loeg wrote:
         | I believe Rust evangelism spread to other companies long before
         | Mozilla stopped incubating the language.
        
           | steveklabnik wrote:
           | That is correct. These other companies were already employing
           | people who worked on Rust in some capacity when all that
           | happened.
        
         | whatyesaid wrote:
         | Rust is actually more suited to those companies than the
         | general public (small companies and individual programmers) so
         | it makes sense they do push it hard.
        
           | _rs wrote:
           | Why would you say that is, or why do you think so?
           | 
           | I would argue Rust is definitely suited towards small
           | companies and individuals for a lot of projects that C/C++
           | would've been used for before, even things like small audio
           | units or plugins
        
             | howinteresting wrote:
             | Rust has many design features that make it work well for
             | larger teams.
        
       ___________________________________________________________________
       (page generated 2023-05-23 23:01 UTC)