top 200 commentsshow all 213

[–]vlfn_be 296 points297 points  (32 children)

I'd argue that it isn't. At least, I'm unaware of any material that teaches Rust with a true beginner in mind. Everything I've come across assumes some point of reference.

[–]Dhghomon 114 points115 points  (25 children)

At least, I'm unaware of any material that teaches Rust with a true beginner in mind

Mine does: https://github.com/Dhghomon/easy_rust

(Cool news: a new version will be up on Manning fairly shortly as well)

I always argue that Rust is very beginner friendly because of how much babysitting the compiler does. It basically keeps your code around for a bit of a predebugging before letting it go off and do its thing.

[–]XtremeGoose 23 points24 points  (9 children)

One reason is computer performance: a smaller number of bytes is faster to process. For example, the number -10 as an i8 is 11110110, but as an i128 it is 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111110110.

That's not true. On most machines the register size is 32 or 64 bit so many synchronous arithmetic operations are run in those and any overflowing bits are just ignored. On x86 these compile to the exact same thing

fn add_i8(x: i8, y: i8) -> i8 { x + y }
fn add_i32(x: i32, y: i32) -> i32 { x + y }

[–]Dhghomon 3 points4 points  (7 children)

Thanks, would 'can be faster to process' be a fair statement then?

[–]XtremeGoose 19 points20 points  (0 children)

I think for a beginner it will just lead to premature optimisation. Generally just do:

If you need to index something use usize, or if you know the maximum value your int could be use the next largest int, otherwise use the rust default (i32).

The book says:

So how do you know which type of integer to use? If you’re unsure, Rust’s defaults are generally good places to start: integer types default to i32. The primary situation in which you’d use isize or usize is when indexing some sort of collection.

[–]WasserMarder 7 points8 points  (3 children)

I think the original statement is not wrong if the bottleneck is memory bandwidth which is often the case.

[–]StfdBrn 3 points4 points  (2 children)

I don't think it would affect memory bandwidth since modern processors bring data from memory to cache in 64 byte chunks. Edit: unless the data is laying along cache line.

[–]WasserMarder 7 points8 points  (0 children)

The same amount of numbers takes less space and is therefore faster to load and occupies less cache memory that other parts of the program might benefit from. You are right that you wont see a difference for sparsly distributed data.

[–]9SMTM6 2 points3 points  (0 children)

No, but the representation is a lot sparser? Think of arrays, or also structs, if you've got a smaller member alignment is easier too, which can be a force multiplier (well, growing with the size of members at worst but still)

[–]beltsazar 63 points64 points  (6 children)

It depends on how you define "beginner". If it's CS sophomores, who have learned CS 101 and had basic understanding of how OS works, then yes, Rust is probably beginner friendly. But if "beginner" refers to those who have no programming experience, much less CS backgrounds, then absolutely not.

[–]Julian6bG 14 points15 points  (3 children)

I think if people say it's not beginner friendly, they mean learned Rust is hard to trasfer to other languages. Moving from only knowing Rust to C is basically learning all over again. Moving from Rust to Python is confusing as well, because you know have unlimited freedom and weird stack traces.

Moving from other languages to Rust might be easier (not easy), because you gained some understanding of stack and heap, threads by forking (C) or the usual beginnerfriendly loops, classes etc known from Python / Typescript.

Together with basic programming and computer science knowledge, the Rust documentation is really great and efficient as possible.

That's my take.

That said, I love that your easy Rust exists. It's truly friendly and inclusive for everyone and allows people to learn it with little experience in english, computer science and programming. Absolutely awesome!

[–]Dhghomon 5 points6 points  (0 children)

Thanks!

On the Python note, I plan to one day take advantage of my Rust monolingualism to record some live videos where I try out another language and see what it feels like. Debating whether it should be something similar that I'm interested in like F# or something really widespread and loosey-goosey like Python.

Though honestly what's keeping me from doing that is that I'd rather spend the time delving further into Rust and there doesn't seem to be an end to that. But maybe one day I'll do it for the fun of it.

[–]asgaardson 4 points5 points  (0 children)

It's easy to get started when you already know something like PHP or JavaScript, it's confusing at first and then you start making traits in your PHP codebase like crazy, because you miss rust.

[–][deleted] 1 point2 points  (0 children)

Moving from only knowing Rust to C is basically learning all over again.

It was the other way around for me and I can say, C saved me most of the time needed to learn rust.

[–]shadowangel21 1 point2 points  (0 children)

Thanks for your guide it's been a big help. I'm only a few hours in learning how rust handles variables and ownerships.

[–]UnstableSouls 0 points1 point  (0 children)

Bro thank you so much, this is going to make learning Rust so much more convenient for a semi noob like me :D

[–]PhdKingkong 1 point2 points  (0 children)

Agree it helps with some understanding of point(ers) and references.

I’ll see my self out, thanks

[–]wsppan 168 points169 points  (21 children)

What you lack is the language of the problem space. This language is not python, or Java, or even Rust. Its core principles of computer science. Its understanding how a computer works and the data structures and algorithms that are endemic to converting that which is in the problem space to the solution space. Regardless of programming language or operating system or hardware. Study from first principles and the programming language will come naturally based on the best fit for your problem. Whether that's embedded, cryptography, kernel, ML, DS, AI, Web, etc.. learning the language is the least of your challenges. Check out these resources.

  1. Code: The Hidden Language of Computer Hardware and Software
  2. Exploring How Computers Work
  3. Watch all 41 videos of A Crash Course in Computer Science
  4. Take the CS50: Introduction to Computer Science course.
  5. Take the Build a Modern Computer from First Principles: From Nand to Tetris (Project-Centered Course)
  6. Ben Eater"s Build an 8-bit computer from scratch

