But i’m going to learn rust as my first programming language for some reason. What are my goals? None. I just felt like doing it
What are my chances?
But i’m going to learn rust as my first programming language for some reason. What are my goals? None. I just felt like doing it
What are my chances?
I'd say that they are pretty good!
(Because "I just felt like doing it" means you want it, rather than you're being forced to learn it).
Let's see:
1) ...learn rust as my first programming language - Check
2) ...for some [unkown] reason... - Check
3) What are my goals? None. - Check
4) I just felt like doing it. - Check
Looks like you are in good shape. Correct first language, curiosity, just for fun, no pressure.
Suggest you start with the "The Book" The Rust Programming Language - The Rust Programming Language
If you are really new to programming some of the description in their may sound alien, no problem, you can ask anything here and get a sensible answer.
Also suggest you use an editor like VS Code or Zed with rust-analyser which will give you lots of nice hints as you go along and point out silly typos and mistakes as you edit code. Saves a lot of endless rebuilding of your programs.
Be sure to read and try and understand the compiler errors, there is lots of good advice in them.
Different approach:
Then move on to the book.
When people are recommending the "Official Book" I would really like if they say which one. The one from Brown University is quite different, at least for some of the early chapters, including the one about ownership. I started two years ago with the original one, and while I find the idea with the Quizzes really interesting, my personal feeling is that they do not help that much, it is more a form of a short break while studying. All the diagrams for the stack frames? Might have been created with good intent, but are they helpful for beginners. It took me some time to understand them -- takes time for studying, and it is not obvious if the really help.
For the general idea -- starting with the official book as a true beginner: I saw that advice very often, and sometimes I wonder if people are get paid to advertise that book so much Yes, the book is quite good, and it is great that it is free. But personally, when I was a young boy and started computer programming some decades ago, with some Basic, then Pascal, followed by the other wirthian languages, I would have been not able start with Rust and the official book. I doubt that average young people are that much smarter today. Well, they have AI and IRC support now. But I continue recommending starting with easy languages like Python and C, at least for a few weeks, until understanding pointers and allocations in C.
When someone really wants to start with Rust as a full novice, their is also the informal "Rust in a few months of Lunches" available, with the free "Easy Rust" variant.
For all other beginners, who have already some programming experience, I would strongly recommend to start with my "Rust for C-Programmers", even without C knowledge. The book is really quite nice.
Your first recommendation might be an alternative for someone with much patience being interested in deep understandings.
But 7 languages in 7 weeks for a beginner? Would you recommend someone inexperienced in music starting with piano and violine within a few weeks? I have already doubts that my typical recommendation " C and Python" is a bit too much. Some years ago I recommended Nim, being a good mix of both.
It's a thing with recommendations, I know. The first book I read on the subject was Lingo Sorcery: The Magic of Lists, Objects and Intelligent Agents. The second was the Camel Book. I had to do it because I needed knowledge for my work. At first I didn't understand anything and after a while I understood a bit. It took some time. And actually, the learning is far from over. The secret is repetition - as with any exercise. The book I mentioned is certainly not easy. However, it starts with interactive Ruby sessions, which are quite manageable. Incidentally, I am of the opinion that the direct entry into Rust is very hard. But there are also people who think that C++ is perfectly suitable as a first language.
People are different and the favor different approach. Python and C is for someone who is eager to se… something working, one their screen ASAP, ideally faster than ASAP. Forget learning, show me, I don't want restrictions, let's pretend they don't exist, I'll learn them later – that kind of thing.
If you want to understand how things work “from the first principles” and how they affect each other… then Rust is great. Except appropriate turtorial don't yet exist. I'm almost ready to try to write it myself.
Because this:
They hurt. Badly. Because they assume you not only know how programs are written, not only know how they work, but all know how they are translated to machine code – and trying to tech that much info (essentially the content of couple of separate books) in a side-note doesn't help.
It's like explaining how car engine works – complete with the use of carburetor and clutch – and then teaching you to use gas pedal and clutch to safely work with a gearbox and gas pedal… sure, you can do things that way, too, you can even learn onwership and borrow even more deeply by trying to implement your own language, we know that works… but for “mere mortals” it would be much better to learn about ownership and borrow with the use of textbooks (shareable, immutable)/workbooks (one-per-student, mutable) example and other real-world examples.
I understand why it's there, in the book: because all early users of Rust were very good programmers and knew stack and heap “inside out”… but it's really sad that it's still there, after so many years.
In fact, like with car analogue, I would argue that first learning about how onwership and borrow works and then digging into stack and heap to know how they could be implemented would be much better for tutorials.
A lot of this seems totally over the top for someone who knows nothing about programming. Suggesting they learn multiple languages at the same time and read books on compiler building. Really? A deep dive into digital logic and CPU design. I think not.
No, what a complete beginner needs is to start with very simple things that introduce even what a "program" is:
After all, all of programming is sequence, selection and iteration.
As complex as Rust is I believe Rust can be used to initiate a raw beginner to programming. Why? Because back in the mid 1970's us young teenagers were introduce to programming with BASIC (Good old line numbered BASIC entered into a teletype) and a month or so later in that same course expected to become somewhat familiar with assembler.
The only caveat I have is that I have yet to see any introductory material for Rust that assumes the reader is starting from nothing.
Yeah, that's a pity, really. Because I believe that with careful planning and good selection of helper crates Rust may work even better than Pascal or Scheme (yes, MIT used it for years with the beginners… it worked) – but one would need an entirely different tutorial for that.
Existing ones all assume you are good programmers already… just not good Rust programmers.
Using ChatGPT for clarification may work, in a pinch, but having tutorial that don't assume that you know so much about computers would have been great.
Oh yes. Was it Prof Harvey at MIT who has his lectures on Youtube? It's amazing how he took his students from nothing to building all kind of complex data structures and such in Scheme in such a short time. I noticed that course was updated at some point to use Java. It was painful. Half way through the course the students were still struggling with how Java works and were way behind.
Every time I try to use an AI agent to work with Rust it starts out well enough. Turning up all kind of approaches and corners of Rust I might not have thought of. But often it makes silly mistakes that I have to fix and if I push on it everything goes to chaos.
Sorry, but that is not true. The official book, and "Programming Rust" by Jim Blandy have larger parts, that address to absolute beginners. The problem is, that parts addressed to beginners does not help beginners that much, while being boring for all others. I think a book should have a clear target audience, that is why I called "Rust for C-Programmers" explicitly.
A book, teaching Rust to absolute beginners, would require 1000 pages, and took the reader quite long for the learning. I would assume that most people in the age of 12 to 14 have not the patience for that.
Great if so. Can you show me where they discuss how two's complement work and what hexadecimal means?
I have helped few novices to learn programming (nor in Rust) and in most cases this is where everyone loses the understanding and start just blindly remember what they hear to pass the quiz. With the well-known result.
Every good homecomputer manual had these in the attachment, if not in the main text.
Which is precisely the issue: tutorial is still tutorial for someone, who knows how to program – with some “let's make it beginner friendly” pieces of the side.
That's fine. Most people in the age 12 to 14 wouldn't ever become Rust programmers. What's wrong with that?
There are plenty of specialties, besides “Rust programmer” in that world.
I think these two are not covered, but I could point you to a lot of large text sections directed to people without any programming experience. I can do it if it would be helpful for you, but not just for fun, as I read the official book in October 2023, and the book of Mr. Blandy a few months later, so I can not remember the details. Some people regarded the beginner parts so boring, that they decided just start Rust programming, without reading a book -- for me a stupid decision.
That's fine. Most people in the age 12 to 14 wouldn't ever become Rust programmers. What's wrong with that?
The point is, that today most people interest in computer programming start between 12 and 14 years. When I was a young boy, we started with Basic in the age of 14 to 17, C-64, Atari ST, and Amiga I think today, nearly all people working in the computer industry started programming below 14 years. Not that I would support this, I mostly tell people to stay away from computers whenever possible, even more now that AI will do most programming very soon.
[EDIT]
As you might know, I created a Nim beginner book in 2020 -- that time we had absolutely no AI support, which made writing for someone like me not being a native English speaker quite hard: https://nimprogrammingbook.com/
That book has two's complement, hex numbers and all that, but was mostly a fail finally.
For a beginner, I would suggest starting with something like macroquad
.
This is because a Hello World program, or a guessing game, or anything else that make your computer spit characters on a black screen is much less exciting today, compared to how it would've been in '70s. The greatest obstacle in your learning journey, in any specialty, will be lack of motivation.
It is therefore imperative[1] that you graduate from the perception that you "know nothing about programming or advanced computer stuff". Actually learning all that stuff is of far lower priority; it'd also take far longer than it'd take anyone to give up.
Having a batteries-included suite of graphics and audio is an ideal way to experiment and have fun, all while rapidly learning the basics of programming. Unfortunately, production-grade frameworks (e.g. Bevy) these days are too heavy-handed for this. Hence my suggestion.
You're also better off going through this in a "real" programming language instead of, say, Scratch, or BASIC for that matter.[2]
I wish this could be expanded into a full tutorial, but that'll take a while to write even if I get to it.
In principle I fully agree. But that would be a tutorial for a simple gaming engine then, teaching calling functions and basic graphics stuff. The learners would not come in direct contact with most of the TRUE Rust stuff. Maybe they would have a good feeling as it is Rust-based -- but would that be really different from just using PyGame with that great AI support? PS: I always considered the "Guessing Game" from the official book extremely boring, even when I have to admit that it teaches a few of the most important Rust concepts.
AI wouldn't be able to do most of programming any time soon. Someone would have to untange that slop that AI generates and fix it, when it would collapse under its own weight.
Yet yes, sure, AI would severely restrict number of vacancies for mindless coders – all the more reason to learn things deeply to understand them and not to be able to create code that sometimes works, sometimes doesn't work… and you have no idea why.
These things were extremely boring back in 70th and they are extremely boring today, too.
I suspect we all are small kids in out hearts. I have seen even eyes of people who were 30+ to light up when something they wrote leads to movement on the screen. Even if it's not too much pretty, but it moves, it's alive.
Graphics (something like a turtle in LOGO) may be of great help, but even most primitive emoji bouncing around on the screen may prompt one to invest more time in learning.
That would depend on how would you organize the course, isn't it? Add tower defense game to your tutorial (even trivial one, text-based) – and voila, we are talking about Dijkstra, precomputations and memoization, add a scoreboard – and now we need structs and serialization.
Sure, creating good plan which would both move you from something you already know to something new at each step and would cover all the things that Rust may do for you is hard… but that doesn't look impossible at all.
We just have become accustomed to boring tutorials that assume that everyone would automatically be excited by the ability to learn bazillion things without any reward being shown, in the process.
Most tutorials out there are pretty damn boring. Even if comprehensive and understandable.
Very good choice. You have chosen the correct programming language. You are already off to a great start just from choosing Rust. Have fun. The compiler
will help you along the way.
Java is terrible for a first language. A simple hello world program requires people to understand what a class is and what the public and static keywords mean. Everything is shoehorned into the object-oriented paradigm that was the hot new thing in the 1990s.
A beginner language should start with simple imperative programming dealing with variables, arithmetic, control flow, and functions. Object-oriented programming is appropriate at a more advanced level after beginners have mastered the basics.
To be fair, after 30 years, in Java 24 you can now write a Hello, World program as
void main() {
println("Hello, world!");
}
and the compiler will generate the scaffolding for you. Python is still a much better first language than either Java or Rust.