What are considered hard topics in Computer Science / Rust?

So I have most of Rust's syntax down, but truth be told there are two aspects that I am not comfortable with, and are bullet points on my list of Rust topics to master. Once I have grasped these, I think I can pretty confidently call myself... a programmer! :smiley:

  • Anything Concurrency
  • Smart Pointers

Now incidentally, these are two chapters from The Book that I haven't yet read. Perhaps I should start there. But the internet is awash with literature/talks on concurrent programming / async/await, so I find myself getting lost in all the choices. And from my understanding/experience, good use cases of Smart Pointers are rare, so I never find myself needing to pick up that tool from the toolbox.

Because you are probably wondering why I am posting this... Two questions:

  1. Best strategy for becoming proficient in these two topics? Any thing that made them click for you?
  2. What other hard areas (non domain specific) may I have overlooked that are worth considering adding to my list?

Thanks in advance.

There're only two hard problems in computer science - cache invalidation, naming, and off-by-one error.

20 Likes

Luckily cache invalidation is not something most of us ever have to do and Rust does a pretty good job of preventing off by one errors, for example when accidentally stepping outside of array bounds, so that leaves only naming things as the hard problem.

That sounds like joke but it can be quite deep. Not only do good names help users of your code understand it but I have found that as I'm evolving a solution the things I name and how I name them can have a profound effect on how I think about my problem and how the solution turns out.

Also luckily Rust saves us from all kind of nasty problems we could have working with concurrency and pointers. I don't think you will have a hard time mastering them.

The hardest thing to do in Rust by all accounts is to create a simple linked list data structure. When you have mastered "Too Many Lists" Introduction - Learning Rust With Entirely Too Many Linked Lists you can call yourself a Rust Programmer.

Personally I'm not sure I'm ever going to master macros.

Another hard topic is creating a safe API around some unsafe code (native code, high-performance primitives that use lots of raw pointers, dynamically generated jitted machine code, etc.).

When you touch on the concurrency section, you may want to look into Jon Gjenset's video on porting Java's Concurrent Hashmap to Rust. It goes into a lot of detail about how concurrent data structures are designed and what you need to do to write one correctly.

2 Likes

While that's true for things like hardware cache coherency protocols, cache invalidation questions are pervasive in all forms of distributed systems. Even a "simple" website becomes a cache invalidation question as soon as you start using a CDN. (Have you ever hit Ctrl-F5 in a web browser? If so you've dealt with cache invalidation problems :upside_down_face:)

But maybe I'm oversensitive to this since one of my big projects at $RealJob can be summarized as "pass around a better cache invalidation token"...

2 Likes

Ha! Yes indeed.

I guess it's just that for a lot of my $RealJob work we hate caches. They make a mess of timing determinism in real-time systems.

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.