Enjoy Newsletter #81.

Java Interview Question - Why you should not use static initializers?

This post explains why you should avoid static initializer blocks (static { ... }) in Java, even though they look convenient for setting up complex static state. The biggest hazard is that a static block runs when the JVM initializes the class (the first time an instance is created, a static method is called, or a non-constant static field is accessed): if it throws an uncaught exception, the JVM wraps it in an ExceptionInInitializerError and marks the class as permanently unusable, causing subsequent accesses and dependent classes to fail in a cascade that is notoriously painful to debug. Static blocks also execute implicitly at times developers rarely control, hiding side effects. Worse, when multiple classes have interdependent static blocks, initialization order depends on whichever class happens to be touched first at runtime rather than clear application logic, breeding subtle order-dependent bugs.

Instead, the author recommends lazy initialization or constructor-based dependency injection so initialization happens explicitly when needed. That allows exceptions to be handled gracefully, prevents the application from crashing at startup over an unused class, makes unit testing much easier, and keeps code clear and maintainable.

How to Write High-Performance Code

This ByteByteGo article distills foundational principles for writing high-performance code without requiring deep systems expertise, starting with building intuition for where performance actually matters—typically just ~3% of a codebase. The first skill is back-of-the-envelope cost estimation before writing code: CPU cache accesses take nanoseconds, RAM is roughly 100x slower, SSD reads are 40,000x slower, and network calls are slower still. For example, processing one million records with a separate 50 ms database round-trip per record would take nearly 14 hours, whereas batching 1,000 records per query brings total time down to about 50 seconds. The golden rule is to measure first and optimize second, since human intuition about bottlenecks is frequently wrong; always profile against realistic workloads.

Algorithmic improvements yield the largest speedups—often 10x to 100x: finding common elements between two 1,000-item lists with nested loops takes a million comparisons (O(N²)), while loading one list into a hash set takes just ~1,000 lookups (O(N)). Memory layout matters just as much: data accessed together should sit contiguously in memory, which is why arrays usually outperform linked lists by making full use of CPU cache lines. Finally, the post recommends minimizing memory allocations, pre-allocating container capacity, pooling and reusing objects, adding fast paths for common cases, and eliminating unnecessary work altogether.

Introducing Moltworker: a self-hosted personal AI agent, minus the minis

Cloudflare introduces Moltworker, a way to run Moltbot (the open-source personal AI assistant, renamed OpenClaw in January 2026) entirely on Cloudflare’s platform instead of buying a dedicated Mac mini. The architecture consists of an entrypoint Worker acting as an API router and proxy alongside adapted scripts, all protected behind Cloudflare Access. Under the hood, the Sandbox SDK provides isolated containers to run Moltbot’s native runtime with a clean API for command execution and lifecycle management; Browser Rendering provides a headless Chromium instance accessed via a thin Chrome DevTools Protocol proxy so the agent can browse the web, fill out forms, and take screenshots; and R2 stores session state and conversation history, mounted as a filesystem volume so data persists across ephemeral container restarts.

AI Gateway sits between the agent and model providers, supporting Bring Your Own Key (BYOK) or Unified Billing while centralizing cost tracking and logs. Zero Trust Access protects the API and admin UI with custom authentication policies, automatically issuing JWTs validated on every request. Because Cloudflare Workers now offer deep Node.js compatibility (Cloudflare tested the top 1,000 npm packages and found only 15 incompatible after excluding build tools, CLIs, and browser-only packages), most logic can run directly on Workers. The source code is open-sourced on GitHub, and Cloudflare notes that Moltworker is a proof-of-concept demonstrating that their developer platform can host complex, stateful AI agents without dedicated hardware.

Building a High-Performance Rotating Bloom Filter in Java

