In Rust We Trust
I’ve been using Rust for around the last 18 months, for some work & personal projects, after bouncing off of it a few times before that. It’s been a lot of fun, and something about it really suits the way I’m thinking about building software at the minute.
fn main() { println!("Welcome to Rust.")}After around two decades working mostly with Ruby, I’d come to enjoy a lot about the expressive nature of writing code in a dynamic language. But having shipped a lot of production code that then needs maintaining, updating, features adding etc, the pitfalls of building entire applications with a dynamic language become apparent. With no concrete contracts defining interfaces, it can affect your ability to truly reason about the expected outcome of application logic. You know the sort of thing I mean, the “it should work so long as this is always a String…” etc. Of course tests can be used to help define & then enforce those expectations, but once the application & test suite reaches a certain size, the tests themselves can feel like a burden that need to be managed, rather than a solid safety net against regressions.
Enter Rust. Having shipped production code with it, I can say that the majority of the time, when it compiles without errors, it works. Sure, you might have a logic issue, or something that is a design related problem to resolve - but capturing inputs, processing and returning an output (for an API, or a CLI etc) has well-defined boundaries that are validated cleanly by the nature of the compiler. It’s no silver bullet of course, but a successful build is already a confidence marker even before unit or integration tests, QA, etc.
So I’m liking writing with Rust a lot - refactoring becomes easier, making changes that in Ruby might not be worth the risk of missing something or introducing a subtle regression (or refactoring the test suite alongside the change), now are worthwhile doing as the risk of those kinds of regressions are almost zero. It results in a more confident design process for the software architecture. And while I’m still learning the ropes in terms of the features and constructs available within Rust, as well as some of the best practice ways to do things, it doesn’t feel punitive to not know all of that already. I’m still working with Ruby too, but am very much enjoying trusting in Rust.