The most difficult part of learning Rust for me isn’t ownership or slow compile time. It’s that thought in the back of my head that "I could do it much quicker if I were using C#".
I could do that quicker using X
So far I’ve been reminding myself: no matter how badly implemented it is, the rust version will most likely be faster, correct and probably run correctly when it compiles for the first time. It’s working great so far.
I'm also glad I wont have to come back and scrutinise my code to allocate less and go easy on GC in the future.
Ownership rules aren't that different
If you had a brief look in Rust and got scared due to borrow checker rule or resulting compiler error, and ran away (like me) - I invite you to give it another go but look at it from a different angle this time.
If you are already familiar with profiling, reducing allocations and optimising code on the hot path - you read the code and keep track of what you are allocating and how are you passing these data around. So you are just "following" the memory on your own.
Rust compiler is doing the same thing for you with the added benefit of statically writing the (invisible) deallocation code alongside your code. So that nothing sticks around when they are not needed.
It’s a lot difficult to look at old code or even worse, someone else’s code and follow the memory than just do it as you are writing them.
I like to learn by doing. This time I am also keeping a list of projects I'm doing. I am calling the repo "Rust Graveyard". It's a private repo where I add a link to any rust project I have started. Of course these projects are not "done". However they have served their purpose, to explore the language while building something cool ¯\_(ツ)_/¯.
The list is getting longer, apart from the last project I've blogged about, the list has everything from rewriting a C# continuous test runner, to a meme maker web app, to a library for mocking gRPC server to a webpage showcasing awesome Rust projects by parsing awesome-rust repo and everything in between.
They have just two things in common, they are incomplete and naive. However, every single one of those projects helped me learn so much more.
Where am I going with this?
It's quite difficult to focus on something so different like Rust in whatever little time I get after my day job and an evening of being a dad to a little 💖 human 👼. So I've landed myself a role in another team that uses Rust in a payment product in my company.
I am a bit nervous about this move as this will be the first time I'm taking a role that takes me completely out of my comfort zone. This will be a great challenge for sure but I have faith in myself and the brilliant, helpful, and humble geniuses I will be working with. As to why am I taking a break from C#? this is a story for some other time.
We are hiring for various Rust and C# IC roles. If you are up for it then come join us.