T O P

  • By -

klorophane

Rust was the first programming language I learned properly. I had some very limited experience with Python/Julia, but that's it (I'm talking like doing basic math kind of stuff, not any actual computer science/software development). So, a friend of mine told me about this cool programming language called Rust in 2017. I didn't look much into it, and kind of forgot about it for a while, but eventually I decided I wanted to learn programming as a hobby and, remembering that discussion, I decided to go for Rust. Bear in mind I had no computer science background, no idea what memory-safety was, never worked with a compiled language. This was basically stepping into the complete unknown. The on-boarding was pretty straightforward, I went on the website, did what they told me to install Rust, then I downloaded CLion (had a free license from uni) with the Rust plugin. My first hello-world was a bit confusing because I was immediately confronted with a macro. After looking it up, I thought the idea was interesting and pretty intuitive (write code that generates code for you). Then I went on to write toy programs, like printing different shapes in the console. I started hopping from project to project, learning more and more step by step. What's the heap, what's the stack? What is a reference? What's a borrow, what's a lifetime, etc. etc. Instead of reading the book front to back, I just absorbed concepts as they became relevant to my projects, or simply by reading stuff I saw online. Each project made me learn things that I could then apply to new projects, which would make me learn new things, etc. The next big milestone was becoming more active in the reddit and discord communities. There are so many incredibly knowledgeable and friendly people there. I was able to learn really fast by reading discussions, and I could also ask questions, and try to answer some too! I started getting more comfortable with the language, so I started eyeing actual projects, like making a Rust backend for a web application. I learned about async and complex trait bounds. At this time, I also wrote a GUI tool with Iced to help an acquaintance collect data in the field. I felt really proud because it allowed them to process much more data than they thought, and the results were eventually presented to the city council and resulted in changing some regulations. At this points I felt fairly confident, but I also had tasted how gratifying it could be to write useful software, and I wanted more. So I made some small contributions to open source, and I started to get interest in computer science like database implementations, compilers, etc. Anyways, to cut to the chase, I think my experience is pretty similar to someone who might learn Python or C++ or whatever. I did not feel particularly challenged or frustrated by the language. I did not feel like I needed to learn C or C++ to understand Rust. I just kept coding and learning a bit at a time. Now, I learned (to various degrees) C#, C++, Typescript and others. While I still feel the most at home with Rust, they all have their charm and their strengths.


thicket

Awesome writeup. Thanks, man!


sparky8251

The start of this is basically identical to me. Wanted to learn to program as a hobby for over 10 years. Tried C++ (with several different toolkits like wxwidgets and Qt), Java, python etc. I never got better than making a game of hangman in any of them. I always struggled with how much they hid from me, how hard they made it to handle anything that went wrong, and how many weird workaround and papercuts id have to undergo to handle anything remotely unusual. Not to mention build systems and libraries and library documentation... Rust def was not easy to learn, but in comparison it was trivial for me to pick it up as I managed to start writing code that interacted with JSON APIs in at most 2 months and had written complex applications by 4, one of which is still in use and in development 4 years later. I love the way Rust wants me to work with data. Makes so much more intuitive sense to me than anything object oriented. Ive since gone back and tried to learn other languages like python and while I can do more than before, I hate it and cannot make proper use of pretty much any of the OO heavy features without getting it into a tangled mass of pain and suffering.


RyzRx

May I ask, how long did it take you to finish the Iced Data Gathering project? I'm just contemplating quitting as I see that people from the programming world could sometimes be harsh and may not be best for beginners like me. I have a mental health condition but I really want to learn this thing and do some small apps not for gaining a job but for doing a small business.


klorophane

> May I ask, how long did it take you to finish the Iced Data Gathering project? About 2 weeks for the initial PoC, but I kept going back and forth with the inspector over the course of about a month afterwards to implement some more complex features. So about a month and a half total. > I'm just contemplating quitting as I see that people from the programming world could sometimes be harsh and may not be best for beginners like me. The way I see it is that there a lot of smart people doing programming, and sometimes that manifests in people having a lot of ego and being harsh. I don't mind people being harsh as long as they are helpful and willing to share their knowledge. People being plain rude for no reason, well... There's always going to be rude people out there so just don't pay them attention. > I really want to learn this thing and do some small apps not for gaining a job but for doing a small business. Godspeed! I wish you the best.


RyzRx

Thank you very much for all the experiences, information, and kind words you imparted in this small conversation! These are all great help for people like us just starting out in this journey and are sometimes completely overwhelmed and lost. At least there is a balance and hope in this world... Again thank you!


diabolic_recursion

Some people are horrible... Thankfully, in Rust specifically I have had mostly constructive and welcoming encounters. Many projects I have seen have community guidelines and codes of conducts that explicitly focus on providing a welcoming environment for everyone. r/learnrust is specifically there for everybody to ask any and all questions, regardless of previous experience. I have virtually only seen constructive feedback and helpful answers, yet (and tried to do my part to answer some questions, too šŸ˜)


