Tip for a complete beginner?

Hello everyone,
I'm new to programming in general. I started my journey with CS50 November 2024 and, having finished it, I've decided to learn Rust.

While it started off manageable, I'm now hitting a wall with some of the core concepts. Specifically, borrowing, lifetimes, concurrency, and even ⁠impl are proving to be major hurdles. After nearly a month of working through Rustlings, I'm feeling quite burnt out and struggling to make progress.

For those of you who have been through this, do you have any tips on how to push through this phase? I'd also appreciate hearing about your own experiences learning Rust or programming in general. How did you overcome these initial roadblocks?

Thanks in advance! :smiley:

1 Like

I have no idea what CS50 is or what programming you will have done there. But assuming you now have some grounding in programming in a language like Javascript or Python, that you have become familiar with statements, conditionals, loops, functions, structs/objects/methods etc then you might find this beginners course in Rust from the Aalto University interesting Aalto FITech101 Courses. Despite being a university course it's not an academic thing, it's a gentle start with Rust and fun.

As to how to "push through" I don't know. I find it useful to play with little bits of code. Do lots of experiments. See what happens when you break things. The great thing about Rust is that the compiler will stop you making lots of silly, hard to figure out bugs. The Rust error messages are generally very clear and helpful, it pays to read them. Have a conversation with the compiler as it were.

One of the most liberating things in this kind of experimentation is to keep your code in a repository like git (use GitHub or such) Then you don't need to worry about how badly you mess up the code wile experimenting. You can always get back to your last working version. Saves a lot of frustration.

2 Likes

Thank you for the detailed reply, ZiCog!
CS50 covered the fundamentals of programming using C, JS, Python so I'm comfortable with the basics. I'm currently working through the Rust book alongside Rustlings. I'll definitely check out the Aalto University course you recommended. And It's always a huge help to have more beginner friendly places to get information from, so I really appreciate you sharing them. Thank you!

Also of course, if you start working through some course like the one I linked to or a book or whatever, then you can always ask here if you get stuck on something. Plenty of folks will help you out.

We often discuss how suitable Rust is to teach to those with no or little programming experience. Some say it's a hard language and beginners should start with something like C or whatever first. Others say that Rust is a big language but beginners can always make a good start using only basic features as found in any language,

What I'm getting at is that many here would be interested to hear how you, as a beginner, get along with Rust, and how Rust teaching materials could be improved for beginners.

2 Likes

See CS50: Introduction to Computer Science | Harvard University

I recently added that link to the Appendix of my book as a possible non Rust-centric beginner learning resource.

2 Likes

Wow, that's so kind of you to say, thank you! I really appreciate the offer of help and how welcoming everyone has been. To be honest, I was pretty intimidated when I first decided to learn Rust, especially after hearing it has a reputation for being one of the hardest languages. It makes me genuinely curious to see if that holds true for a beginner, haha.

I'd be happy to share my progress and any thoughts I have as I learn!

Just checked the topics covered by the CS50 course, and it's easy to understand why you're having issues with these concepts.

One thing that comes to my mind is that, since you have already been introduced to some other programming languages during the CS50 course (i.e. Python), you could try to follow some of these concepts in such programming languages in parallel (i.e. impl is analogous to adding methods to a class in Python). That being said, I tried this tip myself many years ago when I started my own journey... and had to give up and concentrate in a single programming language to reduce the white noise to the minimum.

On the other hand, if you're committed to learning Rust then you should be aware that concepts such as borrowing and lifetimes are (so far) exclusive to it, so you'll not have any resources available aimed for other programming languages to aid you in your learning process; hence the following paragraph from ZiCog:

Due to how Rust has evolved from being a niche programming language for memory-safe, performance-critical software to a more general purpose language, it's been proven hard to find learning resources for total beginners.

But don't worry about it! Just because there aren't any well known learning resources for total beginners doesn't mean that you can not learn Rust as a total beginner. Many users use this forum for exactly that; just ask a question everytime you feel stuck, and more than one member of the community will be happy to help you with it :slight_smile:.

2 Likes

While this is true, it's also worth noting that most of these are codified versions of best practices¹ for programming in other languages. So, learning Rust might be a friendlier way to establish these good habits than working with the equivalent construction in, say, C.


¹ "Best practices" are of course fundamentally opinions, and there are plenty of people that disagree with the versions codified by Rust.

2 Likes

On the contrary. Understanding the concepts of lifetimes and borrowing are essential to successfully use language like C, C++, Pascal and many others. The difference being that those languages have no syntax or semantics built in to the language to help you. You have to learn by the school of hard knocks, debugging and fixing all kind of crashes and data corruptions found at run time rather than fixing compilation errors in Rust as you write the code.

That may well be an argument that learning these concepts could be gentler with Rust than those others. Perhaps, maybe...

1 Like

Sorry if the way I expressed myself was ambiguous. I didn't mean to say that the abstract concepts themselves are unique to Rust, I was referring to the actual concrete abstractions that are part of the language itself.

This is what I meant.

3 Likes

In my experience, there's no way to simply "push through" burn out. I would simply take a break, relax and enjoy yourself.

Chances are, in a few days, weeks or months, you'll naturally get the itch to try again, and you will have processed some of the core concepts in the back of your mind while away. Coming back, you'll want to re-read your materials to remind yourself where you were and you'll have a fresh perspective.

Lots of people "get rust" on their second or third attempt, try not to rush things if you're feeling burnt out. There's plenty of time.

8 Likes

