SwitchUpCB published "Why I Rewrote It In Rust" on Medium.
Why I Rewrote It In Rust
The reason that I rewrote all the software I work on in Rust.
The manager scheduled an unexpected meeting for the entire team: It would be 20 minutes long on a Friday, right before a huge company announcement was scheduled. It’s safe to say that no one was amused at this notification due to ongoing economic events.
People speak of The Arctic and how it’s so cold, but I will be the first to tell you that nothing is colder than the room we sat in before that meeting started: The entire team was shaking in their boots so violently that I expected penguins to walk in. That was until I looked at the AC… It was set to 76.
When the manager entered the room, he seemed upset. This expression didn’t ease the tension of the situation at all. In fact, I’m pretty sure I heard someone fart from clenching their buttcheeks so hard. Regardless, we waited a few more minutes for the projector to load…
“I have bad news.” The manager looked around the room to keep the situation under control. Click! The next slide loaded. The manager continued. “The amount of tickets in the backlog is too much to handle.” Click! “We need to rewrite the application, and you guys are the best team for the deal.” The presentation was over.
Phew! The entire room let out a sigh of relief. We weren’t laid off. However, that didn’t mean we were free to frolic around in joy. Now, we had a real engineering problem to solve: How would we rewrite this decade-old codebase written in C, while maintaining development velocity on the current project?
The team huddled together around a scratchpad to sketch out a game plan. We decided that a few members would focus on the development velocity of the current project while the others architected the rewrite. So which sub-team was I assigned to?
I can’t show you the proprietary work I do, but it’s not much different from my open-source work: I create many projects — like Copygen and Disgo — that span thousands of lines of code, but never face more than 5 actionable issues (from edge cases) at once. So that’s why I was tasked with designing the project architecture for the new codebase.
The Discussion
What programming language would we use? My coworker and I discussed the tradeoffs of each language for our use case: The software was a web application, so there were a few viable options on the table. However, the workday ended before we could finish our analysis.
My physical body had left work, but my mind had not. That’s how I ended up discussing the decision with a friend, also a Software Engineer, at a high-end restaurant in the middle of New York City. I think it was called McDonald’s or something like that.
Nothing of significance happened up until we were about to leave. I went to snag a refill at the carbonated beverage station. As I refilled my cup, a soft voice started speaking from behind: “Hey, are you thinking about rewriting software in Rust?” It was a woman, and she was very cute.
I responded to her with the first thought that came to mind: “Uh yeah! Gotta save the climate, right?” She chuckled. “That’s so hot. And soooo moral! I love men who care about the climate, but you know what I love even more?” I stared at her with an expression so blank that not even an autist could challenge it. Then, she answered, “Men who use Rust.”
I invited her back to my place. She wasted no time finding my sheets, and I’m not talking about Google’s. Not to mention how adamant she was in the car ride home about using libre software: Her spirit was as free as her ideologies. So she was in for a treat.
I showed her the self-hosted software I had set up on my HPE ProLiant DL385 Gen10 Plus server. That’s $10,000 for the unaware… This display made her noticeably excited: She played around with it for a few minutes before the room started to get heated.
She turned towards me and gave me the look. You know the one… I went in for a kiss, and we started going through the motions. But before we did anything of significance, she stopped and said she had a secret to show me. Then, out of nowhere, a furry tail flashed out from her backside, and she started growling in a very sexy manner.
Zero cost runtime abstractions. That’s all I could think about as I became erect at blazingly fast speeds. This was happening… All because we were going to rewrite the web application at work in Rust. Well, now we were.
Her movements were unreadable. It’s as if she invoked the nastiest of macros. It didn’t matter what position we were in. Just pure perfection without any arbitrary pausing to ruin the rush of chemicals we engaged in.
I learned what a Rustjob was that day. No documentation in the world will describe what it feels like, but understand that it is something you will never forget. I had to lock my mental mutex before my body became unsynchronized between reality and the astral plane: If I had to put the experience into words, it would be “memory-safe”.
I nutted in O(1), but it felt like O(n3).
Also, I’m a furry now.
The Decision
Monday morning was full of sunshine. I walked into work, excited to present to my coworkers what I learned about programming languages over the weekend. Don’t forget that we still had a decision to make: Now it was time to make it.
If I’m being honest with you, there was no real reason for us to use Rust over Go or Elixir. You could even argue that those languages were better suited for our use case: I mean, who wants to use asynchronous programming constructs for concurrent applications in 2023? However, I knew what I had to do, and I did it for Rustgirl.
“Let’s get straight to the point: Zero cost runtime abstractions! Blazingly fast! No GC pauses! A borrow checker for memory safety! Generics and macros! Energy efficiency saves the planet! Extremely moral! Don’t be unholy. Use Rust!”
The team clapped with religious fervor: The technical decision to use Rust was not only rational but also revolutionary. I communicated that in the minute or so I spent talking. The manager, impressed with my research, said it might even earn me an early promotion.
Ask any programmer what the features Rust provides mean to them: You won’t hear anything negative. However, that doesn’t mean the programming language is popular yet. When someone asks why I rewrote the codebase in Rust, I tell them what I told my coworkers. But between you and me, there’s only one reason why I rewrote it in Rust.
Enjoy these stories? Read more by following me and subscribing to my email newsletter to never miss out!
