• Ephera@lemmy.ml
    link
    fedilink
    arrow-up
    14
    arrow-down
    1
    ·
    6 months ago

    Our most recent project at $DAYJOB has been in Rust. New programming language always presents an opportunity for learning, obviously, but what Rust does in particular, is that it asks you to be very explicit.

    Which isn’t to say, it demands it, as you can just slap the same semi-correct boilerplate onto most things. For example, for the longest time, I told it to make data types both serializable and deserializable, as soon as they needed to be either of those.

    But well, it gives you an opportunity to think about it. At some point, I realized that I was only using a data type for deserializing data from a REST API. I never serialized that type. And that was crucial information, I was missing when looking at that code snippet. So, rather than writing some comment which future-me won’t read either, I could just nix the serialization path.

    And since then, I’m being very intentional with whether I’m making types serializable, deserializable or both. It feels like I’ve graduated from just slapping on boilerplate to actually knowing what I’m doing.

    What I didn’t tell you is that I’ve actually been programming in Rust for 5 years. Certainly feels like it’s about time, I started knowing what I’m doing. At the same time, I can also tell you for free that there’s still loads of topics where I don’t yet actually know what I’m doing. And these lessons are rarely actually Rust-specific…