Indeed. If you want to make Rust you need oxygen. Get outside and run around or whatever.

2 Likes

Don't. "Struggling" and feeling "burnt out" is a perfectly sensible part of the journey: your brain is so excited about all the new material you've pumped into it that any attempt to cram even more information will be taken as an outright declaration of war. Thus all the "feelings" part of it.

Your mind simply has no other way of telling you "I really some time to process it all. Please?"

Help it out by switching up the context a little bit. Apply what you've learnt so far. Build something. Something you are curious about. Not something Rustlings or David Malan or any other instructor would rather have you build. You need some actual interest of your own - not external pressure.

Pick the first thing that comes to mind. Tinker away at it to your heart's content. You'll learn a whole lot more by exploring and hacking your way towards it then you'll ever learn with any structured "ABC before JKL before XYZ" manual. Just don't expect to "get" it all in one go.

There's a fair amount of good in knowing when to go "hold up; that's a bit too much for now; let me circle back to that thing another time". Don't sweat it. Don't push it. Don't rush it. You can figure out anything - no matter how hard or unwieldy or overwhelming or incomprehensible at a first glance. Just not everything that catches your eye at any given time. Definitely: not at once.

2 Likes

I found that building small tools in Rust helped me focus on one item at a time (mostly). I would build something simple. See some repetition, and try to make a trait to change duplicated logic into a generic function. See some clones that seemed unnecessary, and infect my structs and functions with lifetime parameters.
It's very easy to go "too far" at first on both of these generalizing / deduplication paths, so making small changes and returning back to a working state quickly is essential. Seeing what works and what doesn't work (the boundaries of what the compiler will allow) helped me internalize the rules of the language better, even though I may not be able to articulate the rules exactly as they are implemented in say the reference.

4 Likes

Going to Harvard? There is a great Rust community in the Greater Boston area. Check out the Boston Rust Meetup and Rust East Coast on Discord.

As a beginner in Rust, I'm trying to understand ownership and borrowing.
I've worked with pointers in C before, and I know it may be dangerous.
For example, if I have multiple pointers to a memory space, to free the space and access it with another pointer.
With a single pointer, one has to set the pointer to NULL after the memory is freed and it must be always checked before using it (unless one realy knows wwhat he does ...).
I have a personal principle I call the "tennis ball principle":
"a tennis ball cannot be on both sides of the net at the same time."
This helps me understand the principle of ownership a little.
Also, if someone borrows an object, who tells me that it will be returned in a good condition?
There must be an agreement between the owner and the borrower.
One has to know if it's the object itself (pointer to it) or a copy of the object that is used (eventually modified) by another process.

1 Like

Rust is fun, as soon as you get familiar with basics. The Rust Cookbook is what I used. I also dabbled with Rustonomicon (Unsafe Rust)... contrasting these two has been magical for me.... It's like using the periodic table with an electron microscope to delve into what makes up matter.

Enjoy, go chapter to chapter with the book, don't skip nothing. You will have loads of fun​:orange_book::orange_book::orange_book::open_book::open_book::crab::crab::crab::crab::crab:

1 Like

You can try this course from Udemy, https://www.udemy.com/course/learn-to-code-with-rust. I found this course is very easy to go through and is very useful. Before you enroll, you can preview some sections of the course.

1 Like

Haha, you're totally right! CS50 topics are the fundamentals, but since I came from a psychology background with zero coding experience, even the basics felt like a huge wall to climb at first. But its a very rewarding experience though! very happy with my progress! :head_shaking_vertically:

Honestly, my foundation in C and Python is pretty limited (I only learned them through CS50), but I think that actually works out fine for me! I know enough to get the main ideas and concepts, but not so much that I’d develop bad habits from other languages.

In my opinion, jumping straight into Rust as a complete beginner might be a bit confusing(?) — not because the material itself per se, but because the resources available for absolute beginners are pretty scarce. I’ve been able to hang on to dear life to the rust book because I’m somewhat familiar with some concepts :pensive_face:

1 Like

I think there is an important caveat that is sometimes implicit here.

Most people that give you advice have not gone from 0 to hero with Rust. It does not mean it impossible, but it does imply that we do not know how hard it is.

Most are programmers or computer science graduates (or related fields), and have been for years before learning Rust.

In their minds, it feels like beginners can start from Rust and just keep learning, but imho that's very unfair and can get users into a lot of confusion including self-doubt / impostor-syndrome.

This is akin to say: of course we can start learning physics by learning about quantum mechanics, after all, it's its own thing. But those are fallacies.

You study psychology and I think it should be expected that we learn in a Piagetian sense of assimilation: we need the germs of structures to add newer blocks. Without a solid base, there isn't a place to add new cognitive structures. If Piaget is too old then others suggesting this are: Mitchel Resnick, Seymour Papert, etc.

I think that you should start by learning Python very well (or a related high-level language).

There are many reasons for this, none is obviously neccesary but in my mind they are close to it:

  • Look at statistics: how many non-programmers learnt Rust as first language? (You can run a poll on Reddit.)
  • Where does Rust sit in complexity with respect to say Python
  • How much easier is it to learn rust by first being comfortable with concepts like: inheritance, manipulation of bytes, file-permissions, command line interface etc. All these aren't even considered by most giving advice, it's forgotten that this is overhead for you.

My advice then, is: learn python well (learn it using types), get used to CLI, Github, reading others code, and all data structures and concepts like inheritance.

Then, learn Rust if you fancy it.

4 Likes