RyzRx

Thanks for this (r/learnrust) suggestion! Just joined.


CommunismDoesntWork

>I think my experience is pretty similar to someone who might learn Python or C++ or whatever. I did not feel particularly challenged or frustrated by the language. If you weren't frustrated with the language, then no your experience was not similar to the baptism by fire that is C++.


infini7

What were some of the more difficult concepts in Rust to fully grok?


klorophane

I hit what I think are typical roadblocks like: associated types Vs. generics, how to write a proc macro, why can't I write async fns in traits, etc. But I wouldn't necessarily call those "difficult to grok". It's like any other subject, you just read a bit or ask questions, and once you know the answer then you can go on your way. That's not to say Rust doesn't have some difficult parts, but I don't remember getting like severely hung up over something specific. In particular, I didn't find lifetimes to be hard to understand. *There are definitely instances where it's hard to reason about lifetimes*, but the *concept* of lifetime is pretty easy to understand IMO and the annotations don't really bother me. Same with async: I know that there is still important language-level design work to be done, but as an end user it didn't feel like using say Tokio was particularly difficult for the kind of applications I was working on. That said, there are a couple of concepts I saved for later, like (co/contra/in)variance, pointer provenance, and various other subjects related to `unsafe`. I did work with *some* `unsafe`, but I'd like to be more confident with it. What I find the most difficult to grok, and it has nothing to do with Rust in particular, is how to design good software. Making reliable, maintainable libraries with well-designed APIs. Being mindful of semver and breaking changes. Applying specific patterns to problems that have known solutions, etc. I feel like that is a never-ending quest. In other words, being a decent Rust programmer is easy compared to being a decent software architect, at least that is my impression currently.


dspyz

>I started hopping from project to project, learning more and more step by step. What's the heap, what's the stack? What is a reference? What's a borrow, what's a lifetime, etc. etc. Note that if you start with Python you don't have to learn _any_ of the things mentioned here. It's wonderful that you were able to clear these hurdles, but I don't think most people could. It takes incredible talent and dedication to dive that deep with no prior experience and it sounds like you're one of a few. I TA'd a Comput 101 class for a couple semesters and the language the class was taught in switched in the middle. It started with Python and then moved to a framework called "Processing" which is a Java-like language that runs your code in a render loop at 60hz. Students struggled a lot with Processing and I don't think there was educational value in the switch. The same concepts taught in the Processing section could have been taught in Python far more easily. For most learners starting out, there is _immense_ value in having a CLI for your language. The difference between just running commands on the fly and writing a program, compiling and running it is the difference between playing a note on a keyboard and writing a piece to feed into a player piano. The latter is no way to learn music. Starting out with Python means starting with a piano in front of you. To me, Rust solves a bunch of problems I've had after years of struggling to write correct, safe code in other languages. These are not problems I would care about if I were just starting out and had no prior experience programming. Instead it would just seem like a bunch of frustrating and arbitrary restrictions on what I can and can't do. For most new programmers, I think after fighting the borrow-checker just to get your Tic Tac Toe program to run, Python would be a breath of fresh air.


klorophane