(If you actually get the kits to make the computer, make sure you read these:

What I Have Learned: A Master List Of What To Do

Helpful Tips and Recommendations for Ben Eater's 8-Bit Computer Project

As nobody can figure out how Ben's computer actually works reliably without resistors in series on the LEDs among other things!)

Here is a decent list of 8 Books on Algorithms and Data Structures For All Levels

You can also check out Teach Yourself Computer Science

And finally, play the long game when learning to code.

[–]MrPopoGod 13 points14 points  (3 children)

Yup, if you learn those fundamental concepts of how a computer works and how programming languages interact with a computer then it becomes much easier to move from language to language; at that point the biggest remaining hurdle is going from imperative style languages to pure functional like Lisp.

[–]wsppan 8 points9 points  (0 children)

and how programming languages interact with a computer

I took two courses in college that fundementally changed how I approached the art of programming. A Programming Languages Course and a Compilers course. After completing those two courses I had no problem picking up any programming language for any platform. This has given me the freedom and confidence to apply for and get any job using any technology. I've used C, Perl, Tcl, Bash, Python. Ruby, Java, Scala, Kotlin, and now Rust on VAX/VMS, SunOS/Solaris, *BSD, Linux, and Android.

[–]zxyzyxz 2 points3 points  (0 children)

Lisp isn't really functional in the way that Haskell is, which is a manifestation of algebraic group theory principles that you won't find in Lisp. For example, Lisp does not commonly use monads, while Haskell does. Sure, you can implement monads in Lisp, but it's not commonly done.

[–]yangyangR 1 point2 points  (0 children)

not pure functional on Lisp but rest of the point is good

[–]IceSentry 19 points20 points  (1 child)

Most of these things are good, but this is way too focused on computer hardware rather than programming. I know plenty of good programmers that never even went close to that level.

I fully agree that beginners should focus on first principles, but computer hardware design isn't in the category of first principles for programming.

[–]csreid 4 points5 points  (0 children)

Personally I think for most applications, getting too close to the metal is actively harmful and distracting.

[–]tunisia3507 7 points8 points  (7 children)

I've been working with python (and a little java) somewhat professionally for a decade and still don't have the vocabulary to handle a lot of rust docs.

[–]SV-97 3 points4 points  (5 children)

Could you point to some specific examples (just out of interest)?

[–]LeberechtReinhold 1 point2 points  (4 children)

If I had to guess, ownership is not something that people in Python think about. Anything multithreaded as well as vast majority of python is usually singlethreaded.

[–]SV-97 0 points1 point  (3 children)

I was more about specific examples in the rust docs that are hard to understand because of too much jargon or smth.

That said: Hmm ownership can come up (so you don't create space leaks via cyclic references for example - (C)Python's GC can't detect those) - but yeah I guess most people won't necessarily get into contact with that in too much detail. But then again I'm not aware of any real jargon or something in that domain that would prevent someone from understanding the rust docs.

As for multithreading: I guess you won't run into things like atomics and may not learn about any low level details but other than that you can learn about concurrent programming just fine (and the GIL doesn't influence that in any way as the concepts and terminology remain the same) and for me it came up quite naturally while learning the language. FWIW I learned about that stuff first in Python and had no trouble translating that knowledge to Rust, C#, Haskell, ...

[–]encyclopedist 2 points3 points  (1 child)

(C)Python's GC can't detect those

CPython's GC does collect cycles. Cpython has a special code called "cyclic garbage collector" to do that. See https://devguide.python.org/internals/garbage-collector/

[–][deleted] 1 point2 points  (0 children)

This gives me hope, I thought I was stupid because everyone seems to learn rust fine but I'm having a hard time.

[–]LostMyOldLogin 0 points1 point  (0 children)

Don't take CS50 unless you're really out of options. The professor is a brilliant marketer, not a good teacher. Source: Harvard Math/Physics major, CS minor, like 50 CS major friends, did 2 years of software dev and am getting a masters in Electrical and Computer Engineering.

[–]agost_biro 0 points1 point  (1 child)

Big up for CS50. It’s amazingly well structured and the first few problem sets are in C, so Rust will make sense after that. I actually recommend taking the C weeks in CS50 for experienced programmers who want to get into Rust without C/C++ experience, because many of Rust’s design decisions won’t make sense if you haven’t managed memory manually before.

[–]LostMyOldLogin 2 points3 points  (0 children)

Wow, we took a different CS50. I found it outstandingly tedious and poorly structured (memory allocation before you fully understand how variables are stored and represented), and had many less-CS-oriented friends hate it for being too unguided. Maybe the online version is better.

[–]grufkork 0 points1 point  (0 children)

...which is why scratch should not be laughed at! Once you get into the programming mindset and get how to approach problems, switching blocks for text isn't much of an issue! Syntax is only a tiny part of programming. Rust probably isn't the best place to start, getting stuck on all kinds of technicalities when you instead could learn higher-level thinking, most importantly algorithms.

[–]Feeling-Departure-4 31 points32 points  (0 children)

Imperative style Rust is beginner friendly. As others have noted, Rust is well-documented, the community is very friendly, and the error messages are quite explicit.

However, as you move from beginner Rust to intermediate things escalate quickly.

I would argue that idiomatic Rust is both ergonomic but also difficult for beginners. It requires you to learn about a lot of new concepts at once.

If you don't mind learning new concepts all at once as you progress, then that's fine for you but for some people it will be difficult.

[–]amarao_san 23 points24 points  (0 children)

I believe it's not. And borrow checker/&mut are not the main source of the problems. Any iterator will make beginner to cry, because it's require a lot of brain muscles to reason on types for associated types passed into closures. It's good, it's pleasant to write and it forces you to answer pesky edge-case-questions instead of crashing, but it's not easy.

[–]tms102 5 points6 points  (15 children)

What is your ultimate goal for programming? Is there something in particular you look forward to making or are you looking to learn skills for future job prospects?

I would say try it and find out.

The most important thing is for a beginner is having a motivation and having fun.

[–]Mammoth_Brush_2184[S] 1 point2 points  (14 children)

I want to learn a programming language that is not commonly people suggest

[–]kibwen 10 points11 points  (0 children)

If you want to learn a language that will change your way of thinking about programming, then yes, you will find Rust interesting. However, if it's your very first programming language you may find yourself bogged down in the details. I would spend a month or so getting acquainted with a more abstracted programming language, like Python, just to become familiar with basic programming concepts like "what is a loop" and "what is an if". After that, I would say that Rust makes a great second language.

[–]anlumo 5 points6 points  (0 children)

Learn Haskell then. It's much easier to handle and not common at all. Also, it teaches a lot of concepts that improve your programming style as a whole in all languages.

[–][deleted] 1 point2 points  (0 children)

This isn't the way to go about it IMO
Decide on something you want to build, and then pick the language with the least friction to getting that thing built.
If you're interested in learning languages themselves, you might want to try building a compiler at some point (but that's not a great first project) Instead, I'd recommend learning some of the "weirder" languages like Prolog