Uday Sagar walks through building a rotating Bloom filter in his open-source Java library to answer “have I seen this element recently?” over an unbounded data stream while keeping memory usage strictly bounded. Instead of a single fixed-capacity filter whose false-positive rate climbs toward 100% as it fills up, a rotating Bloom filter partitions stream data into time windows and automatically expires old windows (based on first-insertion time rather than LRU), making it ideal for stream deduplication. For lock-free concurrent writes, threads set bits using Compare-And-Swap (CAS) loops on an AtomicLongArray and retry on contention; because bits are spread across millions of positions, collisions are rare, yielding 3–4x higher throughput than lock-based synchronization. When a time window expires, the active filter is copied into an immutable long[] array for faster reads, forming a chain [ReadOnly-1, ReadOnly-2, ReadOnly-3, Active]: writes go exclusively to Active, while reads check from newest to oldest.

To prevent lost writes when a thread is mid-write as a window rotates, the write path acquires the read lock of a ReentrantReadWriteLock while the rare rotation step acquires the write lock, leaving queries completely lock-free. Across N independent windows, the cumulative false-positive rate compounds as 1 - (1 - p)^N, so five windows configured at 1% each produce nearly a 5% overall false-positive rate; configuring per-window rates lower balances retention duration against accuracy. Combined with double hashing and xxHash, the library achieves millions of operations per second.

What Every Java Developer Should Know About Thread Pools

This article covers the essentials of thread pools in Java. The author compares spawning a brand-new OS thread for every incoming task to hiring, training, and firing a delivery driver for every single pizza order: it wastes memory and CPU and can crash your server under a traffic spike. A thread pool managed via ExecutorService maintains a steady pool of worker threads for reuse, bounding the maximum thread count, cutting latency because threads are already warm, and providing a clean API for delayed or periodic scheduling. The post reviews four main flavors: FixedThreadPool for predictable workloads, CachedThreadPool which spawns threads on demand and reuses them for short-lived tasks, ScheduledThreadPool for delayed or recurring jobs, and Java 21’s Virtual Threads (newVirtualThreadPerTaskExecutor()), which run millions of concurrent blocking tasks with minimal overhead.

On best practices, always shut pools down cleanly (using try-with-resources in Java 19+), as forgetting to shut down an ExecutorService is a classic source of memory and thread leaks. For CPU-bound workloads, size the pool to the number of CPU cores; for I/O-bound workloads like database or API calls, use virtual threads. Always give threads meaningful names via a custom ThreadFactory to make stack traces and thread dumps readable, and avoid newCachedThreadPool() behind public APIs where a sudden traffic burst can spawn unbounded OS threads.

Goodbye Java, Hello Go!

WSO2, the 20-year-old enterprise middleware company whose server-side codebase was roughly 95% Java, announced it is moving to Go for its next generation of products. The primary driver is how cloud infrastructure has changed: in the container era, servers no longer run continuously for months—they spin up, handle traffic, and scale down, while middleware is increasingly embedded as a library inside a single process. Java’s post-startup JIT warmup model is a poor fit for ephemeral containers, startup times are measured in seconds rather than milliseconds, and its heavy ecosystem bloats memory and CPU footprints, driving up cloud bills. In WSO2’s view, GraalVM native images and Project Loom are band-aids on a language and runtime designed for a different era.

WSO2 also evaluated Rust but concluded they didn’t need it: Rust shines for OS kernels, browsers, and low-level systems software, whereas WSO2 builds API gateways and identity platforms much higher up the stack. Go hits the sweet spot with efficient memory management, pragmatic concurrency primitives, and straightforward cross-compilation to native binaries, backed by a proven track record in cloud-native infrastructure (Kubernetes, Docker), rich libraries, and a large talent pool. The company has already used Go for nearly a decade across projects like OpenChoreo, the Ballerina compiler rewrite, and its Thunder identity platform. Existing Java products will continue to be supported indefinitely.

TBM 399: 10 Prioritization Traps

John Cutler shares 10 product prioritization traps, each named after a classic song; the goal isn’t making perfect decisions, but making “good enough” decisions while avoiding catastrophic ones. “Burning Down the House” is constantly chasing urgent, low-value fires; combat it by ring-fencing 10–20% of capacity for preventative work. “Too Much Time on My Hands” is over-polishing medium-value work instead of finding the 80/20 cut; force yourself to define the smallest version shippable in 2–4 weeks. “Everybody Wants to Rule the World” is when everything is labeled “top priority” and nothing gets dropped; explicitly name one effort that is allowed to slip. “Just Enough Is Never Enough” is shipping fast MVPs that only capture 20% of the value before moving on; pre-approve a follow-on investment tranche up front. “Running on Empty” is letting long projects drift without kill signals; set explicit re-commitment checkpoints.

