Programming · Latest articles

30 new today · 2,704 articles · from 79 blogs

Lea Verou··Lea Verou

On automatically generating contrasting text colors with CSS

AI summaryThe article explains how to use CSS Relative Color Syntax (RCS) in the OKLCH color space to automatically compute a contrasting text color (black or white) for arbitrary background colors, emulating the future contrast-color() function years before it ships. The technique relies on a lightness threshold formula built with widely supported CSS math functions like clamp() (and later sign()), with @supports-based fallbacks for browsers that lack RCS support. The author also critiques the WCAG 2.1 contrast algorithm, favoring APCA for actual readability, and argues RCS is mature enough for production use.

Hillel Wayne·

Comment Section: Software Friction

AI summaryThis piece collects reader responses to an article on software friction, centered on feedback from a US Marine Corps infantry officer who explains how the military trains personnel to recognize and manage friction early in their careers. He recommends adopting 'hot washes'—immediate post-operation reviews of what went well and poorly—which differ from typical postmortems in that points are recorded in a standard format and archived in lessons-learned libraries for future reference. He also notes that the Marine Corps' high turnover makes such persistent written knowledge storage essential for preserving institutional understanding.

Josh W. Comeau··Josh W. Comeau

Snappy UI Optimization with useDeferredValue

useDeferredValue is one of the most underrated React hooks. It allows us to dramatically improve the performance of our applications in certain contexts. I recently used it to solve a gnarly performance problem on this blog, and in this tut

Without Boats·

References are like jumps

AI summaryThe article revisits C.A.R. Hoare's 1974 critique of references and pointers in high-level languages, in which he argued they reintroduce machine-code problems—such as address/content confusion, unconstrained mutation through aliasing, lack of independent meaning, and performance overhead—calling them 'a step backward.' The author contends that while Hoare's famous 'billion dollar mistake' was the null pointer, the industry's broader disregard of his warnings about pointers in general was a 'trillion dollar mistake,' because mutable, aliased state destroys the ability to reason locally about a program's behavior. Preventing accidental mutation of aliased state, the author concludes, is essential to building correctly functioning software.

Deno Blog··Andy Jiang

How to document your JavaScript package

Writing good JSDocs for your JavaScript package is critical to its success. Here are some best practices for creating docs that helps your users be successful.

Bun Blog·

Bun v1.1.8

Fixes 54 bugs (addressing 184 👍). Support for `process.on("uncaughtException")` and `process.on("unhandledRejection")`, Brotli support in `node:zlib`, Faster JSON.parse, `[Symbol.dispose]` in Bun APIs, fixes lots of crashes on Windows, and

Marc Brooker·

It's always TCP_NODELAY. Every damn time.

AI summaryThe article explains that Nagle's algorithm, designed in the 1980s to amortize TCP header costs by holding back small packets, interacts badly with delayed ACKs and is a frequent culprit behind latency issues in distributed systems. The author argues that modern applications rarely send single-byte packets, so the bandwidth savings are no longer worth delaying data for a round trip. He concludes that latency-sensitive systems should enable TCP_NODELAY without hesitation, and suggests it should probably be the default.

Tailwind CSS Blog·

Headless UI v2.0 for React

We just released Headless UI v2.0 for React which includes a ton of new stuff including built-in anchor positioning, a new headless checkbox component, HTML form components and more!

brandur.org··Brandur Leach

The Notifier Pattern for Applications That Use Postgres

AI summaryThe article introduces the 'notifier pattern' for applications using Postgres LISTEN/NOTIFY, in which a single Postgres connection per process manages all topic subscriptions and distributes received notifications to the various components that want them, conserving Postgres's limited connections compared to the naive one-connection-per-topic approach. Key implementation details include buffered channels with non-blocking sends so slow components can't stall the system, reusing a single LISTEN per topic for multiple subscribers, an 'established' channel to confirm subscriptions for testing, interruptible notification waits so new subscriptions can be processed promptly, and crash-and-restart handling for unhealthy connections. The pattern remains compatible with PgBouncer since only this one dedicated connection needs session pooling while the rest of the application can use transaction or statement pooling.

brandur.org··Brandur Leach

Web APIs: Enriched DX By Disallowing Unknown Fields

AI summaryThe article explains how Go's DisallowUnknownFields JSON decoder option improves developer experience for web APIs by returning an error when a request contains fields that don't exist in the target struct, catching mistakes like sending "expires" instead of "expires_in". It also covers practical caveats, such as safely enabling the check on existing APIs through logging probes and grandfathering known bad fields, deprecating old fields carefully, and providing escape hatches for endpoints like webhook receivers. Finally, it notes the pattern is portable to other languages and can be enhanced with Levenshtein distance suggestions, e.g., telling users who send "expires" that they probably meant "expires_in".

Deno Blog··Andy Jiang

Your Low Code Solution Needs an Escape Hatch

AI summaryThe article argues that while low-code solutions offer users simple flexibility, they should also include an 'escape hatch' for code-level customization. This is particularly important for enterprise users who require deeper customization capabilities. The author presents three product scenarios that illustrate where such an escape hatch makes the most sense.

Bun Blog·

Bun v1.1.7

AI summaryBun v1.1.7 fixes 28 bugs and includes several Node.js compatibility improvements. The release adds support for glob workspace names in bun install, asymmetric matcher support in expect.extends() equals, and a bunx --version flag. It also delivers bugfixes for JSX transpilation, sourcemaps, cross-compilation of standalone executables, bun shell, RegExp, and Worker on Windows.

Baby Steps·

Unwind considered harmful?

AI summaryThe author argues that Rust should deprecate panic=unwind, observing that most production users either compile with panic=abort or use unwinding only in a limited way for cleanup rather than true recovery. Removing unwinding in most cases would enable interesting extensions to the type system and eliminate a common source of subtle bugs. However, the author does not propose removing unwinding entirely, since that would conflict with stability guarantees and Rust's mission to deeply integrate with other languages and systems.

Svelte Blog·

What’s new in Svelte: May 2024

AI summaryThe May 2024 Svelte update covers Svelte Summit Spring 2024, where Rich Harris announced that Svelte 5 has officially entered the Release Candidate stage. Pre-release highlights include hot module reloading support, global style definitions, a new $host rune, a reactive URL object, and more efficient compiled code. The post also features community showcase projects, learning resources, and new libraries and tools built with Svelte.

Hillel Wayne·

Software Friction

AI summaryThe article applies Clausewitz's military concept of 'friction'—the gap between plans and reality—to software development, where countless small disruptions like bugs, changing requirements, broken tooling, and absent teammates compound over time and scope. The author argues friction is inevitable and cannot be fully anticipated, but it can be reduced through smaller scopes and shorter iterations, autonomy, redundancy, better planning, automation, experience, gaming, and checklists, each with its own trade-offs. He concludes by posing open questions about categorizing friction, how other fields handle it, and how to balance friction mitigation against efficiency.

Svelte Blog·

Svelte 5 Release Candidate

AI summarySvelte 5 has entered the Release Candidate phase, meaning its design is largely settled with no anticipated breaking changes before the stable release, though it is not yet production-ready. Key features include runes (a signal-powered reactivity API), overhauled event handling, snippets for better component composition, and native TypeScript support. Existing Svelte 4 components will continue to work with only a few exceptions, users are encouraged to migrate incrementally (with a migration CLI tool planned), and the stable release will arrive once the work and documentation are complete.