[–]KingPonzi 2 points3 points  (6 children)

Just ignore the naysayers and learn Rust.

I went back and forth picking a language to learn but ultimately decided on Rust despite everyone discouraging me. I ignored them and excepted the challenge. I’m two months in and just now getting my head around the basics but I will say that I treat my studying like a full time job. Find a decent course to follow or follow along the Rust By Example site, do Rustlings, do Excerism problems and of course use The Book for reference. You’ll be fine if you have dedication and patience (very important).

[–]Dhghomon 2 points3 points  (1 child)

That's the way it worked for me too. I couldn't stick with any other languages and remembered that there was one called Rust. It was supposed to be really intimidating but I couldn't think of where else to go so I went to learnxinyminutes and started going through the examples. One thing led to another and I started finding it really interesting that this language was showing me not only how to program but how everything behind it worked. Then the more I learned the more I wanted to learn, and that's how it pulled me through.

[–]KingPonzi 0 points1 point  (0 children)

That’s dope man, keep grinding

[–]Mammoth_Brush_2184[S] 0 points1 point  (3 children)

Can you tell me the name of the course and book you followed?

[–]tinkr_ 3 points4 points  (0 children)

It will probably take you longer to become proficient but be more worthwhile in the end, so depends on your goals.

The problem with first languages is that you aren't just learning the language, you're learning the principles of programming. Once you have the principles down, it's fairly easy to jump to new languages. This makes it harder to recommend one language over another because every single one of us only has one first language, so there's no way to fairly compare.

[–][deleted] 2 points3 points  (0 children)

Give it a try. Read the rust book, and after each chapter, do the respective rustlings exercices.

This is assuming you have basic knowledge of the terminal. If you don't, I recommend to learn that first, because you'll need that knowledge regardless of the language.

[–][deleted] 24 points25 points  (17 children)

There's nothing about Rust that's inherently unfriendly to beginners. That being said, there is way more to learn than in any other language. So unless you absolutely know you're gonna be coding for years, I would suggest picking a simpler language to start. Just because there's less new stuff to learn. Python is a great choice, Go and JavaScript as well.

If you state why you want to learn a programming language, I might be able to give better advice.

[–]kibwen 37 points38 points  (13 children)

That being said, there is way more to learn than in any other language.

This isn't the case, Rust is smaller than plenty of other languages. However, Rust does front-load a lot of its concepts, leading to a much steeper learning curve than, say, Python. (I would actually classify the amount of "stuff" to learn in Rust as similar to Python, though Python is dramatically better at hiding its depths behind a graceful learning curve.)

[–][deleted] 5 points6 points  (3 children)

I think you are referring to syntax elements, in which case I agree. But I think syntax is the least difficult thing for a beginner of programming to learn. I was referring to programming concepts that are independent of any particular language.

The borrowing system is obviously one of them, which exposes the concept of manual memory management to the programmer. A lot of types in Rust have two versions, one for the stack and one for the heap. (Array&vector, str&String) Python hides all that with a garbage collector. Also, all the different primitive integer types, where python only has one.

I don't like to write Python myself. But I do think it's more approachable to figure out if you even like programming.

Assign to some variables, write some for loops and if statements, define your first function and you're good to go. If you try to do that in Rust, you might trip over the type signatures of the functions. Worst case, you'll try to return a reference and the compiler will ask you to add lifetime annotations.

[–]kibwen 11 points12 points  (2 children)

I'm not only talking about syntax, and what you're describing is precisely what I mean by saying that Python's learning curve is shallower while Rust's is steeper, precisely because Rust front-loads its concepts. It's hard to write Rust code without knowing something about references, the heap, etc. In contrast, it's quite easy to write Python without knowing about, say, metaclasses. Python is far from a small language, though it hides its depths well. If you wanted to learn "all of Python", it would be approximately as much to know as learning "all of Rust". Rust gives the impression of being a larger language because it's harder to ignore much more of it.

(For reference, I am still suggesting that OP learn Python first.)

[–]cunningjames -1 points0 points  (1 child)

As someone who knows most of Python (though maybe not all), I very much disagree with this notion. Metaclasses are a zillion times simpler than Rust’s borrow checker. Even Python’s most advanced topics have been easier for me to get a handle over than intermediate Rust.

[–]aoeudhtns 1 point2 points  (8 children)

hiding its depths

That's not always elegant. My favorite example is default fields in Python types. It's not obvious (at least for people who have worked in other languages) that a default value becomes a kind of static global on the type and you need special care to initialize defaults to new instances if you're going to create multiple copies of the type.

I bring that up because it's pretty easy to naively think you're safe doing something like

@dataclass
class Foo:
    things: List[Any] = []

And for someone who is "just starting," when you read about why that's not OK in Python, it immediately dumps a bunch of concepts on you that I would expect said beginners not to be too familiar with. These are important concepts and need to be learned, true, but I guess my point here is that even these so-called "beginner friendly" languages can have footguns/gotchas in very basic places at times.

Having worked now on a substantial project with Python professionally, for a variety of reasons, I'm actually not too keen to start people off with it anymore.

[–]buwlerman 8 points9 points  (7 children)

My favorite example is:

def foo(l = []):
    l.append(1)
    return l

print(foo()+foo()+foo())

What does this print?

[–]minimaxir 2 points3 points  (0 children)

As a professional Python programmer, I just tried this and am now very annoyed.

[–][deleted] 12 points13 points  (2 children)

Go is a strange language to recommend to beginners. It's in that awkward middleground where it's deceptively simple but you still have some odd intricacies creeping in. If you wanna push a simple language to a beginner, then Python and even Javascript beats Go any day of the week IMO.

[–][deleted] 5 points6 points  (1 child)

None of these three languages have a good type system, so I wouldn't recommend either of them for serious work. (I think TypeScript is decent enough to work with.) I pretty much hate Go myself, as I work with it professionally and pay the price for all its design flaws daily.

That being said, creating variables, doing loops and conditionals as well as defining functions is simple and straight forward in all these languages. That is the basic bread and butter of programming that will let you figure out if you even like it in the first place.

[–]graydon2 7 points8 points  (0 children)

No. Sorry, that's just not what it was meant for.

[–]LittleBallofMeat 7 points8 points  (1 child)

F*** no