“Dreamer” is open-ended innovation work with no forcing function; add a hard constraint like a live customer demo or integration deadline. “Slow Ride” is ignoring internal developer friction; measure wasted time as cost of delay. “Someday Never Comes” is deferring high-upside bets forever due to low confidence; run cheap, failure-tolerant experiments to buy information. “The Logical Song” is ignoring the cost of increasing confidence; always ask, “What is the cheapest way to raise our confidence?” Finally, “Takin’ Care of Business” is when blocked teams invent busywork to stay utilized; maintain a small, well-vetted queue of high-value fallback tasks instead.

Assessing internal quality while coding with an agent

Writing on Martin Fowler’s site, Erik Doernenburg recounts using AI coding agents to add GitLab support to CCMenu, a macOS Swift menu-bar app that displays CI/CD build status. He tested Windsurf with Claude Sonnet 3.5 and later Claude Code with Sonnet 4.5, focusing on an under-discussed dimension: the internal code quality of AI-generated code. The most telling issue occurred when the agent declared the API token parameter on wrapper functions as a non-optional String, even though the underlying makeRequest helper accepted an optional String?; when a caller needed to pass an optional token, the agent patched the call site with apiToken ?? "" instead of fixing the wrapper’s signature—unidiomatic Swift that erased the type system’s distinction between “no token” and an empty string. Beyond that, the agent proposed unnecessary caching, failed to notice fundamental API differences between GitHub and GitLab and wrote convoluted logic for a non-existent problem, duplicated URL-building logic instead of reusing an existing helper, and spun its wheels trying to fetch avatar URLs that lived on a separate endpoint.

Doernenburg concludes that AI agents naturally gravitate toward accumulating technical debt, making future changes harder for both humans and agents alike. With Windsurf and Sonnet 3.5, the constant supervision required made it not worth the trouble; Claude Code with Sonnet 4.5 was a marked improvement, needing far less hand-holding and proving good enough for regular use. Even so, actively guarding internal code quality remains essential for sustainable software development.

A “Pure Go” Linux environment, ported by Claude, inspired by Fabrice Bellard

JT Olio recounts using Claude to port Fabrice Bellard’s TinyEMU RISC-V emulator from C to pure Go. The result is a pure-Go Linux environment complete with VirtIO devices, filesystem mounting, and networking: a simple go run boots a Linux environment with root access inside the emulator, requiring no host privileges or containers and running anywhere Go compiles. The first 80% was exhilarating as Claude rapidly translated the foundational subsystems, but the final 20% was grueling: Linux booted the kernel yet failed to mount the initrd, the project stalled for weeks, and the author lacked mental context because he hadn’t written the code himself. Claude repeatedly drifted from instructions, inventing “better” error handling or ignoring directives to preserve exact C behavior, forcing the author to switch to batch-by-batch function audits cross-referenced against the original C source. He also found the popular agent task tracker Beads overly bloated (294k lines of Go, 128 MB repo) and recommends the lightweight ticket CLI instead.

His hard-won lessons for agentic coding: break work into the smallest, most concrete tickets possible; enforce strict commit and test-coverage gates; clear the agent’s context window frequently; require the agent to file tickets for any follow-up work or behavioral deviations it encounters; and never expect a cohesive architecture or clean internal API to emerge organically across sessions. The project left him simultaneously impressed and more cautious about LLM coding: writing code by hand is less frustrating and yields higher quality, but at lower throughput; succeeding with Claude means treating it like an eager junior developer who needs tight supervision.

Bonus

Images:

How to Scale An API HTTP/2 over TCP vs HTTP/3 over QUIC How Git Really Stores Your Data How NAT Works


This post was rewritten by Claude Code with Opus 5.5 on 27/09/2026; reviewed and edited by Codex with GPT 6.1 Sol on 09/11/2026, and re-verified by Claude Code with Sonnet 5.5 on 16/11/2026.