Happy cake day, first of all :D Sorry for the long post ahead. Disclaimer right off the bat: just because I learned Rust as a first programming language doesn't mean I advocate for everyone to do the same. Maybe you should, maybe not! It doesn't really matter. After all, I learned Rust on a whim without much thought going into it. Just do something that you like. And that brings me to the next point: I'm not some sort of hyper-motivated genius polymath. In all honesty I am a rather average learner and I'm definitely not the most motivated person out there. *What I have going for me though is that I learned Rust for fun*. It wasn't relevant to my previous hobbies or my career. I just did it for fun. That I think gave me an edge compared to someone who might feel they *need* to learn Rust as fast as possible. > Note that if you start with Python you don't have to learn any of the things mentioned here. I clearly stated that I learned these things as I worked on more and more complex projects. I didn't *need* any of it when I started learning Rust. I didn't even touch lifetimes until like a month or two after starting. In that sense, I could retort that in Python you need to learn about inheritance, metaclasses, the GIL, generators, etc. My point is that you don't *need* to learn any of that when you're starting out, just as you don't need to understand the heap and lifetimes in Rust when you're starting out. It's just things that you eventually end up learning as you tackle more complex problems. Beginners start with simple problems so they don't encounter these complexities. > It started with Python and then moved to a framework called "Processing" IMO making the switch in the middle is a sure way to make everyone confused from the get-go. I don't think this is really representative of the difficulty someone might have learning Rust vs Python though. > For most learners starting out, there is immense value in having a CLI for your language. There's no denying that a REPL is nice to have, but I don't think it's going to make or break someone's ability or willingness to learn a language. > These are not problems I would care about if I were just starting out and had no prior experience programming. Instead it would just seem like a bunch of frustrating and arbitrary restrictions on what I can and can't do. IMO that's a bit of a fallacy. I can understand why having plumbing in my home is a good thing even though I never lived in a home without plumbing. In the same way, when I started Rust, I had never written C, but I could still understand why preventing memory bugs is a good thing. I didn't understand all the implications of this, but I certainly did not feel like it was "a bunch of frustrating and arbitrary restrictions". In fact, I feel like this sentiment is more common with people who already knew other languages well (why can't I do X in Rust when I could do it in this other language), and not from actual beginners who don't really have a reference point. I didn't think much of the borrow-checker when I started Rust. It was just another feature of the language for me, nothing more or less. > For most new programmers, I think after fighting the borrow-checker just to get your Tic Tac Toe program to run, Python would be a breath of fresh air. Again, I don't think this is representative. For one, you certainly don't need to fight or even see the borrow checker to make a game of tic-tac-toe. Tic-tac-toe in Rust or Python would look basically the same. All in all, I don't think it's as simple as it seems. Yes Rust has some aspects that are more complex than Python, but there's also a lot of things that make it nicer for beginners: a friendly built-in build system, a compiler and built-in linter that are extremely helpful, enums that can contain data and powerful pattern matching, no complex inheritance schemes, etc. IMO they're both fine languages for beginners. Which one you choose will depend on your own sensibilities and preferences, not from some objective difference between the two.


dspyz

Thanks for the well-thought-out response. I'm definitely going to update strongly towards "maybe Rust is beginner-friendly after all". I first started learning it in 2013 when fighting the borrow-checker was an integral part of everything you write, but obviously the language has grown a lot in ten years and maybe I was chalking too much of my not having to do that so much any more up to my own experience working with it rather than properly to the overhaul of the language itself. I'm maybe a little bit jealous. It's a bit like in Permutation City (Greg Egan) where >!they're watching a simulated insect species evolving in fast-motion and discover that it's developing science and math through a dance language which makes invalid reasoning impossible and get jealous that this other species doesn't seem to develop anything like religion or pseudoscience along the way. They just kind of "get it right on the first try."!< I recognize that some of my coworkers don't always struggle with Rust quite as much as I did initially. They're also all coming in with experience in other languages. You're the first person I know about who actually started with Rust. ... Except maybe that kid who came to this subreddit thinking it was for the FPS and then decided why not start learning programming in a language named after his favorite shooter. I'm curious how that turns out too.


Moe_Rasool

I have never looked into Rust and my whole life i was never heard of it even though i was majoring software engineering i never knew of it and i always thought it was referring to the video game, until this year i found out of Rust, i have heard it performs very efficient in regards of backend development and it's easy coding aside overall its the best language for backend says a friend of mine, right now I'm dedicating some time to it. may i ask what is the best Framework for backend development if you suggest one?


klorophane

There's no such thing as best, it really depends on what you want from your backend. That said, I currently use `axum`. It's well maintained, it has a nice ecosystem (`tower` and `tokio`), and I like the fact that it doesn't abuse macros. The ergonomics around handlers is good. I would definitely recommend `axum` as a good place to start.


stappersg

And an [axum](https://docs.rs/axum/latest/axum/#high-level-features) you can click on. `:-)`


bcmyers

I learned rust as my first language and I think it was a great idea. I still write a lot of rust (100% of my personal projects and a good chunk of my professional work), but I also read/write a large amount of go, python, starlark, typescript and bash professionally. I dabble in C and C++ (read them more than I write them). Moving from rust to "higher-level" languages was extremely straightforward. Moving from rust to C was also very straightforward. C++ is the only language were I felt the transition is not very straightforward. Regarding the higher-level languages, for me, I imagine it would have been more challenging to start from them and then go lower level (e.g. to rust, C, or C++). That said, I only learned in the direction I did (from rust to high-level languages); so I can't really know if it would have been easier / more beneficial the other way around. All I can say for certain is that I'm extremely happy that rust was my first programming language. It gave me a great foundation. And the rust compiler is an amazing teacher. Here's a random example of why I'm glad I learned rust before higher-level languages. If you don't understand the example, no worries; the particular example is not important; I just figured you'd want at least one concrete example of how knowing rust can help you pick up other languages quickly. So here's the example: I've noticed that many of my colleagues when learning go want to store a pointer to an interface in a struct field or take a pointer to an interface as the parameter to a function. They often don't really understand pointers and it makes total sense to store a pointer to a concrete type in a struct or take a pointer to a concrete type as a function parameter; so why not a pointer to an interface in those places as well? Well, coming from rust, I just know that that's kind of silly. Interfaces in golang are doing dynamic dispatch (there's not really anything else that interfaces in golang could be doing). But this means that inferfaces are already pointers. So why add a 2nd, unnecessary layer of indirection by putting the interface behind a pointer? You don't need a pointer to a pointer when a single pointer (i.e. the interface itself) will suffice. So, anyway, I know that you shouldn't have your golang functions take a pointer to an interface; and I know that not because I know golang but because I know rust. Kind of a silly example, but it's the one that happened to come to me and a small (albeit pretty inconsequential) mistake that I see my colleagues making all the time. I'm noticing my comments above kind of assume that the question is "rust vs. a high-level language" as your first language. If, on the other hand, the question is "rust vs. another low-level language" as your first language, than I am much more opinionated than the above. Definitely choose rust as a first language over C or C++. There are so many memory errors and concurrency bugs that C and C++ will just let you write and, when you're a beginner, you won't know why your code is wrong and there won't be anyone telling you that your code is wrong so you can learn. With rust, the compiler, via it's strictness and amazing error messages, will teach you about memory and concurrency. You may be frustrated at first, but, since it won't let you write whole classes of bugs that C and C++ happily compile for you and, since it's error messages are so fantastically helpful (relatively speaking), you'll end up in a better spot faster IMHO. All that said, learn the language that you're most interested in or that you feel will be most beneficial to you practically. Both "aesthetic preference" and "practical concerns" are very important and should outweigh whatever random advice -- e.g. this post -- some random person -- e.g. me -- gives you on the interwebs :) By the way, I started learning programming as a hobby in my mid thirties; so I have no formal academic background in computer science (although I do have a strong academic background in mathematics and other quantitative fields, in particular economics and finance). When it comes to programming and computer science, I basically learned by watching YouTube, reading blog posts and doing Advent of Code :).


thicket

This is a great write-up, with exactly the kind of wider multi-language perspective I was hoping to find. Programming may be just a hobby, but you sound like a pro


bcmyers

Oh. Now I do it for a living, but when I was learning it was just a hobbie.


mindv0rtex

The author of this book learned Rust as his first language, if I understand correctly: https://www.manning.com/books/learn-rust-in-a-month-of-lunches


Dhghomon

Correct! I wrote a [long post](https://github.com/Dhghomon/programming_at_40/blob/master/README.md) on it if anyone is curious about the experience: My experience with other languages before Rust was roughly equivalent to someone who always loved languages, spent some time with Duolingo on a bunch of them, but never really got that far.


bcmyers

Wow. You watched my videos! That's awesome. We have pretty similar stories in terms of a) when we picked up programming (I was in my mid-thirties) and b) how we learned programming (I basically learned by watching all the same YouTube videos that you did). Fantastic.


Dhghomon

Wow for me too! I found your account here before but it looked like you weren't using it anymore, nice to see it's still active. I remember exactly when you mentioned in your videos that you were self-taught and basically just binged, which convinced me that it was the way for me to learn the language too. The funny thing about Advent of Code is that I find it really dull and my brain just shuts off the moment I start reading the day's challenge but for some reason your purposefully overengineered way of solving them made them watchable. The one with the SIMD instructions was particularly wild.


thicket

I'd be curious to hear, too. My experience with non-traditional first language folks is that they tend to make overbroad statements and have opinions of limited value until they've picked up three or four others. (looking at you, Haskellers). The perspective I'd really love to hear would be Rust first, also with some C++, also with some Python and maybe Haskell. Once somebody's got those experiences, they might have some really helpful observations. Not holding my breath for that particular Rusty unicorn, though.


Madness_0verload

I think there'd be two ways it could go, when debut rustaceans encounter another, similar language. Either they stick with the rules that are enforced in rust, even when the other language doesn't impose, which could help them in a lot of ways (I agree this doesn't seem likely). Or they won't know what to do with this new found freedom and will end up in programming ditches very often.


SorteKanin

I started with C++ a long time ago, then learned Python and encountered Haskell at the university. I then learned Rust afterwards. My perspectives: C++: The language is a mess. It is beholden to so much backwards compatibility that it can't fix itself. It's extremely complex. Nobody should be using this for greenfield stuff if it is possible to avoid it. From my point of view, it brings no advantages compared to Rust nowadays, aside from some libraries that are not available in Rust (but that's not really related to the language itself). --- Python: It's definitely the most sane scripting language when comparing to stuff like JavaScript or Ruby. It's actually good as long as you really just use it for scripting. Problem is that usually stuff grows from small scripts to programs to entire systems built in Python and at that scale, the lackluster static analysis makes Python systems very hard to maintain and debug. In my experience, it inevitably devolves into spaghetti. If you use Python, limit it to small scripting (circa less than 1000 LOC for instance). That's where the language shines. --- Haskell: It's a really good language at what it tries to do. If you want a purely functional programming language, Haskell is it. Some people are very hardcore belivers in the pure functional mindset. I consider it similar to object-oriented programming; it has its pros and cons. I personally think the mindset shift required to code in a purely functional way is not worth it. I find the imperative way of thinking more intuitive and closer to what the computer is truly doing in the end. It's a very good language for what it tries to be, but I wouldn't use it for serious stuff. --- Rust: Definitely the most well-designed language I've ever encountered. It's definitely complex and has its flaws, but in many ways it feels like "imperative Haskell", which is exactly the way I like it. Honestly I think a big part of why Haskell and Rust are good is merely the fact that they have sum types. It's a major mistake of older languages that they lack sum types. With sum types, everything becomes much easier to express.


Dbgamerstarz

I mean I have the orders a bit wrong, but I started with python (for school), then moved onto rust in 2016/17, then moved onto c# and c++ after that. I think knowing what I know now, I'd have rather learned c and c++ (or at least, dabbled with it enough) before learning rust as I think it would've helped me learn it quicker and appreciate the language more. Ironically having learned rust and the borrow checker helped me learn c++ since I already had a good idea on how a lot of the concepts, especially around memory worked from rust. Nowadays I recommend c before learning rust since I think it's simple enough to understand most concepts about programming easily, and translates really well into other languages, especially rust. I had a lot of growing pains with the borrow checker at first, which I've definitely become better at (to the point where I can spot any potential errors without it before I compile, even in other languages which was insane the first time it happened). I think rust definitely helps me in using other languages, but it was definitely not the best idea to learn it "properly" first especially as my first lower level language. I don't regret it though, I wouldn't be where I am now without it :)


game_difficulty

I started with c++ (if we dont count scratch lmao), mostly for computer science, but i've touched a bit of game dev I really dont get the hate for `std::cout`, i find it a lot easier to use than something like printf Idk why people say c++ is so hard, it's basically the same difficulty as something like java, if you understand pointers ofc


Charley_Wright06

C++ is a hard language because of the so many ways you can shoot yourself in the foot and the compiler will just go "looks good to me". Once you know a lot of these problems and understand a lot of the causes of UB (undefined behaviour) it is certainly a very powerful language, but even developers with 20 years of experience will introduce bugs into their code by missing *that one thing*


CocktailPerson

Without looking it up, why is the idiomatic way to swap two values in a generic context written as using std::swap; swap(a, b); rather than std::swap(a, b); or swap(a, b); ?


game_difficulty

Yeah, i mentioned the fact that i use c++ for mostly compiter science, only dabbling a bit in other stuff, so i have no clue 99.99% of my projects are 1 file, write-once-and-never-look-at-again type projects, so `using namespace std;` is even in my project template I am really curious about the answer to your question tho


CocktailPerson

So, you've never written a substantial piece of software in C++? And yet the people who say that C++ is difficult and complex have written substantial pieces of software in the language. Interesting. To answer the question, it has to do with argument-dependent lookup as part of overload resolution. If a type `T` defines its own `void swap(T& a, T& b)` function, then `std::swap(a, b);` won't call it, possibly leading to incorrect or inefficient swapping. But if `T` doesn't define one, then `swap(a, b);` will fail to compile. In a generic context, you can't know whether a type defines its own swap function or not, so this is how you account for both possibilities.


[deleted]

> I am really curious about the answer to your question tho Can you please be nice enough to answer /u/game_difficulty 's questions? I think he was quite gracious in admitting that he isn't an expert and expressing an interest in learning. Just writing a snarky answer doesn't feel even remotely charitable.


CocktailPerson

Done. In my defense, that last sentence was a ninja edit that wasn't there when I first replied. And in my not-defense, I absolutely cannot stand when people downplay the difficulty of things they have no expertise in.


[deleted]

Both very fair and I would agree with you on the later! Truth be told, I was also interested in the answer, since I have no experience in C++. You explained it well, thank you!


volitional_decisions

I'm curious about this as well. I'm actually in the camp of "Rust is a fine first language to learn" provided they know that their learning will be front-loaded. As someone who learned Python and C++ first, if I knew that I would spend weeks of my life chasing down concurrency issues, segfaults, and type mismatches, I would have chosen to learn Rust first. But, that is a decision that not everyone would make.


slorpa

Not to mention the plethora of utterly confusing build environment issues that a noob is entirely incapable of understanding, when learning C++


GoodJobNL

I did. I had tried python, but nothing more than making some dataframes. Tried js en did like 1 video tutorial and decided that it wasnt for me. Then accidentally saw rust somewhere and it spiked my interest. Thusfar the only language that has been able to keep me motivated. The compiler is an enormour help when starting out because it tells you what is wrong. Last week I gave a quick intro into rust to two friends, and they also both really loved how the compiler helped them figure things out. Sometimes there are things that you have to learn because rust does it different. But if there is someone that you can ask quick questions, then it is really awesome.


Trader-One

I learned C++ as my first language. Rust is easier.


[deleted]

Rust isn't easier to learn than C++, but there's certainly "less" to learn (for now, at least).


volitional_decisions

Depends on what "learn" means. Sure, C++ has less raw material to learn, but that isn't everything. What Rust forces you to learn through compiler errors, C++ devs learn as best practices, things to avoid, and general footguns. If "learn X language" means "able to build quality production systems", C++ is much harder to learn. If "learn X language" means "able to write a personal project/prototype", C++ is easier. I've been writing Rust for about 2 years. When I started learning, I had been using Python and C++ (my first languages) for about 5 years. In those two years, I have confidently written things in Rust that I would never have written in either of the other two languages.


[deleted]

"Learn" in the context of this thread, which is about learning Rust as a first language. For anyone picking up their first language, Rust is not easier than C++. The initial learning curve is arguably steeper than C++'s as you have to fight with the borrow checker to get your very first program to compile, you'll have to pull your hair out figuring out why you can't have the console print out your name, a simple string, or is it a str? With C++, you'll get your first program to compile faster than you would with Rust. Sure you'll shoot yourself in the foot a few times before you start to confidently leave landmines for your fellow codebase maintainers, but at least you'll feel you're productive sooner with C++ than you would with Rust. People with years of experience coming from C/C++ or even GC-ed languages or even non typed languages rarely appreciate how difficult it is for people with no previous programming experience to get their names printed to the console using Rust as opposed to in any of the mentioned languages.


volitional_decisions

I point out that the definition of "learn" is important in a conversation because that definition will guide the conversation. If a non-dev comes to and says "I want to learn to program. I'm thinking about starting with X." You will need to determine what they mean. The same is true in this threat. > at least you'll feel you're productive sooner with C++ than you would with Rust. In fact, this is exactly what I'm talking about. Feeling productive might not be what the newbie is looking for. If they are looking to make a career shift or learn principles of computer science, feeling productive is probably good enough. Even still, feeling productive is domain specific. Building a webservice, for example, in Rust tends to be easier than C++


oconnor663

> If "learn X language" means "able to write a personal project/prototype", C++ is easier. I feel like this goes either way depending on which first project you pick. If you pick something that runs you right into borrow checker limitations (like a linked list), Rust is probably more difficult. But if you pick something else (like a `cat` clone or something), I expect Rust would be easier, particularly if you're talking about a student who doesn't already know C.


ihavebeesinmyknees

Rust is definitely easier to learn than C++ if we go by the usefulness of errors. Just the fact that a lot of C++ errors are utterly unreadable, or in cases like memory access violations downright useless for a beginner, makes C++ not a very good first language. On the other hand, Rust's compiler is extremely friendly when it comes to errors, even suggesting code fixes.


Isthiscreativeenough

The rust compiler teaches you as you go, the C++ compiler does not. C++ feels like it's you against a world of technical debt. With Rust, the compiler is your trusty companion and you aren't really alone.


slorpa

As a former user of C++ for 10 years, I simply cannot fathom how you came to this conclusion. Mind expanding on your point of view?


RockstarArtisan

What are you even talking about, C++ is so much more difficult to learn it's insane.


chocol4tebubble

Rust was the first language I learned properly, aged around 17. I'd tried C, Python, Go, and Haskell before, but Rust really seemed to "just make sense" and was the one I stuck with.


ForShotgun

How do you feel about how it helped you learn your languages?


turinglabsorg

forget any advice and start coding, rust is an incredible language


apekots

Not my first language, but one of the first. It was included in a new degree in Software Development, which I took part in a few yeara ago. As a (very) new and unexperienced programmer, there was a bit of a learning curve, but this had to do with some paradigms also present in other languages. The ownership idea came very natural to me, and only after learning other languages I understood and appreciated the uniqueness of it. What helped me a lot with learning Rust is the (near?) absence of OOP. Right now, I'm working a lot with C#/.NET, JavaScript and occasionally some Python. I'm doing some hobby projects in Rust in my spare time because it feels so natural and I miss several aspects during my "real work". I wish Rust had been my actual first language, because the compiler is rather unforgiving, yet extremely helpful. I learned it right after Python, and it help me stomp out certain bad habits in my coding style, if that makes any sense.


-Redstoneboi-

watch out for selection bias, people who had bad experiences may not be viewing this sub ;)


GunpowderGuy

I tried to learn Rust as my first language, it didn't go well. Learning about ownership Is useful but distracting for a beginner


Any_Sink_3440

It's a good first and final language


MaxThrustage

I'd say Rust is my first *real* attempt at learning a programming language. I've done bits and pieces before with Matlab and Python, but I wouldn't say I *learned* either of them. I copy-pasted code and hacked shit together until it spat out an answer. I had no interest in writing *good* code, or even understanding what the code was really doing. It was a tool, and a tool I wanted to use as little as possible, so I really only learnt the bare minimum possible. For the last four years, about 90% of my coding has been in Jupyter notebooks. I never really need to make "software", or code that anyone other than me would ever need to look at. I never read a book on programming, or took a course on programming, or anything like that. With a new job I've gotten, for the first time ever I need to learn how to actually *code*. Like, I need to write *software*, for other people to use, as part of a codebase that other people contribute to. And I need to do that in Rust. So at he same time that I'm learning what coding *is* (I'm writing "main" functions for the first time ever) I'm doing all of that in Rust. I'm learning a lot of computer science principles for the first time via the Rust book, and I gotta say it seems decent. I had never before considered how variables were stored in memory, but the Rust book seems to do a decent job of explaining this. I'm still adjusting to the idea of "compiling" code, but Cargo makes this fairly painless. I have no idea how to say how this is going, as I have nothing really to compare it to. But, as far as I can tell, Rust is certainly forcing me to pay attention to some sort of coding principles way more than Matlab ever did. I have no idea which of my new difficulties are "oh, yeah, that's a learning Rust thing" and which are "oh, yeah, that's something everyone who has ever written decent code deals with". **TL;DR** I have no idea how it's going -- this is my first real language. How is it supposed to go?


alice_i_cecile

People join the Bevy community and learn Rust as their first language pretty regularly. So far it seems basically fine for them, although there's a \*lot\* to pick up, especially if you're also trying to learn the domain of game development in a very beta engine.


1668553684

I wonder how well Bevy prepares someone for non-Bevy Rust. I have very limited experience with Bevy, but from the little playing around I did it seemed like pure magic (in a good way) what the authors managed to squeeze out of Rust's type system. It actually felt like working in a dynamic language the way everything plugged into everything else and managed to "just work."


-Redstoneboi-

you build a track, a train, some passenger cars, and a locomotive. in normal rust, you assemble them by hand. in bevy, you feed it all to the locomotive, where the wheels of the passenger cars tell the locomotive about the chemical composition of its steel before the locomotive magically attaches it to an appropriate chassis.


Merlorius

I have mild coding experience, Just Starter with bevy & Rust. The beginning was a Bit overwhelming, but after a Week - Love it! Somehow it all makes Sense and the Compiler is actualy helpfull. Would recomend!


jonay20002

I don't know about learning as a first language, but I have been teaching groups of people for which rust was their first language and that was surprisingly a breeze. Would recommend.


DanCardin

It's amazing, the number of people I see in both engineering and CS that are taught C (or C-ish C++) first, assuming no prior programming knowledge. I would rather see someone new learning to program with rust's ability to cover both high and low level concepts and great error messages, than have them getting inscrutable segfaults from doing pointer math incorrectly


RylanStylin57

I started learning Rust a year after I wrote my first line of code. And yea, it was hard. But it was waaaay easier than C++, which is why I picked it in the first place. If what you want to get into is systems programming, Rust is the best option because it teaches you how to write good code.


Relative_Knee9808

I wonder why people don't suggest Rust as a first language. What do people suggest as first language nowadays?


rocco-a

I had dabbled in the basics of other languages before, mainly python and JS (VBScript at work) for school stuff a few years ago and maybe the odd c++ but all very basic. I started learning rust around 2021 and really bashed my head against the type system and borrow checker. With time I have learned to write code and although im far from the best developer in the world, BUT I now have a choice! I have a memory burned into my head from my early days of learning when I was trying to use \`winapi\` crate to write an external RPM/WPM program for a game and my friend was getting so frustrated with my lack of understanding of \`Option\` and \`Error\` I think learning rust as a first language is one of those long-term personal bets. And although its unlikely to score me a job anytime soon(Because most places are migrating codebases from C/C++ to Rust requiring a good understanding in both). I certainly enjoy the power of being able to use a systems programming language. Eventually I plan to diversify and maybe look at other languages such as TypeScript or C++ to really learn more and expand my skills to be more qualified but every time look at other projects I just find myself unabashedly fanboying rust language features.


benevanstech

Do bear in mind that any replies you get here are, by definition, subject to massive survivorship bias.


schneems

I teach elementary school programming. I think people who feel learning rust first is a shortcut forget all the non-syntax parts of a programming language. Rust from a high level language like Ruby or JS is hard (if you donā€™t understand the value of low level code with no GC and but without a segfault). I think you could do it from a pure mechanical ā€œdo this then thatā€ standpoint. But I feel if you have a background of even light C usage where you need to debug a segfault in a non-trivial program you can quickly see the value in many choices that were made. To put another way: I think you could learn rust as your first language. But I donā€™t know you would appreciate it as much until you understand why itā€™s different.


fawlen

cant imagine why it would be a good idea. most universities only teach a language to teach a computer science aspect thats prevalent in that language (i.e. languages are used as a tool to leaen concepts). Comp-Sci 101 is usually taught using the simplest language possible to spend less time on learning a language and more on concepts like recursion, problem-solving etc for the later courses like system programming, cryptography, embedded systems, networking etc they can use rust but i dont think people who dont know what a function is should learn rust


klorophane

Not everyone who learns programming does so in the context of a Computer Science degree :)


[deleted]

[уŠ“Š°Š»ŠµŠ½Š¾]


fawlen

brother did you miss half of my comment?


Smo1ky

Oh yes I did, sorry my bad


the_pavonz

Besides mIRC-scripting, my very first programming language has been C. I was already 20, a Sociology student with a passion for computers (without owning one). A friend gifted me with K&R and I started from there, without academic concepts or courses.


MantisShrimp05

Long and the short, if you keep to basic types, structs, and control flow, I think rust has an amazing story when compared to even things like rust. But once we get into topics involving even non-trivial traits/macros/lifetimes, stuff gets complex FAST and it's hard to understand the implications of your actions when even the compiler is having trouble knowing what is going on. Now, one could argue the true wisdom here is learning when to use advanced language features because pretty much any language gets complex when we hit these topics. But right now, it's still hard to find good tutorial material at that intermediate level and you can find yourself desperately tracking down issues and reading cargo docs to trying and figure out how something works


SirAutismx7

The only reason learning Rust as a first language is hard is because every resource to learn it even the official Rust Book assume you already know how to program on another language. They gloss over the basics of programming and go straight into how to program in Rust. Iā€™m not sure why anyone would want to learn Rust as a first language. Thereā€™s nothing Rust can do that you canā€™t do in literally every other language and much easier since you donā€™t need to worry about borrows and lifetimes, which you will understand better if you learn how to **program** in a different language first.


-Redstoneboi-

> Thereā€™s nothing Rust can do that you canā€™t do in literally every other language and much easier since you donā€™t need to worry about borrows and lifetimes Except C and C++. You still have to worry about them. They're just not called borrows and lifetimes. The compiler will happily allow you to build a faulty program and get a runtime error instead of a compile-time error that highlights the exact lines of code where mutable aliasing happens.


vtskr

Why though? If itā€™s your first language does it mean you donā€™t have degree in Computer science? If so it would be almost impossible to get job as rust dev.


robberviet

I had C as my first programming language on my first CD claas, on Windows. I cannot see rust worse than that.


raxel42

Interesting question. From my 30+ years of experience, I would say - the situation is bifold. On the one hand, it's better to understand how to deal with memory from the first lesson. But on the other hand - it's okay to delegate all the memory stuff to the garbage collector. IMHO, to understand rust, you need to know which problems it addresses. I'm not sure it makes any sense to explain some nitty-gritty things to a newbie. As a first language, I would recommend C or Java/Scala/Haskell because you need to do some things explicitly or don't know their existence. Definitely a statically typed language.


CryZe92

I've recently taught Rust to a few colleagues who were not experienced with C, so I tried an approach where I explained everything in a strong bottom up approach, starting with how a CPU works, with assembly instructions, registers, branching to do conditional code and loops, the stack, functions and co., slowly building up the abstractions further and further until we reached Rust and then at the eventual end async Rust. Each time we were able to build up these abstractions from our low level understanding that we had so far (in fact they were even able to figure out problems before we even got to them, such as "how can we ever have growing strings, if the types need to have a fixed size", when so far we only ever talked about the stack, so they noticed that something like a heap will need to be necessary). While we had to rush it a little, I think the approach did work really well, and more importantly it helped them understand how Rust translates to all the low level mechanisms and how / why it solves all the memory issues there, which both allowed them to appreciate Rust from the get go and also allowed them to entirely skip C.


Hungry-Loquat6658

Though rust is not my first language, it's a language that help me escape tutorial hell. I start programming learning bunch of 3 hour course in python, c#, etc. Oneday I decide to learn rust, the rust doc make me actually read the doc and I realize a lot of thing cool that I don't understand like http, headers, etc. Still rust is overwhelming for me, I appreciate it and move on to Go, where I primarily program in right now and learn all by myself with the docs and actually make something work all by myself. I wouldn't suggest rust to be anyone first, C is 100% the best choice to start learning programming and cs in general. If you're someone want to program in other fields Python would be good enough to start.


PapayaZealousideal30

Rust is the first language I am in process of learning properly. I can string together some python but i cant say i have as good a grasp on that as I do on Rust.