<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Thiết Kế Hệ Thống on miti99</title><link>https://miti99.com/en/tags/thi%E1%BA%BFt-k%E1%BA%BF-h%E1%BB%87-th%E1%BB%91ng/</link><description>Recent content in Thiết Kế Hệ Thống on miti99</description><generator>Hugo</generator><language>en</language><lastBuildDate>Mon, 16 Nov 2026 17:39:19 +0700</lastBuildDate><atom:link href="https://miti99.com/en/tags/thi%E1%BA%BFt-k%E1%BA%BF-h%E1%BB%87-th%E1%BB%91ng/index.xml" rel="self" type="application/rss+xml"/><item><title>Newsletter #42</title><link>https://miti99.com/en/post/2025/08/01/</link><pubDate>Fri, 01 Aug 2025 00:00:00 +0700</pubDate><guid>https://miti99.com/en/post/2025/08/01/</guid><description>&lt;p&gt;&lt;em&gt;Enjoy Newsletter #42.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id="challenging-algorithms-and-data-structures-every-programmer-should-try"&gt;&lt;a href="https://austinhenley.com/blog/challengingalgorithms.html" rel="noopener noreferrer"&gt;Challenging algorithms and data structures every programmer should try&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Austin Z. Henley highlights six algorithms and data structures that are genuinely fun to build, have shown up in interviews, and reshaped how he thinks about software. Topological sort comes up whenever you need to order items with dependencies, such as task execution in a build system or cell evaluation in a spreadsheet. Recursive descent parsing maps each grammar rule directly to a function, letting you put together a working compiler for a small language in a few hours. The Myers diff algorithm is the default algorithm Git uses to compute clean differences between two versions of a file.&lt;/p&gt;
&lt;p&gt;Bloom filters are a gateway into probabilistic data structures: using very little memory, a Bloom filter can tell you with certainty that an element is &lt;em&gt;not&lt;/em&gt; in a set, or that it &lt;em&gt;might&lt;/em&gt; be present—though Henley admits he has never needed one outside an interview. Piece tables represent editable text as a sequence of spans pointing into an immutable original buffer and an append-only add buffer, avoiding repeated full-string copies on every keystroke and making undo and incremental saves straightforward; VS Code uses a battle-tested variant of this design. Finally, Splay trees are self-adjusting binary search trees that move recently accessed nodes to the root without storing extra balance metadata, acting like a tree with a built-in cache that is far simpler to implement than a red-black tree. The post closes with honorable mentions like tries, segment trees, and union-find.&lt;/p&gt;
&lt;h2 id="everything-i-know-about-good-system-design"&gt;&lt;a href="https://www.seangoedecke.com/good-system-design/" rel="noopener noreferrer"&gt;Everything I know about good system design&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Sean Goedecke defines system design as how you assemble services like application servers, databases, caches, queues, and event buses—and argues that good system design usually looks boring: it runs quietly for years without anyone having to think about it. The hardest part of any system is state, because stateful components can get into corrupted states, so minimize the number of stateful pieces and make sure only a single service writes to any given database table. On the database side, align indexes with your hot queries, do &lt;code&gt;JOIN&lt;/code&gt;s in the database rather than stitching rows together in application memory, and offload read-heavy traffic to read replicas.&lt;/p&gt;
&lt;p&gt;Slow operations should be split into the minimum synchronous work needed to respond to the user immediately, with the rest handed off to background workers via a queue. Caches are another source of state, so reach for them only after you have tried speeding up the underlying query; event hubs like Kafka are useful when multiple consumers genuinely need the same stream, but shouldn&amp;rsquo;t replace simple direct API calls that are much easier to trace. Goedecke also advises designing around your highest-load hot paths, logging richly on error branches, tracking p95 and p99 latencies, pairing retries with circuit breakers and idempotency keys, and deciding upfront whether a component should fail open or fail closed: rate limiters should usually fail open, while authentication must always fail closed. His takeaway: good design isn&amp;rsquo;t about clever tricks—it&amp;rsquo;s about putting boring, proven components in the right places.&lt;/p&gt;
&lt;h2 id="ai-coding-agents-are-already-commoditized"&gt;&lt;a href="https://www.seangoedecke.com/ai-agents-are-commoditized/" rel="noopener noreferrer"&gt;AI Coding Agents are Already Commoditized&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Sean Goedecke argues there is no &amp;ldquo;secret sauce&amp;rdquo; in AI coding agents. Back in 2023, he built an internal agent on GPT-3.5 and GPT-4 that required elaborate scaffolding just to keep the model on track; at the time, many assumed winning agents would need complex multi-agent swarms cross-checking each other or deep AST-level code indexing. In reality, all it took was a slightly smarter base model. Claude Sonnet 3.7 pulled ahead thanks to its ability to stay on task and make sound decisions over long horizons, while the surrounding agent harness is little more than a loop giving the model tools to read and write files.&lt;/p&gt;
&lt;p&gt;That simplicity makes the agent market brutally hard to defend: open-source tools like OpenAI&amp;rsquo;s Codex CLI raise the baseline for everyone, while inference is interchangeable and switching model providers is trivial. Goedecke even wired up a working coding agent on GitHub Actions backed by GitHub Models—both free—in about 50 lines of YAML. In his view, the only durable ways to win are owning distribution, like GitHub&amp;rsquo;s built-in platform advantage, or training a frontier model and locking its best capabilities inside your own first-party agent.&lt;/p&gt;
&lt;h2 id="java-what"&gt;&lt;a href="https://foojay.io/today/java-whats-old-part-i-collections/" rel="noopener noreferrer"&gt;Java, What&amp;rsquo;s Old? Part I: Collections&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Anthony Goubard highlights hidden gems inside the JDK Collections framework—all available since Java 8 or earlier, so you can use them anywhere. Instead of boxing primitives with &lt;code&gt;Optional&amp;lt;Integer&amp;gt;&lt;/code&gt;, Java provides &lt;code&gt;OptionalInt&lt;/code&gt;, &lt;code&gt;OptionalLong&lt;/code&gt;, and &lt;code&gt;OptionalDouble&lt;/code&gt;. &lt;code&gt;IntSummaryStatistics&lt;/code&gt; and &lt;code&gt;DoubleSummaryStatistics&lt;/code&gt; track min, max, sum, count, and average in a single pass and can merge statistics across streams; Goubard discovered them during the One Billion Row Challenge. &lt;code&gt;LinkedHashMap&lt;/code&gt; has a constructor flag that orders entries by access order rather than insertion order; combine that with overriding &lt;code&gt;removeEldestEntry&lt;/code&gt; and you get a compact LRU cache that can be wrapped in &lt;code&gt;Collections.synchronizedMap&lt;/code&gt; for multi-threaded access (though iteration and compound operations still require explicit synchronization).&lt;/p&gt;
&lt;p&gt;&lt;code&gt;WeakHashMap&lt;/code&gt; holds weak references to its keys so the garbage collector can evict entries once no strong references to a key remain; values are still strongly referenced, and because entries can vanish at any moment it isn&amp;rsquo;t suited for iteration or check-then-act patterns. Goubard uses it in his file manager Ant Commander Pro to cache formatted timestamp strings, cutting CPU usage while scrolling large tables. Finally, &lt;code&gt;BitSet&lt;/code&gt; packs boolean flags at roughly one bit per value, grows dynamically, and exposes fast bitwise operations—using a fraction of the memory of &lt;code&gt;boolean[]&lt;/code&gt; or &lt;code&gt;List&amp;lt;Boolean&amp;gt;&lt;/code&gt;.&lt;/p&gt;
&lt;h2 id="challenging-projects-every-programmer-should-try"&gt;&lt;a href="https://austinhenley.com/blog/challengingprojects.html" rel="noopener noreferrer"&gt;Challenging projects every programmer should try&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Austin Z. Henley shares six challenging projects that taught him the most and that he revisits whenever he wants to learn a new language or framework. Building a text editor forces you to pick a text buffer data structure like a rope, gap buffer, or piece table, figure out how the cursor &amp;ldquo;remembers&amp;rdquo; its column across lines of different lengths, and implement undo/redo with the Command pattern alongside line wrapping. A 2D game like &lt;em&gt;Space Invaders&lt;/em&gt; teaches rendering, the game loop, input handling, and managing entities with the Factory pattern. A compiler for a tiny language like Tiny BASIC—targeting whatever output language you already know—walks you through lexing, recursive descent parsing, abstract syntax trees, semantic analysis, and code generation. A mini operating system demystifies bootloading, memory management, paging, scheduling, and filesystems.&lt;/p&gt;
&lt;p&gt;For an even steeper challenge, Henley suggests a spreadsheet—which combines the tricky parts of a text editor and a compiler with directed acyclic graphs (DAGs) and reactive evaluation—and a video game console emulator, starting with CHIP-8 before tackling the NES or Game Boy. Each project includes a checklist of concepts to learn and recommended reading, rounded out by community suggestions like building a relational database, a ray tracer, or a &lt;code&gt;grep&lt;/code&gt;-style CLI tool.&lt;/p&gt;
&lt;h2 id="autonomous-coding-agents-a-codex-example"&gt;&lt;a href="https://martinfowler.com/articles/exploring-gen-ai/autonomous-agents-codex-example.html" rel="noopener noreferrer"&gt;Autonomous coding agents: A Codex example&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Birgitta Böckeler distinguishes between two flavors of AI coding agents: supervised agents steered interactively inside an IDE (like GitHub Copilot, Cursor, or Claude Code) and autonomous background agents (like OpenAI Codex, Google Jules, or Devin) that work through a task in an isolated cloud environment and open a pull request. She gave OpenAI Codex a small ticket in the Haiven app—formatting the filter label &lt;code&gt;&amp;quot;client-research&amp;quot;&lt;/code&gt; as &lt;code&gt;&amp;quot;Client Research&amp;quot;&lt;/code&gt;—and published the full execution log. The agent read &lt;code&gt;AGENTS.md&lt;/code&gt; and &lt;code&gt;README.md&lt;/code&gt;, then ran repeated &lt;code&gt;grep&lt;/code&gt; searches across keywords, wandering into &lt;code&gt;node_modules&lt;/code&gt; three separate times without learning from the mistake before finally finding an existing &lt;code&gt;toReadableText&lt;/code&gt; helper to extend. However, it failed to run the test suite, and its pull request broke two existing regression tests despite the fix itself being trivial.&lt;/p&gt;
&lt;p&gt;From that experiment, Böckeler draws several observations. Agents increasingly rely on brute-force text search rather than structured code navigation. Pre-configuring the remote execution environment is critical, yet setting up all required runtimes and linters (Node, Python, Semgrep, Gitleaks) for cloud agents remains clunky. Across six runs of the same task on Codex, Jules, and Claude Code, every attempt produced working behavior, but only two reused the existing helper while the other four duplicated code. She closes by asking when a team is better off discarding a flawed agent PR outright rather than falling into the sunk-cost trap of fixing it up.&lt;/p&gt;
&lt;h2 id="implementing-an-undoredo-system-in-a-complex-visual-application"&gt;&lt;a href="https://mlacast.com/projects/undo-redo" rel="noopener noreferrer"&gt;Implementing an Undo/Redo System in a Complex Visual Application&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;mlacast, lead developer of Alkemion Studio—a visual brainstorming and writing tool for tabletop RPGs—breaks down how he built a context-aware undo/redo system. Because users work across multiple distinct views such as the Board, the Editor, and Node panels, the core UX rule is that pressing undo should never silently revert something off-screen that the user cannot currently see. Every mutation is modeled as an &lt;code&gt;Action&lt;/code&gt; class with &lt;code&gt;undo&lt;/code&gt; and &lt;code&gt;redo&lt;/code&gt; methods, while &lt;code&gt;ActionGroup&lt;/code&gt; bundles related steps into a single undoable unit (such as deleting a Node and automatically removing its attached Tokens). A singleton &lt;code&gt;ActionStore&lt;/code&gt; holds actions across two &lt;code&gt;Action Volume&lt;/code&gt;s for performed and undone work, while a configuration file defines which action types are valid in the active view so the system can dynamically filter and sort the local undo/redo stacks by a global index.&lt;/p&gt;
&lt;p&gt;Inspired by Docker, a container abstraction creates an isolated sandbox whenever the user opens a modal dialog: actions performed inside the modal can either be discarded on cancel or committed back into the main store like a database transaction. The trickiest part was preserving chronological order as users switch contexts, requiring the global index to increment and decrement carefully across creation, undo, and redo so the most recently redone action always sits at the top of the stack. The remaining limitation is cross-action dependencies, which the author plans to solve next with a declarative dependency graph.&lt;/p&gt;
&lt;h2 id="the-software-engineering"&gt;&lt;a href="https://newsletter.manager.dev/p/the-software-engineering-squeeze" rel="noopener noreferrer"&gt;The software engineering &amp;lsquo;squeeze&amp;rsquo;&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Anton Zaides argues that for the past 10–15 years, software engineering offered the highest return on investment of any career for anyone willing to study hard for a year, with companies hiring almost anyone who could clear an interview bar. In his view, much of the day-to-day work wasn&amp;rsquo;t actually that hard, which produced a massive middle tier of average engineers now getting &amp;ldquo;squeezed&amp;rdquo; between a tighter market and AI automation. He candidly notes that many developers grew used to comfortable workloads and constant complaining, whereas newcomers in most other professions have always had to grind through tough, lower-paid early years to advance.&lt;/p&gt;
&lt;p&gt;Even so, Zaides is optimistic about the long term: many startups launched by &amp;ldquo;vibe-coding&amp;rdquo; founders will find traction and need strong engineers to scale. To thrive, engineers need to add product-management instincts and design taste rather than waiting for detailed tickets to implement—because while the market has an oversupply of average developers, it still has a shortage of great ones. He advises unemployed engineers to experiment with modern AI tools and build solutions to real problems around them, while adding that there is no shame in changing careers: software engineering is once again a field for people who genuinely want to be in it.&lt;/p&gt;
&lt;h2 id="go-is-8020-language"&gt;&lt;a href="https://blog.kowalczyk.info/article/d-2025-06-26/go-is-8020-language.html" rel="noopener noreferrer"&gt;Go is 80/20 language&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Krzysztof Kowalczyk describes Go as an 80/20 language: it delivers 80% of the utility for 20% of the complexity, and most of the hate directed at Go comes from programmers who want 85% or 97%. Paraphrasing Rob Pike, he writes: &amp;ldquo;Nobody denies that 87% is more utility than 80%. The point is that those extra 7% of utility cost 36% more effort.&amp;rdquo; His examples include struct tags that are far simpler than annotations or macros, a standard testing package that fits in a few hundred lines of code while covering the essentials that take tens of thousands of lines in JUnit, goroutines that handle concurrency with a fraction of the complexity of &lt;code&gt;async/await&lt;/code&gt; in C# or Rust, and built-in generic types like slices, maps, and channels that solved most day-to-day needs long before Go added user-defined generics.&lt;/p&gt;
&lt;p&gt;Meanwhile, languages like C#, Swift, Rust, and even JavaScript keep accumulating features endlessly. There is a lower bound, of course: skipping enums is survivable, whereas skipping structs would make a language unusable. Every added feature imposes a tax on users—who must learn not just how a feature works, but when to use it and how to read teammates&amp;rsquo; code that uses it, which is why Google needed a strict C++ style guide—and on compiler writers too: more than a decade in, the Swift compiler can still feel slow and fragile, whereas Go&amp;rsquo;s toolchain has been fast, cross-platform, and rock-solid since version 1.0.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;</description></item><item><title>Newsletter #36</title><link>https://miti99.com/en/post/2025/07/25/</link><pubDate>Fri, 25 Jul 2025 00:00:00 +0700</pubDate><guid>https://miti99.com/en/post/2025/07/25/</guid><description>&lt;p&gt;&lt;em&gt;Enjoy Newsletter #36.&lt;/em&gt;&lt;/p&gt;
&lt;h2 id="what-makes-strong-engineers-strong"&gt;&lt;a href="https://www.seangoedecke.com/what-makes-strong-engineers-strong/" rel="noopener noreferrer"&gt;What Makes Strong Engineers Strong&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Sean Goedecke argues that what separates strong engineers from the rest is their ability to tackle unfamiliar problems faster than anyone else, and he ranks the four traits behind that ability in descending order of importance. First is self-belief: strong engineers take on work they have never done before even when they aren&amp;rsquo;t sure how, dive straight into hard problems instead of procrastinating, and let each success build the confidence to take on even harder work in a compounding loop. Second is pragmatism: they value working solutions over architectural purity, happily make trade-offs to ship on time, and frequently clash with smart but ineffective engineers over unnecessary rewrites; when disputes arise, who actually ships is the ultimate tiebreaker.&lt;/p&gt;
&lt;p&gt;Third is speed. Every strong engineer works fast—by not procrastinating and by compounding experience rapidly—and that speed lets them run more experiments and pursue high-value ideas. That pace comes not from working longer hours, but from intense bursts of focus. Last on the list is raw technical ability: a solid baseline is required, but genius-level intellect isn&amp;rsquo;t; what matters is whether your strengths match the job, and raw intelligence can even get in the way if it undermines pragmatism and speed.&lt;/p&gt;
&lt;h2 id="how-do-ai-code-reviews-impact-engineering-teams"&gt;&lt;a href="https://rdel.substack.com/p/rdel-92-how-do-ai-code-reviews-impact" rel="noopener noreferrer"&gt;How do AI Code Reviews Impact Engineering Teams?&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;This post summarizes a study at Beko in which 238 developers used a GPT-4-powered automated code review tool (Qodo PR-Agent) over ten months, analyzing 4,335 pull requests through surveys and behavioral telemetry. Developers acted on 73.8% of the AI&amp;rsquo;s comments, and 68.8% of participants felt code quality improved. However, median pull-request cycle time actually increased from 5 hours 52 minutes to 8 hours 20 minutes, human reviewer comments barely budged (from 0.31 to 0.28 per pull request), and 26.2% of AI comments were ignored as irrelevant—meaning noisy suggestions created extra triage overhead.&lt;/p&gt;
&lt;p&gt;The core takeaway is that AI code review complements human reviewers rather than replacing them: it improves perceived quality, but neither reduces overall review effort nor speeds up delivery. The study advises teams to treat AI comments as early signal rather than final verdicts, track metrics to measure real impact on quality and velocity, and invest early in prompt tuning and noise filtering as the technology matures.&lt;/p&gt;
&lt;h2 id="writing-that-changed-how-i-think-about-pl"&gt;&lt;a href="https://bernsteinbear.com/blog/pl-writing/" rel="noopener noreferrer"&gt;Writing that changed how I think about PL&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Max Bernstein curates 16 papers, blog posts, videos, and repositories that fundamentally reshaped how he thinks about programming languages and compilers. Highlights include Andy Wingo&amp;rsquo;s post making copying garbage collectors concrete and approachable; CF Bolz-Tereick&amp;rsquo;s optimizer series introducing union-find and using Z3 as a proof engine; Chris Fallin&amp;rsquo;s work on register-allocator correctness showing how to verify a system per-compilation rather than proving the compiler itself once and for all; Russ Cox&amp;rsquo;s regular-expression series explaining how nondeterministic automata become user-space &amp;ldquo;threads&amp;rdquo;; and Andrej Karpathy&amp;rsquo;s micrograd for learning neural networks from scratch without external libraries.&lt;/p&gt;
&lt;p&gt;What unites every entry on the list is turning abstract concepts into clean, compact implementations you can grasp in an afternoon instead of months of study. For younger developers curious about compilers and interpreters, it serves as both a high-signal reading list and a testament to the power of clear, concise technical writing.&lt;/p&gt;
&lt;h2 id="llms-are-making-me-dumber"&gt;&lt;del&gt;&lt;a href="https://vvvincent.me/llms-are-making-me-dumber/" rel="noopener noreferrer"&gt;LLMs are Making Me Dumber&lt;/a&gt;&lt;/del&gt;&lt;/h2&gt;&lt;p&gt;&lt;del&gt;Vincent Cheng poses a provocative question: are large language models (LLMs) making us dumber? He shares personal observations on how AI is reshaping his own learning process and skill development.&lt;/del&gt;&lt;/p&gt;
&lt;p&gt;&lt;del&gt;He points to the cognitive &amp;ldquo;shortcuts&amp;rdquo; AI makes tempting: using LLMs to finish coding projects without deeply understanding the codebase, solving math problems by letting AI generate the answer, or drafting emails without practicing writing. Those habits can atrophy problem-solving muscles and trade deep learning for short-term output speed.&lt;/del&gt;&lt;/p&gt;
&lt;p&gt;&lt;del&gt;At the same time, Cheng acknowledges the immediate productivity gains and draws historical parallels to pocket calculators, GPS, and the Industrial Revolution. Recognizing the uncertainty around long-term effects, he argues for a deliberate middle ground.&lt;/del&gt;&lt;/p&gt;
&lt;p&gt;&lt;del&gt;His prescription is to consciously protect core skills like independent thinking, decision-making, and sustained focus while using LLMs strategically without surrendering personal agency. As he writes: &amp;ldquo;Total offloading cripples real learning while maximizing short-term speed and output, and finding the right balance is critical.&amp;quot;&lt;/del&gt;&lt;/p&gt;
&lt;h2 id="how-cursor-indexes-codebases-fast"&gt;&lt;a href="https://read.engineerscodex.com/p/how-cursor-indexes-codebases-fast" rel="noopener noreferrer"&gt;How Cursor Indexes Codebases Fast&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;This article breaks down how Cursor, the AI-first code editor, indexes an entire codebase so quickly. The pipeline runs in five steps: first, files are chunked locally on the user&amp;rsquo;s machine into meaningful segments; next, Cursor computes a Merkle tree—a hash tree across all eligible files—and syncs it with the server; those code chunks are then converted into vectors using an embedding model; the vectors and metadata such as line numbers and obfuscated file paths are stored in Turbopuffer, a remote vector database; finally, every ten minutes, Cursor compares the Merkle tree to detect modified files and syncs only the diffs. Rather than slicing by fixed character or token counts, smart chunking relies on abstract syntax trees (ASTs) via tools like tree-sitter to preserve semantic boundaries while staying within token limits.&lt;/p&gt;
&lt;p&gt;On privacy, according to Cursor&amp;rsquo;s documentation, raw source code is not persisted on Cursor&amp;rsquo;s servers after a request completes, and file paths are encrypted using a client-side secret key. When you ask a question, your query is embedded into a vector and matched against stored vectors to locate relevant code ranges; those lines are then read locally from disk and sent as context to the large language model. The Merkle tree is the key piece that makes change detection fast and incremental syncing practical, especially on large repositories where re-indexing from scratch would be prohibitively expensive.&lt;/p&gt;
&lt;h2 id="a-leap-year-check-in-three-instructions"&gt;&lt;a href="https://hueffner.de/falk/blog/a-leap-year-check-in-three-instructions.html" rel="noopener noreferrer"&gt;A Leap Year Check in Three Instructions&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Falk Hüffner presents a leap-year check that compiles down to roughly three CPU instructions. The standard definition requires multiple conditions: divisible by 4, and not divisible by 100 unless also divisible by 400. Hüffner packs all of that logic into a single multiplication, a bitwise AND, and a comparison against &amp;ldquo;magic&amp;rdquo; constants: &lt;code&gt;return ((y * 1073750999u) &amp;amp; 3221352463u) &amp;lt;= 126976u;&lt;/code&gt;. To find those constants, he used the Z3 bitvector constraint solver to search a 96-bit space; starting from a small year range and expanding iteratively, about half an hour of search produced constants that hold for every year from 0 to 102,499. A 64-bit variant extends the valid range up to year 5,965,232,499 and is proven optimal using the same technique.&lt;/p&gt;
&lt;p&gt;On performance, benchmarking on an i7-8700K with predictable inputs (always testing 2025) shows almost no difference (0.65 ns vs. 0.69 ns). With random years, however, the branchless formula runs 3.8x faster than the standard implementation by avoiding branch misprediction penalties. Hüffner notes that real-world applications mostly check predictable years like the current one, so realistic benchmarks are needed before adopting this trick in places like CPython&amp;rsquo;s &lt;code&gt;datetime&lt;/code&gt; module. Still, it is a fun exercise in bit twiddling and using constraint solvers for algorithmic optimization.&lt;/p&gt;
&lt;h2 id="reservoir-sampling"&gt;&lt;a href="https://samwho.dev/reservoir-sampling/" rel="noopener noreferrer"&gt;Reservoir Sampling&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Reservoir sampling is an algorithm for drawing a uniform random sample from a stream of items whose total length isn&amp;rsquo;t known in advance. It maintains a &amp;ldquo;reservoir&amp;rdquo; array of size &lt;code&gt;k&lt;/code&gt;, initialized with the first &lt;code&gt;k&lt;/code&gt; items of the stream (or all of them if the stream is shorter). Each subsequent item at 1-based index &lt;code&gt;n&lt;/code&gt; (where &lt;code&gt;n &amp;gt; k&lt;/code&gt;) is selected with probability &lt;code&gt;k/n&lt;/code&gt;; if chosen, it replaces a uniformly random element currently in the reservoir, and otherwise it is discarded. The math guarantees that the probability an older item survives in the reservoir equals the probability the new item is kept, giving every item seen so far an equal chance—just like every card in a deck having an equal chance of being drawn.&lt;/p&gt;
&lt;p&gt;Sam Rose illustrates the practical payoff with a log-ingestion service. During traffic spikes, instead of naively keeping only the first &lt;code&gt;k&lt;/code&gt; logs, reservoir sampling captures a fair, representative sample without overwhelming storage: memory usage stays strictly bounded at &lt;code&gt;k&lt;/code&gt; items, quiet periods record nearly every log, and peak periods automatically cap volume. Rose also touches on weighted variants that prioritize specific classes of items, such as error logs, for more nuanced sampling policies. Reservoir sampling cleanly solves a problem that sounds impossible at first glance: fair sampling when you don&amp;rsquo;t know how many items will arrive.&lt;/p&gt;
&lt;h2 id="beware-the-complexity-merchants"&gt;&lt;a href="https://chrlschn.dev/blog/2025/05/beware-the-complexity-merchants/" rel="noopener noreferrer"&gt;Beware the Complexity Merchants&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;Charles Chen warns against &amp;ldquo;complexity merchants&amp;rdquo;: engineers who introduce unnecessary complexity into systems, whether out of ego or to manufacture job security. By building Byzantine systems that only they understand, they carve out personal fiefdoms that constantly demand attention, budget, and headcount, then use the resulting pain to justify their own indispensability and influence—complete with the familiar refrain, &amp;ldquo;Who else is going to deal with all this complexity?&amp;rdquo; Chen quotes Ray Ozzie: &amp;ldquo;Complexity kills. It sucks the life out of developers; it makes products difficult to plan, build, and test.&amp;rdquo;&lt;/p&gt;
&lt;p&gt;To push back, the post recommends requiring engineers to stabilize or simplify existing complexity before adding new layers, favoring &amp;ldquo;boring&amp;rdquo; battle-tested solutions over resume-driven tech, insisting on thorough documentation so systems can be handed off cleanly, staying skeptical of &amp;ldquo;silver bullet&amp;rdquo; pitches, and treating knowledge hoarding or deliberate obfuscation as red flags. The core message is that simple, well-documented systems enable shared team ownership and eliminate the environment complexity merchants rely on to build leverage.&lt;/p&gt;
&lt;h2 id="asserting-implications"&gt;&lt;a href="https://tigerbeetle.com/blog/2025-05-26-asserting-implications/" rel="noopener noreferrer"&gt;Asserting Implications&lt;/a&gt;&lt;/h2&gt;&lt;p&gt;This short note from TigerBeetle looks at how to write assertions for logical implications (&lt;code&gt;A ⇒ B&lt;/code&gt;) so they stay immediately readable. Most programming languages lack a dedicated implication operator, even though implications show up constantly in assertions. The textbook rewrite relies on the equivalence &lt;code&gt;A ⇒ B ⇔ ¬A ∨ B&lt;/code&gt;, yielding &lt;code&gt;assert(!a or b);&lt;/code&gt;, which forces the reader to mentally invert the condition to recover the original intent. The author recommends writing a plain conditional instead: &lt;code&gt;if (a) assert(b);&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;A real example from the TigerBeetle codebase makes the contrast clear: instead of &lt;code&gt;assert(header_b != null or replica.commit_min == replica.op_checkpoint);&lt;/code&gt;, write &lt;code&gt;if (header_b == null) assert(replica.commit_min == replica.op_checkpoint);&lt;/code&gt;. The second version states directly which condition triggers the check, making the invariant obvious at a glance. It is a tiny change, but a great reminder to optimize correctness checks for human readability.&lt;/p&gt;
&lt;hr&gt;
&lt;p&gt;&lt;em&gt;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.&lt;/em&gt;&lt;/p&gt;</description></item></channel></rss>