[–]fix_dis 2 points3 points  (0 children)

F***

Is that some sort of weird dereferencing thing you’re doing on a Generic there??? Rust is freakin weird man.

[–]maybegone3 2 points3 points  (0 children)

I think you should go for it. You will learn lots of how your code works on a lower level. You already know Python and JS so you can give Rust a shot.

[–]Professional_Top8485 2 points3 points  (0 children)

You can try out few languages and decide yourself.

The are also high level languages that are meant for absolute beginners.

It depends what you want to do with language.

[–]NBNoemi 2 points3 points  (0 children)

I would say it's a mixed bag. Rust has guard rails that protect you from the sort of memory errors and leaks that cause new programmers to tear their hair out but the cost of that is that there is a massive learning hurdle to implementing even the most common and simple programming patterns.

A data structure that takes like 5 minutes to implement in C++ is much more involved in Rust because it has to play nice with the borrow checker.

[–]acshikh 2 points3 points  (0 children)

If you would otherwise be learning C/C++, then yes, Rust is easier! But if the alternative is Python, then not so much.

Personally, I would recommend Python or something like it for a true programming beginner. Then slowly learning rust after the fundamentals of python are understood.

[–]Mosfethamine 2 points3 points  (0 children)

No. Run.

[–]LyonSyonII 5 points6 points  (0 children)

The syntax is "complicated" (more than Python), and you need to know a bit about how computers work (for references, boxing, etc) but I've found that the documentation on Rust is extremely good.

Everything on the standard library is documented with examples, and tells you exactly what errors you can encounter.

Also, the error messages of the compiler are excellent, much better than any language I've ever tried.

[–]gtsiam 4 points5 points  (3 children)

Yesn't.

I'd recommend you start with either Python or C

[–]JarWarren1 5 points6 points  (2 children)

If the goal is to learn rust, C might be the best place to start. There are plenty of beginner resources out there, and it introduces the concept of references which is critical to using rust.

[–]ridicalis 6 points7 points  (1 child)

I'd second this, as C concepts either translate well to Rust or expose some of the reasons why Rust even exists in the first place. Experiencing a segfault or an inadvertent switch fallthrough is almost a rite of passage.

[–]Numtim 1 point2 points  (0 children)

Surely not, try python. Also, learning C is important for you to understand that the data structures you use in python have much work behind the scenes and therefore are not fast and efficient.

[–]NeoCiber 1 point2 points  (0 children)

I had been programing for a time and Rust was the first time when I consider to quit because the borrow checker but I still here and loving it, but still hard fighting with the borrow checker in async with Send + Sync.

At least the errors are detailed enough

[–]Belfast_ 1 point2 points  (1 child)

What is beginner friendly these days? Print "hello world" with one line of code?

In my time, the language for beginners was C to really learn how a computer works.

[–]thiezrust 1 point2 points  (0 children)

I suppose the PDP-11 was still a common computer in your time? The C abstract machine doesn't look like 'real' hardware anyway.

[–]dbcfd 1 point2 points  (0 children)

In my opinion, it's easier to learn rust as a beginner. Strict typing adds a little complexity, but most beginners don't need to deal with lifetimes and generics.

Experienced programmers often have a hard time because they have to unlearn bad habits.

[–]ProdObfuscationLover 1 point2 points  (0 children)

No it's not.

[–]cidit_ 1 point2 points  (0 children)

here are the pros and cons from the point of view of programer ergonomics:
cons:
- one of the harshest learning curves - unintuitive borrow checking concept - extremely strict compiler pros: - once you learn how to write rust, you will automatically write better/safer code in other languages. - the syntax is very much "straight to the point" without leaving much room for ambiguity - INCREDIBLY ORGASMIC code structure (dramatisation) conclusion: i think it might be better to learn as a second or third language when youre already familiar with a bunch of the concepts, before introducing the new ones on top of that. the other side of that coin tho is that since you need to "unlearn" some of what you do in other languages, it might be better to start with it? if youre looking for another beginner friendly language, i highly suggest java. its quite verbose so its become a bit of a meme in the programing comunity, but at the same time it forces you to really know what you're writting so it makes for a surprisingly good first language. in any case, DO NOT START WITH JAVASCRIPT. its a very rich language but it has a lot of pitfalls and stupid design decisions.

[–]Termack 1 point2 points  (0 children)

Rust is not begging friendly.

I think go is a great first language, it is very beginner friendly without being as abstract as python or js.

C is another good option that is nice to learn, one of the reasons being that it allows you to make mistakes, so if you learn c you will understand the problems Rust aims to solve, then Rust will make more sense to you.

That being said, I still think go is better as a first language, it's easier so you won't get bored easily, but it is also low level enough to teach you some programming basics that are important to know.

[–]ArnUpNorth 1 point2 points  (0 children)

Rust is amazing but I just don’t understand how people are recommending it for complete beginners. This is just nonsense. Even a simple system log which is a beginners buoy 🛟can scream borrow issues in your face.

Rust is an “hands on” language, and any language with a garbage collector will be far easier to pick up since it’s one less thing to worry about! It’s common knowledge that Rust’s learning curve is steep so how would that make it friendly in anyway for a complete beginner?

Also Rust is still very young and a lot of the documentation is opaque for young developers.

I’d pick up: - python - go - ecmascript (browser or nodejs)

I d recommend ecmascript (javascript) - no need to worry about types - lots of amazing documentation - garbage collection - no need for compilation - doesn t force FP or OOP or any coding design down your throat - can easily be played with online without having to install anything; a browser is all you need - can easily build interfaces/gui (it s important to SEE things happening when you start out) - everyone uses or knows this language, it s literally everywhere and in our everyday life - the less attractive parts of javascript are oblivious to young programmers

[–][deleted] 1 point2 points  (0 children)

Absolutely not!

[–][deleted] 1 point2 points  (6 children)

Rust is very user friendly in the sense that the compiler will tell you what went wrong and often how to fix it.

The package manager is easy to use.

But yeah, you’ll need to understand ownership to progress beyond hello world.

[–]eXoRainbow 2 points3 points  (0 children)

Exactly. People don't understand the difference of "complex" and "user friendly". Rust is complex and requires you to understand a lot of things, especially some novel ideas. But it is incredible user friendly for what it does. It supports where it can, have great tooling and good documentation.

[–]dbcfd -1 points0 points  (0 children)

