Logo
Logo
17 results for
  • This is the Go idiom that surprises people coming from Java or C# the most. In those languages, you define an interface in the same place as (or even before) the implementation, and consumers import the interface. Go’s approach is the exact opposite, and it takes a while to internalize why. Once it clicks, it changes how you think about dependencies fundamentally.

    The rule is: define an interface in the package that needs it, not in the package that satisfies it. It sounds backwards. It is not. It is one of the most powerful design decisions the language enables.

    Go tutorial golang architecture Created Sat, 28 Sep 2024 00:00:00 +0000
  • The first network program I ever wrote — a chat server in college — had a bug where it would block forever waiting for one client’s message while all the other clients hung. Classic single-threaded socket mistake. Rust’s std::net module gives you the same low-level socket primitives, but the ownership system actually helps you avoid some of those pitfalls.

    TCP — The Reliable One

    TCP gives you ordered, reliable byte streams. You connect, you send bytes, they arrive in order (or the connection dies trying). That’s the deal.

    Rust tutorial rust stdlib Created Fri, 27 Sep 2024 09:40:00 +0000
  • Go strings are immutable. Byte slices are mutable. Converting between them requires copying the data — every time, without exception, unless you use unsafe tricks you almost certainly shouldn’t. That sounds like a minor footnote, but it becomes a significant issue the moment you start handling large volumes of text: parsing HTTP requests, processing log lines, building JSON responses. I’ve watched a single string(b) call inside a tight loop add measurable latency to a production API, and the fix was two lines of code once I knew what to look for.

    Go tutorial golang performance Created Wed, 25 Sep 2024 00:00:00 +0000
  • I once shipped a monitoring dashboard where all the latency values showed up as “Duration { secs: 0, nanos: 234000000 }” because I’d used {:?} instead of implementing Display. That’s the kind of thing that makes you sit down and actually learn how formatting works.

    Display vs. Debug

    These two traits are the foundation of everything in std::fmt. Every time you use println!, format!, or write!, you’re invoking one of them.

    Rust tutorial rust stdlib Created Tue, 24 Sep 2024 11:05:00 +0000
  • I shipped a CLI tool with 100% unit test coverage on the core logic. Users immediately found three bugs. The argument parser accepted --port but the value wasn’t being passed to the server. The --json flag produced output that wasn’t valid JSON because of a stray debug print. And --help showed the wrong default for --timeout. None of these bugs lived in the “core logic.” They lived in the glue between clap, the output formatter, and the actual binary. Unit tests didn’t catch them because unit tests don’t run the actual binary.

    Rust tutorial rust cli Created Sun, 22 Sep 2024 12:10:00 +0000
  • I’ve seen two types of health check implementations in production: the ones that always return 200 OK, and the ones that actually check something. The first kind is theater — Kubernetes thinks the pod is healthy and routes traffic to it, but the pod is actually deadlocked or its database connection pool is exhausted. The second kind is what saves you at 3am.

    Health checks are Kubernetes’s mechanism for deciding when a pod is ready to receive traffic and when it needs to be restarted. Get them right and Kubernetes becomes a genuinely reliable self-healing system. Get them wrong and you have an elaborate system that sends traffic to broken pods and restarts healthy ones.

    Go tutorial golang deployment devops Created Sun, 22 Sep 2024 00:00:00 +0000
  • A colleague once deployed a script that used string concatenation for file paths: dir + "/" + filename. Worked perfectly on Linux, blew up on Windows, and silently corrupted paths when dir ended with a slash. Rust’s Path type exists specifically to prevent this class of bug.

    Path vs. PathBuf — The &str/String Split

    Just like Rust has &str (borrowed) and String (owned), it has &Path (borrowed) and PathBuf (owned). The duality is identical:

    Rust tutorial rust stdlib Created Sat, 21 Sep 2024 16:10:00 +0000
  • Notifications are the feature that can make or break user retention — and also destroy it. Done right, they bring users back at exactly the right moment. Done wrong, they’re spam that drives uninstalls. The system design challenge isn’t just the technical plumbing (though that’s interesting). It’s building infrastructure that’s fast for critical alerts, reliable for important messages, and smart enough to not overwhelm users with low-priority noise.

    The Core Concept

    A notification system has to handle multiple channels with wildly different characteristics:

    fundamentals system design Created Sat, 21 Sep 2024 00:00:00 +0000
  • I once integrated with an API that returned HTTP 200 for everything — successes and failures alike. The actual outcome was buried in a status field inside the JSON body. To know whether a request worked, you had to parse the response, check status, then switch on a string value that was inconsistently named across endpoints. Integrating with that API felt like defusing a bomb in the dark.

    How you design error responses is not a detail. It is part of your public interface.

    Go tutorial golang backend Created Fri, 20 Sep 2024 00:00:00 +0000
  • Early in my Rust journey, I wrote a log parser that read a 2GB file byte by byte using read() without buffering. It took forty minutes. Adding a BufReader wrapper — one line of code — brought it down to three seconds. That’s when I learned that understanding std::io isn’t optional.

    The Four Core Traits

    Rust’s I/O system is built on four traits. Everything — files, network sockets, stdin, pipes, in-memory buffers — implements some combination of these:

    Rust tutorial rust stdlib Created Thu, 19 Sep 2024 08:30:00 +0000