How to climb the cliff!

just beware rhat this year AoC is a bit higher difficulty imho compared to last 2-3 years... you can pick any of the past years from the top menu events/calendar on its homepage.

I can't know what it is for you personally of course, but I think (for many who experience this difficultly and not everyone does) it is the strict ownership model, along with the related borrowing and lifetimes, their importance in the type system, and their tight integration with the standard library. This is something fairly new.

All the languages you mentioned above I would say have very similar models: they are imperative (rather than functional) and they leave ownership for you to manage (with RAII in C++ being a partial exception). You've obviously internalized that model and learned to work well with it.

The same is true for me. And when I learned functional languages I had to struggle to understand and internalize the new model. Functional programming is very different from imperative programming because mutation is forbidden, or at least greatly deemphasized. But once I learned one functional language it was relatively easy to learn others.

I consider Rust's imperative model with strict ownership to be a third sort of model to learn (compared to imperative and functional). Even though it is imperative and uses mutation like many other languages, the strict ownership requires learning (and often struggling with) a new and different mental model, for me and I think many others.

There are new languages being created that also rely on strict ownership like Rust, and I assume they'll be easier to learn after becoming comfortable with Rust.

5 Likes

Similar to what's already been shared there is also a book which collects Rust-specific mdbook documents: GitHub - lborb/book: The Little Book of Rust Books.

1 Like

Same here. In practice, and not just with Rust, I've found I've learnt from them even when they get the answer slightly wrong!

Sometimes I'll ask them to write a solution to a problem I've already solved, or seen, to see if they come up with something different.

I also compare the output between various Chat AIs. They can vary in their answers and/or in how much explanation they provide.

I first read the book to a certain level - up to about generics I think and then tried converting a program from C# and attempting to get the correct output. However, I quickly found that I could not reproduce it as-is and scaled back my ambition to produce a simpler version that produced the correct output. Then I kept tweaking it over a period of time using a combination of clippy and further Rust study, e.g., doing Rustlings.

I can think of Pony, which I briefly looked at a few years ago. It seems to be taking a long time to reach 1.0 but at the time, conceptually, it looked mind-bogglingly tougher than Rust.

Pony is an open-source, object-oriented, actor-model, capabilities-secure, high-performance programming language.

IIRC it is the "capabilities-secure" part that is the conceptual analog of Rust's ownership, borrowing and lifetimes.

I suspect better results would come from trying to learn from experience what design patterns work well in Rust than from trying to translation a C# program's architecture into Rust.

I think when you're learning a new language it's best to find some existing problem and to try to get it working in another language. And then gradually "idiom-ise" it. Plus, it was a fairly simple program (adapted from a book) and wasn't radically different from a Rust approach as far as I could tell, but my knowledge of Rust wasn't up to it initially.

1 Like

I think that is a good approach.

It can have some odd effects though. I started out with Rust by reimplementing some little programs I had written in C before and Javascript before. The end result was that I learned enough Rust to write it in a way that looked almost identical to the C and Javascript versions,

Then I decided to tackle something bigger, implementing the proprietary protocol that is the interface to some hardware device and for which I had an example implementation in C# provided by the vendor. It turned out that example was a mess of inter-dependent objects, as if they had used classes "because one should" and then spread functions around them at random with no rhyme or reason. Extracting what need to be done from that spaghetti into Rust was a nightmare.

So yes, start with an existing problem one is familiar with solving in whatever previous language, but don't try to recreate that solution directly in Rust.

3 Likes

Hi,

I would like to add the following book sample to the list:

ZERO TO PRODUCTION IN RUST by Luca Palmieri

It is only a 59-page sample extract from the book proper. What I find valuable about this is a very thorough discussion / tutorial on actix-web integration tests.

I would strongly recommend this to anybody who is new to Rust and is learning actix-web -- like myself :slight_smile: .

Best regards,

...behai.

1 Like

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.