Logo
Logo
  • “Zero-cost abstractions” is Rust’s most-repeated promise and its most-misunderstood concept. People hear “zero cost” and think “free.” It doesn’t mean free. It means: you don’t pay for what you don’t use, and what you do use, you couldn’t hand-code any better.

    That’s a Bjarne Stroustrup quote, originally about C++. But Rust actually delivers on it in ways C++ often doesn’t.


    What Zero-Cost Actually Means

    Consider iterators. In Python, iterator chains create intermediate objects. In Java, streams can have overhead from boxing and virtual dispatch. In Rust:

    Rust tutorial rust idiomatic-rust Created Mon, 06 May 2024 14:52:00 +0000
  • I wrote my first lexer as a side project after reading the first chapter of “Writing an Interpreter in Go.” I expected it to be hard. It was not. A lexer is conceptually one of the simpler pieces of a compiler: read characters, group them into meaningful chunks, throw away whitespace. What surprised me was how much clarity it brought to everything downstream. Once I had tokens instead of characters, every subsequent step became easier to reason about. The text became structured. And the structure was entirely my design.

    fundamentals compilers Created Mon, 06 May 2024 00:00:00 +0000
  • I once spent an entire afternoon debugging a function with this signature: process(data, true, false, true). Three booleans. What did they mean? I had to read the function definition every single time I encountered a call site. Is true for “verbose”? For “dry-run”? For “force”?

    Booleans are the most overused type in programming. They encode exactly one bit of information — yes or no — and they tell you nothing about what question they’re answering. Enums fix this.

    Rust tutorial rust idiomatic-rust Created Sun, 05 May 2024 08:17:00 +0000
  • The first time I drew a system design diagram in an interview, I drew a box labeled “load balancer” and drew arrows from clients to it, and from it to servers. My interviewer asked, “What kind of load balancer?” I didn’t have an answer. I knew load balancers existed. I didn’t know they made fundamentally different decisions at different network layers — and that the choice between them shapes what your system can and cannot do.

    fundamentals system design Created Sun, 05 May 2024 00:00:00 +0000
  • A teammate once added a new payment method to our system — CryptoCurrency — and forgot to update the fee calculation logic. In production. For three weeks. Nobody noticed because the switch statement in Java had a default case that silently applied a 0% fee. Free crypto transfers for everyone.

    In Rust, the compiler would have caught this the moment the new variant was added. That’s exhaustive matching — and it’s one of Rust’s most underappreciated features.

    Rust tutorial rust idiomatic-rust Created Fri, 03 May 2024 22:08:00 +0000
  • I’ve seen two teams start new products with microservices. One spent four months before they had anything deployed — Kubernetes setup, service discovery, distributed tracing, a CI/CD pipeline for twelve repos, and debates about how to split domains they hadn’t fully understood yet. They ran out of runway. The other team I worked on started with a monolith, shipped their first real user feature in three weeks, and only extracted services when the actual pain of growth made the benefit obvious. We’re still running that system, and it handles tens of millions of requests a day.

    fundamentals architecture Created Fri, 03 May 2024 00:00:00 +0000
  • I review a lot of Rust code, and one of my biggest pet peeves is types without #[derive(Debug)]. You hit an error, you try to print the value, and you get that lovely message: “MyStruct doesn’t implement Debug.” Then you have to go add it, recompile, and try again.

    Just derive it from the start. Derive liberally. Your future self will thank you.


    The Derives You Should Almost Always Use

    Here’s my standard starting point for any struct or enum:

    Rust tutorial rust idiomatic-rust Created Thu, 02 May 2024 10:30:00 +0000
  • When I first came to Go from Python, the type system felt like a lot of ceremony. Why can’t I just use an int where a float64 is expected? Why do I need to define a whole new type just to give an integer more meaning? The answers to those questions turned out to be one of the things I now appreciate most about Go. Types aren’t bureaucracy — they’re a way of making your code explain itself.

    Go tutorial golang beginner Created Thu, 02 May 2024 00:00:00 +0000
  • Sorting is one of those topics that feels like a solved problem until you actually need to care about it. Every language ships a standard sort. You call it, it works, you move on. But I have run into subtle production bugs caused by not understanding what the sort is actually doing — unstable sorts breaking tie-breaking logic, sorts on large datasets consuming unexpected memory, and sort comparators with subtle bugs that triggered Go’s sort to panic.

    fundamentals algorithms Created Wed, 01 May 2024 00:00:00 +0000
  • Pop quiz: what’s the difference between {} and {:?} in a println!? If your answer is “one looks prettier,” you’re not wrong — but you’re missing the bigger picture.

    Display and Debug serve fundamentally different audiences. Display is for humans — end users, log readers, UI consumers. Debug is for developers — it’s what you see in error messages, test failures, and debug sessions. Conflating the two leads to types that are either too verbose for users or too opaque for debugging.

    Rust tutorial rust idiomatic-rust Created Tue, 30 Apr 2024 18:45:00 +0000