Advent of Code #3: Slowing down
As of today, I'm at 15 stars. And I've been on that for quite a while now. Basically since the last blog post, the usual happened to me: I hit a few hard bumps and lost momentum. So instead of joyfully being excited about what I've been learning and how I've solved this past week's puzzles, I wanna talk about two things related.
Why am I struggling with Rust?
During this month, when I've told people I picked up Rust to learn while solving the puzzles, I've been getting a very similar response. People have been surprised that I decided to do such thing, which I guess means that I took quite an extra challenge for myself.
I understood why things I tried didn't work but I it would take all my brain power to figure out a workaround to get around it. I might have a vector of
&String and I needed to filter out certain ones based on some condition and maybe some sort of string manipulation. In JS/Python, I could just make an empty list, loop over the input and add things to the list. In Rust, I constantly ran into problems with variables created inside loops since I couldn't add references to those into the vector because the variable would get dropped at the end of the loop.
Second challenge that was way smaller, but still something that caused inertia and slowed me down, was static typing. And especially in a way that I had a lot of trouble getting used to the many different return types of different functions. Maps, filters, collects, lines, chars and all the other functions seemed to all return very different things and I always struggle to figure out how to convert those into vectors that I could actually then work with. So often I was told that I cannot translate a result of some of those collection functions into
Vec<&str> or whatever I ended up needing.
Community around Advent of Code is lovely
The one thing that has been keeping me really excited about Advent of Code throughout the week even when I haven't been solving them myself has been the community. I've talked about it briefly in the previous two blog posts but wanted to write more here.
I've gotten a few dozen people to join and start solving puzzles this year by sharing my experiences and helping others with their puzzles and programming problems. I've been actively discussing these in four different developer communities, my blog and social media and I've met and ended up talking with quite a lot of new people thanks to this.
It makes me so happy, because that's what I do. I'll never be the best developer or a substance expert when it comes to coding. But if I can help other people get excited about stuff, help them find each other and feel the sense of achievement when they solve the puzzles, that makes my day.
By sharing your code, you help someone learn. I've read a lot of other people's Rust Advent of Code solutions to see how they structure their solutions, what functions they use and how they manage all the things I struggle with when using the language. Your solutions don't have to be the best practice or optimal solution for it to be helpful to others. So I encourage you to share your puzzle solutions with people, for example in GitHub.
If you found this post interesting, consider sharing it with your community or following me on Twitter.