Learning Rust: Mindsets and Expectations

栏目: IT技术 · 发布时间: 4年前

内容简介:We often hear that Rust is a language that is too complex and too difficult to learn. While, yes, the languageWhen you learn your first programming language, it's very likely that you'll hear this observation:This statement makes an interesting point, but

We often hear that Rust is a language that is too complex and too difficult to learn. While, yes, the language is complex, we have identified some existing mindsets and expectations that serve as obstacles to the learning process. Let's discuss these obstacles and how we can alleviate them in our first post onlearning Rust.

Comparing Rust to other languages

When you learn your first programming language, it's very likely that you'll hear this observation:

“If you know one programming language, you know them all.”

This statement makes an interesting point, but it is a faulty assumption. It is also more applicable for some sets of languages than it is for others. For instance, it does not take into account which language(s) you know and which one(s) you are learning.

While most languages share a common set of concepts (e.g., variables, conditionals, iteration, data typing, and functions), they may diverge widely beyond the realm of this common ground. Some languages are more divergent than others.

Not only do we have the faulty assumption that knowing one language allows you to "know them all", we also live with the widespread phenomenon of engineers' devotion to a single language. Oftentimes, these engineers consider their favorite languages to be universally superior to others.

With the coupling of these two problems, we see the following patterns emerge:

  • The people who struggle the most are the ones who are already experts in other languages (even the languages that feel similar to Rust, like C, C++, or Go).
  • People often attempt to implement things in Rust in a way that is idiomatic in a different language, even if that other language has significantly different scope and behavior (e.g., Python or JavaScript).
  • People often attempt to implement a relatively complex challenge before they have grasped core Rust concepts (e.g., attempting to use or modify existing libraries, or attempting to re-write a script or large-scale program).

While these learning strategies and approaches are not invalid, they only take you so far. And without immediate successes, it can be very difficult to motivate yourself to continue. In short, your attachment to another language can serve to interfere with learning Rust .

Unsurprisingly, the concepts that are unique to Rust are what cause the most pain during the learning process (e.g., Ownership and Borrowing and Lifetimes ).

How to learn Rust - effectively

In tandem with the patterns we have mentioned above: people in the industry are fascinated with Rust and what Rust aims to accomplish, but they hesitate to learn it when they hear rumors about how difficult it is. Thus, they don’t try.

Conversely, we've observed some promising patterns with the folks we've spoken to - folks who have had success learning Rust (either from us, or from the internet at large).

Here's what they tend to have in common:

  • They began their learning process by spending time with Rust's core concepts.
  • They had a mentor or trainer who could help them conceptualize important parts of the language.
  • They started small, building on successful projects and slowly increasing their scope.
  • They were new to programming, or they came from a significantly different domain; thus, they didn't have expectations for how Rust would compare to other languages.

Three things

Learning Rust can and should be an enjoyable and effective experience! Based on the patterns we've observed, we suggest that you keep these three things in mind.

Learn how to walk before you try to run.

As we've mentioned, an experienced programmer may attempt to implement a relatively complex challenge before addressing core Rust concepts. This is not surprising: it's reasonable for you to expect to hit the ground running, especially if you work as a software developer or you write programs for fun.

By the same token, it's likely that you're able to dedicate only a limited amount of time to learning Rust. Are you learning Rust in your free time, or evaluating it for work? For whatever reason, you might try and learn as much as possible, as quickly as possible.

As such, we know that you might find it very frustrating to slow down and take tiny steps - instead of running a fast sprint or marathon. Nonetheless: take heart! Once you have developed an understanding of core concepts and fundamentals, you will take bigger steps and move on to complex projects with more ease and grace.

Appreciate the divergence.

Turing completeness is a "thing", but some programming languages are more suitable for certain tasks than others. Appreciate these different languages as the tools they are, with the specific features they offer and the things they do particularly effectively. Perhaps your task is to open a can of soup: you could certainly use a chainsaw to do this, but wouldn't you prefer a different tool?

The process of identifying the similarities between languages: this is only the beginning of a programmer's journey outside of their comfort zone. It is only the beginning of their discovery of the kind of tool they hold in their hands, and the kinds of problems that it is meant to solve.

The goal of the journey is to recognize and master the differences between tools. There would be no point in learning other languages, if they really were all the same!

Practice patience.

In the big picture, Rust is a very young language and has undergone a lot of changes in the last several years. Indeed, many of its features have grown less complicated since the early days of its existence. Rumors have persisted in regards to how hard it is to learn Rust, but it's very likely that these rumors are outdated and refer to a version of the language that no longer exists .

Throughout this post, we have reiterated the fact that time is inherent to the process of learning Rust. We refer to the fact that Rust is under active development , yes, but more importantly: we refer to the patience that we have noticed in folks who have succeeded in their journey. Give some time to your learning process, and you'll see that core concepts like Ownership and Borrowing deliver joy: they make it easy and comfortable to write programs that are memory-safe !

Stay tuned …

In the next part of this series, we will discuss one of Rust's unique philosophies: its aim to be practical . This is helpful not only in production, but also in the process of learning the language.

We hope you will read onwards! In the meantime, please consider signing up for our newsletter or enlisting us astrainers for your team.


以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

赢在众筹

赢在众筹

杨东、黄超达、刘思宇 / 中国经济出版社 / 2015-1-1 / 48.00

第一本股权众筹体系化图书。李克强总理要求“开展股票众筹融资试点”。人民大学杨东教授,天使街黄超达、刘思宇两位老总倾情创作。阿里巴巴、平安集团、京东等多家机构联袂推荐一起来看看 《赢在众筹》 这本书的介绍吧!

RGB转16进制工具
RGB转16进制工具

RGB HEX 互转工具

XML、JSON 在线转换
XML、JSON 在线转换

在线XML、JSON转换工具

HEX CMYK 转换工具
HEX CMYK 转换工具

HEX CMYK 互转工具