Knowledge Updates

Observations while developing web applications and creating great software.

  • New encoding format in Turbo Stream v3 ↗

    Turbo Stream by Jacob Ebey is a streaming data transport for built-in JavaScript features such as Promises, Dates, RegExps, Maps, Sets and more.

    import { decode, encode } from "turbo-stream";
    
    const encodedStream = encode(Promise.resolve(42));
    const decoded = await decode(encodedStream);
    console.log(decoded); // 42

    Turbo Stream powers single-fetch data loaders in React Router which enables streaming Promises from server loaders.

    import type { Route } from "./+types/my-route";
    
    export async function loader({}: Route.LoaderArgs) {
      // note this is NOT awaited
      let nonCriticalData = new Promise((res) =>
        setTimeout(() => res("non-critical"), 5000)
      );
    
      let criticalData = await new Promise((res) =>
        setTimeout(() => res("critical"), 300)
      );
    
      return { nonCriticalData, criticalData };
    }
    

    Turbo Stream v3 is out with support for a new encoding format which supports ReadableStream and many other JS features.

    This means it’ll be coming to React Router very soon. While it’s possible to encode streams into promises, it’ll be good to see React Router support streams natively.

  • Developer philosophy ↗

    qntm:

    A few weeks ago at work we had a talk where senior developers (including me) were invited to spend around five minutes each talking about our personal software development philosophies. The idea was for us to share our years of experience with our more junior developers.

    After the session, I felt that it might be valuable to write my own thoughts up, and add a little more detail. So here we are.

    Avoid ground-up rewrites:

    By the time the ground-up rewrite starts to seem like a good idea, avoidable mistakes have already been made. This is a scenario which you can see coming from a long way out and you can, and must, actively steer away from.

    Warning signs to watch for: compounding technical debt. Increasing difficulty in making seemingly simple changes to code. Difficulty in documenting/commenting code. Difficulty in onboarding new developers. Dwindling numbers of people who know how particular areas of the codebase actually work. Bugs nobody understands.

    Compounding complexity must be fought at every turn. Alternate between phases of expansion (new features) and consolidation.

    Simplicity:

    If you budgeted your time properly (see above), you have time to go back and see if you can do better. C.f. the old chess adage, “When you see a good move, look for a better one.” And another difficult-to-source quote, “I apologise for writing such a long letter, but I didn’t have time to write a short one.”

    And perhaps my favorite topic: automating good practice — which I’ll invite you to read on the original post.

    Kent Beck says, “Make the change easy, then make the easy change.” I think about that a lot.

    Go read qntm’s wisdom and then go read his science fiction.

  • Kneeboard ↗

    Community generated repository of interactive checklists that work on your computer, tablet, or phone by Armadeus Demarzi.

    It’s beautiful.

    Via X
  • Polar Software, Inc. and terminal aesthetics ↗

    The aesthetics of their vision are fantastic.

    If you like this, you might also like SRCL which is unrelated but similar in vibes:

    SRCL is an open-source React component and style repository that helps you build web applications, desktop applications, and static websites with terminal aesthetics.

  • Boom XB-1 First Supersonic Flight ↗

    XB-1, the first civilian privately funded supersonic aircraft, flew its first supersonic flight yesterday. XB-1 was made in America by Boom which was founded by ex-Groupon executive Blake Scholl.

    Coupons to supersonic aircraft. The roaring 20s are back.

    This accomplishment was skipped by most news media. The WSJ said supersonic isn’t newsworthy until Overture is carrying passengers. NYT didn’t cover it. But the Financial Times covered it well.

    The lessons learned from XB-1 will be used to build Overture to restore commercial supersonic flight: ~15 minutes slower than Concorde over the Atlantic but 75% more affordable.

    What an incredible story over a decade in the making. Congratulations to Blake and the team.


    Unfortunately, today has become a sad day for aviation with reports of a tragic mid-air collision at Ronald Regan International Airport this evening. My prayers are with the families involved.

    I only get to write posts here early or late during the work week. So I still wanted to share this timely news even in this difficult time. I believe Boom’s achievement will inspire future engineers. I share the optimism and love the XB-1 story. At the same time I also hope aviation safety will continue to improve with careful investigation into what went wrong tonight.