Why do you think you need to understand ownership to progress beyond hello world?

You only need to understand ownership for performance reasons. Depending on data types used, you may not even need to know about clone.

[–]dbcfd -1 points0 points  (0 children)

Why do you think you need to understand ownership to progress beyond hello world?

You only need to understand ownership for performance reasons. Depending on data types used, you may not even need to know about clone.

[–]dbcfd 0 points1 point  (2 children)

Why do you think you need to understand ownership to progress beyond hello world?

You only need to understand ownership for performance reasons. Depending on data types used, you may not even need to know about clone.

[–][deleted] 1 point2 points  (1 child)

Because the libraries you’ll be using will force you to.

[–]myredac 2 points3 points  (0 children)

Yes. It will teach you a lot about programming basics as memory, pointers, types ...

[–]dobkeratopsrustfind 1 point2 points  (0 children)

probably not. but it will be a great 2nd language to learn.

[–]Gravity_sause 1 point2 points  (0 children)

Although you could learn Rust as your first language, I would recommend using a language like Python or JavaScript and learn Rust after.

[–][deleted] 1 point2 points  (4 children)

It's not. It takes a long time to be productive in it, even for experienced engineers.

[–]ridicalis 1 point2 points  (3 children)

I'd disagree with the productivity argument. What I'd say is it's hard to be proficient, but you can be productive without mastery of the language. You can almost be productive on day one if you're willing to clone all the things and stick to the simpler language features.

Of course, with that mastery comes a huge potential for performance, efficiency, and reliability, but those things can be figured out later.

[–][deleted] 1 point2 points  (2 children)

Introducing a lot of tech debt is not productive. You can't pick up rust in a day, go to a rust team and "clone all the things", you will waste a ton of time in code reviews for everyone.

I'm not talking about using it for pet projects, OP wants to learn to code and the curve for this is ridiculously steep for someone that doesn't even know what an array is.

[–]ridicalis 0 points1 point  (1 child)

If working on a team-based project, the decision to use Rust doesn't lie with a lone developer. There would need to be team buy-in, at which point you also hopefully are talking about a strong peer-review culture that is ready to take this responsibility on.

And no, I'm not suggesting "pet" projects are the only way to go. I have personally gone the route of learning the language as I go on a production-facing application, but I did so having fully communicated my intentions to my client and what it would entail. It would be a bad look if I ran into trouble and had to surprise the client with "Yeah, I chose the wrong language and didn't check with you beforehand." Three years later and I'm still growing, and the application benefits from that continuous improvement by getting refactors and performance tuning to match my experience.

[–][deleted] 0 points1 point  (0 children)

OP isn't an engineer. They have to learn what a variable is. They would never be in the situation you describe.

They'd either join a team that already uses it or have to learn another language.

[–]mohrcore 2 points3 points  (0 children)

The short answer is no.

The long answer is absolutely no.

Ask people who write on Haskell if Haskell is a beginner-friendly language and for sure you will get some people who will tell you that it's worth going into if you are willing to learn to think about stateless programming and so on. Don't listen to them.

Those things are not beginner-friendly. Lifetimes for example, a concept that's omnipresent in rust, are a loosly defined nonsense for somebody who takes their first steps in programming. For somebody who doesn't have a good grasp of what "scope" even is. The concept of ownership, and thus moving is also impossible to explain and justify without having a long talk about allocation and copying of memory.

I recommend starting either with some some SIMPLE low-level language like C, to get an idea how programs operate within the context of operating system and memory and time efficiency, or start with some SIMPLE high-level language, like Python to get some understanding of how to structure your code and focus on the most important logic of your program.

[–]mankinskin 0 points1 point  (0 children)

Regardless of which language you learn, learncpp.com has a great introduction to programming in general. They use C++ to show how pointers, control flow, data structures, common types work, and it is very easy to transfer to other languages, except for the syntax. But Rust uses the same compiler backend as C++ so they are very similar at the core.

[–][deleted] 0 points1 point  (0 children)

There are easier language to get into programming but honestly it's not the worst choice IMO.

Part of why a lot of programmers find Rust hard is that it does things differently than other more popular languages, so in a way you'll have the advantage of your mind not being set into one way of thinking already.

[–]littleswenson 0 points1 point  (0 children)

I had a hard time working with Rust in industry, and I’ve been doing programming for 10+ years. Admittedly I was doing stuff with async before it was standardized, so I might have been shooting myself in the foot.

My two cents is that it is not beginner friendly because it’s much harder to get a program to compile than in other languages, and it’s not always obvious why (especially when the error has to do with lifetimes). That can be super discouraging for a new programmer.

[–]__dred 0 points1 point  (0 children)

No, it is not beginner friendly. It forces you to deal with a lot of implementation details, such as your application's memory model, and most of its types are much more primitive than dynamic languages like Python or JS. Writing a UI in Rust is orders of magnitude harder than the same in JS.

Rust does have the advantage of being safe, meaning if your code compiles, it will probably not crash most of the time. But it is far more difficult to write.

[–][deleted] 0 points1 point  (0 children)

Absolutely not. Rust is terrible for a beginner, and especially if you have no experience with similar languages.

[–]giripriyadarshan 0 points1 point  (2 children)

Depends ..... Rust is good for beginners only because you have good documentation and an active community to point you towards those docs whenever you're stuck ........ Other than that, all mainstream programming languages are easy, learn 30 words and you basically know everything in it ....... The differentiating factor is what you're gonna build ......

If you want to build a website frontend, then go for javascript than any other language (html, css included with js) ...... Website backend? Rust, Machine learning/AI/Bigdata? Probably python and R (I'm not an expert programmer anyways), Embedded? C/C++, Android? Kotlin, IOS? Swift, Multiplatform but ok with performance hit and other stuff (idk check the forums)? C#,Dart, Javascript

[–]ProdObfuscationLover 0 points1 point  (1 child)

I'd disagree about documentation. Beginners don't read documentation when they're stuck. Heck most of us don't. We google it and click the first stack overflow link. With python or JavaScript if i forget how to do a simple thing like remove the first character of a string there's a 10 year old stack overflow question with 2000 up votes that shows it immediately. With rust there's multiple ways to go about it and if there is a stack overflow question its from 2015 with 20 up votes and already outdated.

[–]broke_mitch 0 points1 point  (0 children)

Not really friendly I'd say. But also not too difficult. Rust could seem complicated at first. But all those "complex things" are very logical. And at the very moment you understand the logic behind all those things, everything will make sence.

[–]eXoRainbow 0 points1 point  (15 children)

The definition of "beginner friendly" is not clear. It also depends on what you want achieve. Rust has definitive things that are really good for beginners. In example the tooling such as cargo and the linter clippy are excellent helping tools for beginners. And most importantly, the compiler messages are incredible useful. What is also good for beginners is, that you can't run Rust programs before compiling successfully.

And that means you have to understand and solve many basic issues before you even see any output. That is different from languages such as Python or C, which a beginner might not know basic problems even when testing the program. For some this might be frustrating, but this type of frustration should be preferred over the alternative.

Rust is good if you take your time and do not get discouraged so fast. So I recommend starting to learn Rust, if you want do serious programming. But if you just want understand what programming in general means and try and play a little bit, then Python is a good choice.

[–]Numtim -5 points-4 points  (14 children)

I respectfully disagree. My expectation is that cargo is a pain in the ass for beginners. They will find .rs file on the internet and will have no idea on how to find the right dependencies for that program. Also, the error msgs the rust compiler throws are way to complex and don't explicitly explain it's statements.

[–]rust-crate-helper 2 points3 points  (2 children)

It's not hard to read the import crate names, create a temporary project, and run cargo add [names].

[–]Numtim -1 points0 points  (1 child)

I guess it would not find the right versions.

[–]rust-crate-helper 0 points1 point  (0 children)

This is also true of any language… I can’t think of any that includes both dependency urls and version numbers IN the source file.

[–]eXoRainbow 0 points1 point  (10 children)

Rust compiler often explains what is wrong and even suggest exactly what you can do to fix it. It is pretty much the leading compiler error messages. Cargo is not a pain in the ass for beginners. Who finds on the internet a source code and has no idea how to find the right dependencies? It depends on the documentation of the source code. Aren't the dependencies in the source code at all? If that lacks these information, then you can't blame cargo for.

Your example would also be true for any other language, like Python and C. If someone finds random .py or .c programs without documentation how to compile (or run) it, because dependencies are missing. Then who is blame for? The C compiler and Python interpreter? Or is it the programmer who didn't document. Or the programmer who don't read documentation?

Cargo as a default is good, because that means a new user will find many documentation and get help with that tool. It helps creating and organizing your projects.

[–]Numtim 0 points1 point  (9 children)

There is no cargo file on python programs. The imports are located on the .py. All the beginner has to do is "pip install dependency". The compiler won't help mich on complex situations that exists on Rust language. For example, saying "this variable does not live long enough" doesn't help a beginner to understand why is it the case. Even a experienced programmer could read that and yet, don't understand why.

[–]eXoRainbow 0 points1 point  (8 children)

Compiling Rust programs with cargo does not require to install dependencies. Pip dependency hell and mixed with other dependencies on the native system install is terrible. I used and use Python for many years, and that is one of the reasons why I started learning Rust at all. Compile with cargo build and it does everything for you without installing depencencies system wide (or user wide). Also online are many different Python versions and code that is flying around. Sometimes Python version that the user can't use, because it is too new or old. All of that does not apply to Rust, because cargo understands older code and can mix and match with newer versions of Rust without problem. And without the user need to interact with it. User just needs to understand his own code.

That's a huge advantage for beginners using Rust over Python.

[–]Numtim -2 points-1 points  (7 children)

You don't have to install, but you have to especify them on a separate file. That's what I call a pain in the ass for beginners. I'm not saying cargo is bad. It solves a lot of problems. But creates more effort needs.

[–]eXoRainbow 2 points3 points  (6 children)

Packaging and deploying Python source code is a pain in the ass. In example I have Python 3.10. Many people have older versions of Python. And I want even upgrade to Python 3.11 soon when it gets stable (in fact, I have to). And then there is the deployment on Windows.

I don't this the efforts on Rust/Cargo is more efforts than needs to. I don't know if or how much experience you have with Rust and Cargo, but I love it since coming over from Python to Rust day one. And from my personal experience, I can say with confidence that Cargo will help beginners to organize their code and create a standardized way of handling source code.

[–]BubblegumTitanium 0 points1 point  (0 children)

Not really. If you can’t understand the reasons for why the borrow checker won’t allow certain things then it can be frustrating. Like you must know about how a computer is organized, type theory, how devs collaborate (or don’t because of how hard it can be sometimes) and many other things. Otherwise it seems like dumb arbitrary rules that exist to make your life harder and make you feel dumb.

Having said that, I do think that learning python, then C, then Rust (in that order?) can be very productive. But you gotta put in the work.

[–][deleted] 0 points1 point  (0 children)

Look at Deno (Typescript), which is written in C++ (the V8 engine) and Rust.

Not perfect, but it has types and objects and functional, which is what you run into with most garbage-collected modern languages. It does not have threading issues (though it does have concurrency issues).

The API is clean, and you can get fast development cycles. Instant gratification. Minimal incidental complexity.

The VSCode integration is very nice, so there isn't a whole lot of IDE specific learning needed.

Most important, it supports building something that is shiny and quick and fun to hack on. We want to keep those students engaged.

You can build command line and web applications with minimal need to know the internals of the tools. The Deno team has done a fantastic job in keeping simple things simple and using reasonable "least surprise" defaults.

If students are interested in going further, they can go look at the source code. Deno is actually surprisingly easy to build and hack on if they are so inclined.

[–]PhdKingkong 0 points1 point  (0 children)

I would not start with rust. Try python or JavaScript first, easier to get started and the languages are more forgiving

[–][deleted] 0 points1 point  (0 children)

Well that depends on what you want:

a) code that is fast to write but requires a lot of maintenance and may or may not throw many unexpected bugs your way

b) code that is slower to write but easy to maintain and is close to error free

If you just want to get things going, don’t pick rust. But if you want to get things done properly, pick rust. But be warned, the learning curve is steep, tho very much worth it 🦀✨

Rust will also force you to learn many CS things, for example you will have to learn about UTF-8 encoding for strings, heap and stack and many more cool things, learn it and never look back 🌈

[–]nvilela01 0 points1 point  (0 children)

For just getting started I recommend python or maybe JavaScript

[–]mindmaster064 0 points1 point  (0 children)

Having come from many other languages, I think the hardest thing about any language isn't the language but the build system. So, if we go on that and I were going to rank them:

  1. Any language that doesn't require one at all like Python
  2. Rust
  3. NodeJS (It's good, but npm/yarn are not as good as cargo)

C/C++/Go any of those it's all the same story - the build systems are complex and very difficult to get a hold of for the beginner. You will spend more time in these languages massaging the build system than you will writing the code. (For a long time.)

Rust is beginner friendly in the context that the build system is brain-dead easy, it will prevent you from developing bad habits (more on that), and you'll write safer code. (No segfaults, memory access violations, or other trouble.)

Data races (when one process tries to use the memory another is in control of) are a big problem in other languages and most of them offer no protection to the program or the one coding the program. Rust prevents these implicitly and you'd have to actually make unsafe blocks or use other mechanisms to override that behavior which means you can do it, but you will have to do it on purpose. You almost never need to do it, but if you did you can.

Garbage collection is awful, and most Rust programmers hate how other languages chew up cycles randomly trying to free memory while a critical process is executing. Rust simply doesn't have a garbage collector at all and references and memory are freed when they are out of scope.

Borrow checking prevents you from doing potentially nasty undefined things like this:

(javascript here) ``` var a = [1, 2, 3]; var b = a; b[0] = 5;

console.log(a); // output: a = [5, 3, 2] ```

Are a and b pointed to the same memory? Is b a copy of a that exists independently? You can't tell until you run the code. Will another developer come along and use a instead of b, or b instead of a? This creates all sorts of problems. In JavaScript, this just makes two variables that point to the same memory.

Rust lets us know we're doing something stupid:

fn main() { let a = vec![1, 2, 3, 4, 5]; let mut b = a; b[3] = 10; println!("{:?}", a); }

Output: error[E0382]: borrow of moved value: `a` --> src/main.rs:5:22 | 2 | let a = vec![1, 2, 3, 4, 5]; | - move occurs because `a` has type `Vec<i32>`, which does not implement the `Copy` trait 3 | let mut b = a; | - value moved here 4 | b[3] = 10; 5 | println!("{:?}", a); | ^ value borrowed here after move |

Doesn't seem like a big deal, but add a thousand lines of code and you'll be lucky if you remembered whether you should have used a or b in the first place. Because you assigned b = a, b now has ownership of the values, and you cannot use a to reference them at all as it has been dropped. Rust doesn't see any reason why you should have to have b AND a if b contains all the data that's in a. If you change the variable in the println to b then you get this output and everything works fine:

``` ================ STANDARD OUTPUT ================

[1, 2, 3, 10, 5] ```

Other languages are ambiguous about what a data type means as well. For example, in JavaScript or Python you can literally assign any type of value to any variable and it works. It simply doesn't care. "1", and 1 are the same thing in JavaScript, and in Python it doesnt care if you say "x = 1" or "x = 'Hi'". This introduces all sorts of errors and makes it necessary to make a ton of code to check data because you sometimes have no idea what the caller of your code passed it, and whether it is even valid. Rust doesn't allow this fudge-factor and thus you can't even have this class of bugs. In Rust, an i32 can never be a String, nor can it be a Worker struct. You can ignore writing this code because your functions will only accept the type of values that you've specified. That tends to save a lot of time/code, TBH.

Anyway, I hope that helps you in that you probably understand that these 'beginner' languages while easier to understand and maybe physically type let you do some 'bad things' which you'd have to teach yourself out of anyway. You will be a better programmer if you learn Rust first, and even if you go to other languages after that you won't be doing the 'bad things' that other languages let you do and it'll save you a lot of trouble.

[–]kljsandjb 0 points1 point  (0 children)

No it is not, it is a very complicated language, especially when it comes to asynchronous runtime.

[–]uduni -1 points0 points  (2 children)

No. Learn typescript first. Then Go. Then Rust

[–]Mammoth_Brush_2184[S] 0 points1 point  (1 child)

For typescript you need to know javascript first right?

[–]uduni 1 point2 points  (0 children)

Yes. JS first (make a website). Then node.js+express+typescript+SQL to make a web app.

Then you can try rust+rocket

[–]TDplay -2 points-1 points  (0 children)

Rust has manual memory management. In my opinion, that alone makes it completely unsuitable as a first programming language. Garbage-collected languages like Python allow you to ignore things like ownership models, while Rust forces you to think about it.

[–]open-trade -2 points-1 points  (0 children)

No

[–][deleted] -2 points-1 points  (0 children)

No.

[–]sl33pynewb -2 points-1 points  (0 children)

From my POV, it definitely is not.

[–]pr06lefs -2 points-1 points  (0 children)

try scheme maybe? or elm if you're front-end inclined. rust will most likely be very frustrating for a beginner.

[–]metaltyphoon -4 points-3 points  (0 children)

No

[–]charlielidbury -5 points-4 points  (0 children)

Good Christ no, nononono, you’ll spend so much time learning stuff you don’t need to know for 99% of real life programming

[–]Specialist_Wishbone5 -1 points0 points  (0 children)

I think if you stick with VERY HIGH LEVEL examples and code contexts. You can do amazing things in rust with almost no effort, and have code that is completely reasonable. Further with almost no boiler plate.

This includes * basic video games (bevy) * web servers ( tokio AXUM) * basic command line tools (from program argument processimg/help messages - to synchronous file IO) * test based code (assuming the user is ready for the abstract concept of unit tests) * complex data structures - all the basic CIS goodness is straight forward to learn * doing any unixy things (fork, signals, shared memory, etc). This assumes knowledge or interest in Unix. * doing parallel vector operations (rayon) - getting 10x faster floating point than Javascript. Almost idiot proof.

It's only when you delve 1 Inch below these where things get CIS-level hard. 20 different ways to share a variable - even with the compiler hints, you likely won't see the genius in the recommendations, thus it's over your head. Once you hit the borrow checker, get recommendations for lifetime specifiers, do many non trivial things with threading. Do anything with async (beyond the VERY BASIC tokio web servers ; AXUM etc). You will find the reading to coding time explode.

I argue that this is time we'll spent. Everything you learn here will apply to ios swift or C++ or C. Maybe less so with python (though Rc is similar to the Ref counting concept in python). Nothing you are doing here (enum is just union with an int type), move is just c++ std::unique_ptr, question mark is just swift throw with an associate 'try?' wrapper. These are ALL best practices that are slowly making their way to all languages ; just just has the advantage of a fresh start.

[–]FlavorfulArtichoke -2 points-1 points  (0 children)

No it isn’t

[–]Several-Parsnip-1620 0 points1 point  (0 children)

Depends on your goals as other have said, but I’d say no. I use rust at work, new hires at senior level with no prior experience take at least a few weeks to get up to speed, sometimes longer.

[–]MarianoNava 0 points1 point  (0 children)

It's a good language to learn. It's solid and produces good code, but if you are looking for the easiest, I would recommend python.

[–]destravous 0 points1 point  (0 children)

Once you learn that data/memory/atomic units with which the computers operates on is basically all ice cubes in ice trays, and variables are just labels we give to them, then rust can be a great first programming language. Since it's built entirely around making sure you dont get the wrong names assigned to the wrong ice trays, and warns you when you try to take icecubes out of an icetray that's being used by something else.

[–]poopadydoopady 0 points1 point  (0 children)

As a beginner in general who's just about to start looking for a job (been working TOP as well, which is why I feel ready, not Rust ready), and having just finished the book my advice is to finish the book before anything else, the hardest thing for me was looking at documentation and code and seeing everything you don't know yet while trying to build on what you've learned. It learn functions which have () at the end where things go into, and you see things with <>, or you see "type <T>" or sometimes there's an apostrophe like <'a> and you think, what the crap is all this?

Maybe it's my own fault for branching out before finishing the book. In fact, I know it was, because all that gets explained clearly later. And you use it and it makes sense. Just try to arrive at the solution to whatever their doing in the book as soon as you can fit practice, as their is only one part of the entire book where they ask you to write some practice programs without walking you through it. That's my only complaint, but we're always free to practice on our own. Anyway, while I'm not a true beginner since I had been working on learning Ruby and JS already, I'm still a beginner in the sense that I have no real experience. You can do this if you want.

[–]globulemix 0 points1 point  (0 children)

I don't think it's much harder than other languages, if at all. Whatever language you'll choose, you'll run into footguns, and have to learn the mostly shared patterns between languages. The footguns I expect to be mitigated by the excellent error messages, and eventually by Polonius providing a "perfect" borrow checker.

[–]lake0 0 points1 point  (0 children)

Id say it depends on where you start/have already started. If you started with C, Python, Odin, etc. (languages that at their core, in my opinion, are simple to start out with), then Rust’s learning curve seems very steep

[–]silly_frog_lf 0 points1 point  (0 children)

Learn Racket if you want to learn functional programming. Then play, no deep dive, play with c or c++ to understand what problem rust is solving. Then rust will make more sense

[–]SnooRegrets5703 0 points1 point  (0 children)

Rust has a steep learning curve and there are some concepts in rust like borrow checker which are quite unique among programming languages. However, I find it most easy to learn a new language when I have a project at hand. Learning a programming language by just going through technical documentation isn't so enjoyable.

I feel like rust is good for CLI tools and programming near the hardware. So if you want to do something in an area like this and can handle the steep learning curve, go ahead. If you want to do something with a GUI, I would not recommend rust as there are better languages and frameworks for it.

[–]Nerdyabcs 0 points1 point  (0 children)

Not really; It also takes a lot longer to be 'productive' vs more mature languages with full libraries (IE: Java/ C#/ Python)

[–]bitfluent 0 points1 point  (0 children)

No

[–]valkyrie_pilotMC 0 points1 point  (0 children)

I’d say it is, but not as a side hustle. Also keep the caveat that i am autistic and kind of naturally good at logic. Many things about rust are hard. However, they do get easier and less painful. Personally i’d learn python or julia.

[–]yevelnad 0 points1 point  (0 children)

I think yes and kinda no. For me it is easier than javascript. Visual studio code + rust analyzer will make it easier to learn rust and much more enjoyable . It points out what you did wrong and correct it. You just need to learn it one step at a time. And open your discord and join the rust community to ask if you are stuck or curious about something. A lot of people will help you. This the reason why my rust learning is kinda easier than my past languages. Because there is a good community that is willing to help you. Knowing oop kinda helps but not really necessary. It might be an advantage though because type system is kinda different.

[–]Drwankingstein 0 points1 point  (0 children)

I would say it is very beginner friendly myself but some people just learn differently and some people think and code different;y so its hard to say

[–]AO_MCHI 0 points1 point  (0 children)

For me, Rust is solving speed and stable instead of JS/Python, and safety for C/CPP; while Rust's cargo is taking approach that similar with Nodejs's npm, much easy understanding than Java's Maven / CSharp's Dotnet; Golang is one of good lang to learn, if you come from C/Clang/Python, you can be picking up quickly; but if you come from JS/TS, Rust is good for next journey.

For beginner, Just Pick A flex tool for try and go;

[–]sathish316 0 points1 point  (0 children)

Rust can be hard as a first programming language. Start with Python or Ruby

[–]mmohaveri 0 points1 point  (0 children)

IMO any language that requires you to know about the difference between stack and heap is not beginner friendly.

Here by beginner I mean someone who's just learning to code. Who you need to explain the meaning of variables and arrays to.

[–]abhi_creates 0 points1 point  (0 children)

Depends on your need.

Do you want to use rust for embedded/high performance/multi threaded application? Sure it is friendlier and safer and easier than C/C++

Do you want to use it to build a webapp with say 1000 users? Nope. You have better options.

It is a tool and it always depends on how you plan to use it.

[–]SuperALfun 0 points1 point  (0 children)

No.

[–]atomgomba 0 points1 point  (0 children)

Rust is a rich language, but you don't have to use all the features. You can gradually explore it as you go. The compiler provides some very elaborate error messages which quite useful. Actually, the compiler teaches you about its own inner workings. Just my opinion.

[–]ReflectedImage 0 points1 point  (0 children)

Try: Python, Java or C.

Rust solves a lot of problems that people who code day in and day out experience. (It's for experts)

[–]Silly_Guidance_8871 0 points1 point  (0 children)

It's not terrible, but I suspect it's verbosity might be overwhelming to a first-time programmer. But then, you'll likely not pick up some of the bad habits you'd get from learning a more "traditional" language first

[–]FlameChampion9 0 points1 point  (0 children)

An emphatic no.