I'm trying to learn Rust and I have big difficulties with it. Just as with C++ at some point in time I understood that I can not learn everything and that there are some aspects of that language I've never heard of and I do not need them and I'd like to do the same thing with Rust.
Do you know any good books or youtube tutorials which focus on core features leaving all the other things aside so I could learn them at later time or never if I do not need them?
Javascript programmers had the same issue with that language and someone decided to write JavaScript: The Good Parts to solve this issue.
btw I know that Rust isn't that big programming language but its syntax sometimes makes my head hurts.
Yeah I've tried to read it but somewhere in the middle I stopped and I do not know excactly why but as I've already mentioned this kind of books/tutorials where person tries to teach you everything does not work for me very well. Anyway I'll try some other sources but maybe Rust is not for me and that's all there is to it.
Cheers.
Hey, I don't know what kind of programming you do, or want to do, but don't give up so easily.
Rust has some valuable new concepts to wrap ones head around and like you I sometimes find the syntax infuriating.
The hardest of all the new concepts is all the stuff about variable lifetimes and the borrow checker. But as it happens you need to understand those concepts get programs working reliably in most other languages.
As for the syntax, well, I could say the same about any other language that is not the one I know well and have become comfortable with over years. One gets used to it.
As a noob, I have probably ignored large chunks of the Rust book. Macros for example, anything to do with async. At some point I picked up enough to get programs running and found myself getting on with that rather than learning more about Rust. I really should get back to my Rust study.
Stick with it, I have a feeling you will find the effort very rewarding.
Tech is an industry where imposter syndrome is all too common. Don't put yourself down so easily. I'm confident that if Rust fits your use case, it is the language for you! With an open mind, Rust does not fit every use case. In your shoes, I would try to answer the question from that perspective.
I guess I should add that the underlying subtext is the same as described by others. Learning Rust is like learning everything, really. There's a certain amount of effort that must go into it. And that can be translated into time. You didn't wake up one day with a complete vocabulary, for example. You also didn't absorb mathematics through osmosis. You spent a great number of years learning both, just as we all have.
As someone already mentioned Rust by Example is a good place to pick up the basics (even if you skip some sections). Being in the same boat as you, I found the combination of Rustlings, Exercism's Rust track, and official books works well.
Douglas Crockford's "JavaScript: The Good Parts" is a catchy title to stimulate book sales. It plays on the commonly held notion that JS was a silly scripting language and mostly crap. A language on suitable for web developers to do simple things in a browser and that real programmers looked down on and would not deign to touch.
That is thesis I reject despite all the weirdness of JS' type coercions and such that people like to make jokes about. What the book actually did was make a good job of making people aware that JS was a pretty sophisticated language with features that many other commonly used high level languages did not have and have been trying to acquire since. For example first class functions, lambdas, closures, prototypical inheritance, asynchronous (event driven) programming model (Looking at you C++)
"The Good Parts" pointed out JS's sophistication while skipping over the "boring parts" that are common to all other languages.
Similarly the question here presupposes that Rust has a lot of parts that are not good. Which I think we can all agree is not the case.
The book "Rust: The Good Parts" might then be a slender volume that concentrates on all the special and somewhat unique features of Rust, for example the whole variable ownership thing, life times, traits, macros and so on. Whilst skipping over the boring parts that are common to most other languages. Hopefully presenting these concepts/features in a way easily digestible by regular users of other languages. It might not be the book you are looking for.
To be fair, the original implementation of JavaScript is exactly as you described. Unfortunately, the stigma persisted unnecessarily as the language evolved. I think the book title was a good move.
Applied to Rust, it does kind of imply that the language has "bad parts", which is debatable. It has things which some people dislike, but it has almost nothing that is universally despised. Compare to JavaScript, which still has its baggage from the old days...
As far as I can tell JS was standardized very early on, before it had a lot of users. JS has remained compliant with the original standard whilst gaining some additional features with new revisions of the standard. That stability/dependability over time is a great asset to a programming language.
"Javascript: The good parts" was published in 2008 and describes the language prior to modern revisions of the standard.
Do you have specific example of what you mean?
I like the title as well. It's catchy and to the point. I see the book as a reaction to the fashion for ridiculously gigantic 10Kg tomes that were a popular way to write books about programming languages. Possibly the first time a book concentrated on JS as a language in it's own right without dragging in all the crap that is the DOM API and the browser environment.
My only comment is that the language has a rich history, and the perception of early iterations of JavaScript directly influenced Douglas Crockford to address those concerns in his book. With special consideration to the title.
The Javascript creation story is indeed amazing. I'm not convinced that is the whole story though. Brendan was hired by Netscape to create a scripting language for the browser. He clearly knew a thing or two about language design and had a plan in mind, based on Self if I recall. Netscape did not like the syntax so he had those 10 days to recast it into something normal people would understand. An impressive feat none the less.
I am familiar with all those resources. The "wat" talk is typical of hundreds of such criticisms of JS all over the web. Everyone loves to point and laugh at JS. I don't really buy it. It's not that they are wrong factually. It's just that in practice they don't matter much. Most of the "wat"s are down to not knowing the language and expecting it to be something else.
One could make the same kind of "wat" talk about C (and by extension C++). Given that C has so many undefined behaviors, platform/compiler defined behaviors and general sloppiness.
Wat, you can index off the end of an array?
Wat, you can call a null pointer?
Wat, you can use uninitialized variables?
Wat, adding int's of 32767 and 1 overflows sometimes?
Wat, C does not have a string type?
Wat,...
I could continue, I had so many "wat's" during my first week or two learning C. I could not believe a high level language would be allowed to do that, as my programs crashed into oblivion often bringing the whole machine down with it. Forty years later and nothing has changed in C in that respect, nor C++ by extension.
And yet, those same "real programmers" who pick on JS would not dream of pointing fingers at C and laughing.
A book called "C: The Good Parts" would be very thin
Some of these comments are getting close to language bashing, which isn't appropriate.
@twar, in addition to The Rust Programming Language book as already mentioned, you may be interested in a (paid) video series that @shepmaster and I authored called Rust in Motion, where we try to cover the concepts that are the most different in Rust compared to other programming languages. The hope is by learning these concepts, you'll have enough background to look up the syntax differences and APIs as you need them, but you won't get stuck on errors that talk about ownership, borrowing, and lifetimes.
Javascript and C are 2nd and 3rd on my favorites list (not necessarily in that order) and still in use here. I don't anticipate that changing any time soon. As such I feel I have earned the right over many years to poke some friendly fun at them. Rust replaced ALGOL in top spot, with the important advantage that I can sensibly use Rust now a days.
If you hear me speaking of Perl, Python, PHP or pretty much any other language that will probably be bashing
Hi
I feel the need to explain myself , when I was talking about good parts of this language I meant those that are most essential and not that there are some bad parts.
Ownership and borrowing I understand or at least most of it but some other things not quite. For example all those lifetime params for example, I do not know why there are needed, why sometimes they have to be specified and sometimes they do not.
And no, I'm not asking you to explain this concept to me but I'm just saying as an example.
I know C++ quite well but when I'm reading some of those Rust concepts I'm really scratching my head I mean literally.
If you read some of the other threads in this forum, posted in the last few days, that ask questions about lifetimes, you'll get significant understanding of what they mean, why they are needed, and how the compiler uses them to ensure that safe Rust does not lead to use-after-free and other classical memory use errors. (Note that both Microsoft and Google have recently stated that 70% of their major security vulnerabilities arise from such errors.)
It's an odd thing. I know a good bit about C++, by no means all of it, I have used it on and off for decades.
C++ has me scratching my head more often than not.
Given the bugs that I have had to deal with when a team of contract C++ programmers is disbanded I gather that more serious C++ professionals than me don't understand it either
Now if only said contract C++ programmers had enforced all the memory safety rules that Rust enforces I would not have been left with crashing applications to fix and memory leaks to to track down after they were gone.
In short, one needs to understand ownership and borrowing in C++ as well. One needs to understand lifetimes in C++ even if the language does not enforce it. If you don't your code will crash, produce random results or leak memory.