10

I Tried the Free Rust Courses from Google and Microsoft

 10 months ago
source link: https://medium.com/young-coder/i-tried-the-free-rust-courses-from-google-and-microsoft-41e20ff7b2b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

I Tried the Free Rust Courses from Google and Microsoft

Here’s which one did the best job introducing the language

1*2Kd6wGd9_b6zcEk_zmUwpg.png

Life’s never too short to learn another programming language, and I’ve had Rust — winner of Stack Overflow’s most loved language for the past eight years — on my list for quite some time. I like its profile as the sensible person’s low-level language. And I’ve watched it stack up wins and even sneak into the Windows kernel. So I knew it was time to get better acquainted.

As a programmer, I spend most of my time in JavaScript and C#, two languages that have syntactical similarities to Rust. However, it’s been two decades since I touched a raw memory pointer, and when I think about code it’s usually in the front end of an application or in the business layer. Rust can do all that, but its superpowers appear when you use it as a systems-level language, handling memory directly and running close to the underlying hardware. In other words, some of the challenges Rust solves are not the top areas of concern in my world… which makes it that much more interesting to play with.

The Rust Playground

To learn Rust, you obviously need to write and test your own Rust code. There are two easy ways to get started:

  • The Rust Playground. Unlike JavaScript developers, almost every Rustacean uses the same online playground to try out their examples. Besides the essential features you expect, the Rust Playground also has access to Rust’s top 100 packages, and support for the most popular Rust linter (Clippy) and formatter (rustfmt).
  • A code editor like VS Code. Rust follows the relatively new language server protocol, a model where a dedicated language server provides features like code completion and navigation to any IDE. In VS Code, the rust-analyzer extension is all you need to use this integration and write your own Rust scripts.

Both are great choices (and there’s nothing stopping you from just downloading the Rust compiler and running it straight from the command line). But the logical progression that worked for me was to write little snippets in the Rust Playground while I learned the Rust language syntax, and then get more serious with a small project in VS Code.

1*S8sOsnez4uUu0X6tW1f74g.png

Random numbers in the Rust Playground

A helpful tip: If you have a choice of computers to use, you’ll have the best experience on a desktop with a basic multimonitor setup. That way you can fiddle in your Rust Playground without losing your place in a Rust course.

Now let’s look at the learning resources.

Microsoft’s Rust Learning Path

Website: https://aka.ms/GetStartedWithRust

1*E3EjDIvAQ_UpYVYqW8ogmw.png

The fourth module in the Rust Learning Path

If you’re looking for a gentle, well-produced introduction to Rust, I can heartily recommend Microsoft’s Rust learning path, called “Take your first steps with Rust.” It includes 11 modules and an oddly-specific time requirement of 5 hours and 31 minutes. The course starts with absolute basics (the development environment) and carries on to all the programming staples you expect, like data types, conditional logic, loops, memory management, and error handling.

The good: It’s very easy to navigate. Use the Copy button next to any code snippet to bring it over to the playground. And almost all of the exercises end with a link to a complete solution that’s already set up in the Rust Playground.

The less good: You won’t master Rust with just this introduction. For example, you definitely aren’t going to see unsafe operations or learn Rust’s asynchronous programming patterns.

Another option: If you want to start with more hand-holding, Microsoft has a companion set of 35 short videos called Beginner’s Series to Rust that explain Rust basics and demo them in VS Code. But you lose the interactivity, because there isn’t any code to copy and there aren’t any playground links.

Google’s Comprehensive Rust Course

Website: https://google.github.io/comprehensive-rust/

1*G7w6P9OM_5Gvosl20dcTOQ.png

Partway through the first morning in Comprehensive Rust

Comprehensive Rust is a three-day Rust course developed in Google by the Android team. It’s structured for in-person training, which means there’s a day-by-day agenda and optional speaker notes. The agenda is ambitious. It starts with three days for Rust fundamentals, with similar coverage but greater depth than the Microsoft course. That’s followed by three optional half-days to introduce Android development, bare metal development, and asynchronous programming.

The good: This is the best bet for a all-in-one, comprehensive Rust introduction. The course also has the real-life pedigree of being used at Google.

The less good: The information is compact, often like the point-form summaries in a slide deck. If you don’t have a teacher presenting the material, it’s up to you to go slowly and fill in any gaps. And the exercises aren’t integrated quite as nicely into the course content.

A helpful tip: If you don’t want to struggle with endless copying and pasting into the Rust Playground, you can download all the examples from the Comprehensive Rust Github repository and run them locally.

The Book

No description of Rust resources is complete without mentioning The Rust Programming Language book, which is known to Rustaceans simply as The Book. In print, it’s about 600 pages, but online you can navigate its many sections using the comfortable GitBook interface (which is the same interface you’ll see in the Comprehensive Rust course). If you want the experience of reading a traditional programming book about Rust, padded with theory and the occasional digression, then give it a try.

The good: It’s a comprehensive language tutorial, up to date, properly organized, and with plenty of diagrams and background information.

The less good: It’s not as interactive as a course. Lazy readers will breeze over everything without being invited to solve a problem or code an exercise.

Examples, examples, and more examples

The best way to learn a language is with experience, and you don’t need to limit yourself to the exercises in the Microsoft and Google courses. Instead, you can get more example code from these projects:

  • Rust By Example is an online book that’s the Rust Foundation provides (along with several other excellent titles). It covers a lot of the same core Rust content as the courses I’ve listed, but in an example-driven format that favors code over text.
  • The Rust Cookbook is an online book and open source project. Here the focus is on practical tasks that use Rust packages (or crates, as they’re known to Rustaceans). As a result, there’s more new content and less overlap with the other resources I’ve already shown. For example, you’ll learn a bit about using cryptography, working with compressed files, and calling a database.

Alternative approaches and shortcuts

Rust tutorials are a dime a dozen on the internet. I haven’t mentioned most of them because they aren’t free, they duplicate the other courses I have mentioned, and it takes time to evaluate material that comes from sources without a solid and well-known reputation.

However, there were a few quirky Rust resources that I stumbled across in my travels that are noteworthy for taking a different approach. They are:

  • Rust for professionals. This compact document illustrates key Rust concepts by comparing Rust code to other languages like JavaScript, Kotlin, TypeScript, and C. It’s a quick way for a seasoned developer to get a bird’s-eye view of Rust.
  • Rust the dangerous way. This entertaining website teaches Rust from a completely different starting point. It assumes you’re a low-level C programmer, and gradually rehabilitates your reckless, Wild-West-style C program into a mostly safe Rust equivalent.
  • The Rust language cheat sheet. There’s a ton of detail in this document, and some excellent links. But you probably can’t teach yourself Rust straight from this dehydrated information packet. (It would be like trying to eat a raw package of instant noodles for dinner.)

Final verdict

All the resources I’ve mentioned are great tools for starting with Rust. But if you want a bit more direction, here are my final thoughts:

  • Start poking around with the Microsoft course if you need just enough knowledge to be an intelligent voice at the table when your team is talking Rust.
  • Go with Google if you’re ready to commit more time to learning Rust and you want to go deeper right away.
  • Use Rust by Example as an optional refresher after the Microsoft course. Use the Rust Cookbook as a follow-up to build your skills after either course.

And drop a line to let us know how you made out! What was helpful in your learning journey? And will Rust join your personal list of most-loved programming languages?


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK