[KongchangAI]
Expert Opinions· 3 min read· 1,583 words

Reinventing the Wheel: Why Building From Scratch Is the Shortcut to the Technical Frontier

Reinventing the Wheel: Why Building From Scratch Is the Shortcut to the Technical Frontier

Strategically reinventing the wheel is a programmer's essential path to the technical frontier.

Developer Andrew Quinn compressed a 3GB SQLite database into a 7MB FST file, sparking a profound reflection on "reinventing the wheel." He argues that guilt over wheel-reinvention is a cognitive trap — in most fields, building four or five wheels by hand with purposeful questions is far more effective than passive learning, serving as the essential path to the technical frontier. In the AI era, foundational understanding is more valuable than ever.

A Thought-Provoking Technical Story

Recently, developer Andrew Quinn shared an impressive technical achievement — he replaced a 3GB SQLite database with a mere 7MB FST (Finite State Transducer) binary file. But even more striking than the technical result itself was a profound reflection on "reinventing the wheel" that he wrote in the footnotes of his article.

FST (Finite State Transducer) is a data structure based on finite automaton theory that can store key-value mappings in an extremely compact form. Unlike traditional hash tables or B-tree indexes, FSTs achieve very high compression ratios by sharing prefixes and suffixes, making them particularly well-suited for string collections with many common prefixes (such as English dictionaries, URL collections, etc.). In the Rust ecosystem, the fst crate developed by Andrew Gallant (BurntSushi) is the classic implementation of this data structure, supporting ordered traversal, prefix search, and regex matching while maintaining near-memory-mapped query speeds. Quinn's project achieved such a staggering compression ratio precisely because his data had highly structured characteristics, and FST was perfectly positioned to exploit that structure to eliminate redundancy.

This passage touches on a core anxiety that every programmer faces at some point in their career: Is what I'm building something that someone else already did better three or four decades ago?

The Programmer's Original Sin: Guilt Over "Reinventing the Wheel"

Quinn candidly admits that for the first twenty-five years of his life, despite his passion for programming, he could never shake a persistent sense of guilt — the nagging uncertainty about whether the tools he was building had already been superseded by some superior implementation.

He offers a vivid example: you could write your own TSV-aware search-and-replace tool, or you could learn awk and solve an entire category of problems in one fell swoop. awk was created in 1977 by Alfred Aho, Peter Weinberger, and Brian Kernighan at Bell Labs, with its name derived from the initials of its three creators' surnames. It embodies the core Unix philosophy: write programs that do one thing well, and combine them via pipes to solve complex problems. awk excels at processing structured text data (such as CSV, TSV) and can accomplish in a single line what other languages require dozens of lines to achieve. Under this comparison, building your own tools always seems like the "inefficient" and "foolish" choice.

This mindset is extremely prevalent in the tech community. We're taught to "stand on the shoulders of giants," to leverage existing tools, and to never reinvent the wheel. The subtext of countless Stack Overflow answers is: "Don't write it yourself — just use this library."

The Core Insight: "Don't Reinvent the Wheel" Is a Cognitive Trap

Quinn's central argument is concise and powerful: this way of thinking is a trap.

He argues that to reach the frontier of our understanding about "wheel-building," you need to reinvent a few wheels yourself. Not a thousand, and not zero — in most fields, roughly four or five will do; in epistemologically rigorous and mature fields like mathematics or computer science, you might need twenty or thirty.

The elegance of this argument lies in the specific sense of scale it provides. It rejects both blind wheel-reinvention and the extreme of never reinventing anything. This isn't a black-and-white issue — it's a practice strategy that requires careful calibration.

Why Building From Scratch Is More Effective Than Studying

Practical Knowledge vs. Book Knowledge

Quinn proposes a bold efficiency comparison: every wheel you reinvent by hand, and every targeted question you ask along the way, will push you toward the true technical frontier faster than an equivalent amount of undirected study — or even five times as much.

This aligns closely with findings in cognitive science. Constructivist learning theory, rooted in the cognitive development research of Piaget and Vygotsky, holds that knowledge is not passively received but actively constructed by learners through interaction with their environment. In computer science education, this theory has extensive empirical support. MIT's Seymour Papert took it further with Constructionism, arguing that learning is most effective when learners are building externally shareable artifacts. Cognitive Load Theory also shows that active problem-solving engages schema construction processes in working memory, forming long-term memories that are more robust and transferable than those from passive reading. When you implement a data structure by hand, the depth of your understanding is incomparable to reading a textbook ten times over.

From SQLite to FST: The Judgment Behind a 400x Compression

Quinn's own project is the perfect illustration. Compressing a 3GB SQLite database down to a 7MB FST binary — a more than 400x reduction in size — wasn't achieved by "using off-the-shelf tools." It was achieved through a deep understanding of data structures, enabling him to choose an approach that fit the problem's characteristics.

SQLite is the most widely deployed database engine in the world. It stores an entire database in a single file and requires no separate server process. Thanks to its zero-configuration, transactional, and cross-platform nature, SQLite is extensively used in mobile apps, desktop software, embedded systems, and even local storage for web applications. However, as a general-purpose relational database, its storage format must support random reads and writes, transaction rollback, index maintenance, and more — meaning it inevitably carries storage overhead. When data is read-only and query patterns are fixed, specialized data structures can often outperform general-purpose databases by orders of magnitude — and Quinn's case is a perfect embodiment of this principle.

This kind of technical judgment is precisely what accumulates from the experience of "building wheels." Only when you truly understand how underlying data structures work can you make optimal choices when facing specific problems.

Practical Advice for Technical Learners

Build Wheels With Purpose, Not Aimlessly

What Quinn emphasizes is not random wheel-reinvention, but directed questions. The key is to practice with clear questions in mind, not to build for the sake of building. Before you start, ask yourself: What do I want to understand through this exercise?

Find the Four or Five Wheels Worth Reinventing in Your Field

For practitioners in different domains, the question worth pondering is: In your area of expertise, which four or five wheels are worth reinventing by hand?

  • Backend developers: a simple database, an HTTP server, a compiler front-end
  • Frontend developers: a virtual DOM implementation, a simple reactive framework, a bundler
  • Machine learning engineers: backpropagation from scratch, a simple Transformer, a gradient descent optimizer

For frontend developers, the Virtual DOM is a core concept introduced by React in 2013. It works by maintaining a lightweight copy of the DOM tree in memory and using a diff algorithm to compute the minimal set of updates, thereby avoiding expensive real DOM operations. Implementing a simple virtual DOM by hand (typically requiring only 200-500 lines of code) gives developers deep insight into the reconciliation algorithm, the role of keys, batch update strategies, and other core mechanisms. Similarly, implementing a simple reactive system (like Vue's dependency tracking) only requires understanding Proxy/Object.defineProperty, the publish-subscribe pattern, and topological sorting — but the process gives you a thorough understanding of why certain coding patterns cause infinite loops or missed updates. This low-level understanding is an irreplaceable foundation for debugging complex framework issues.

For machine learning engineers, the Transformer architecture has become the cornerstone of modern AI since Google's Attention Is All You Need paper in 2017. Implementing a Transformer from scratch (typically including multi-head self-attention, positional encoding, layer normalization, and feed-forward networks) requires roughly 300-500 lines of Python, but the process helps you understand: why the attention matrix has O(n²) computational complexity, why positional encoding is necessary, how residual connections mitigate vanishing gradients, and how KV-cache accelerates inference. Andrej Karpathy's nanoGPT project (training a GPT in about 600 lines of code) is a prime example of this educational philosophy — it proves that even cutting-edge technology can be deconstructed into understandable components.

Overcome the Guilt and Treat the Process as the Goal

Perhaps the most important shift is a mental one: don't feel guilty because "someone has already built this." The purpose of reinventing the wheel is not to produce a better wheel — it's to make yourself a better engineer. The process itself is the goal.

Conclusion: The AI Era Demands Deeper Foundational Understanding

In an age where AI tools are increasingly powerful, this perspective is especially valuable. When AI can generate vast amounts of code for you, the ability to understand technology from the ground up becomes even scarcer and more valuable.

As Quinn puts it, the path to the technical frontier doesn't go around the wheels — it goes through them. Those who are willing to spend time reinventing a few wheels by hand will ultimately go further than those who only know how to call pre-built solutions.

Key Takeaways

  • Developer Andrew Quinn compressed a 3GB SQLite database into a 7MB FST binary file, demonstrating the value of deeply understanding data structures
  • Guilt over "reinventing the wheel" is a trap — moderate reinvention is a necessary path to the technical frontier
  • In most fields, reinventing four or five wheels by hand is sufficient; in mature fields like computer science, you may need twenty or thirty
  • Purposeful, question-driven practice advances you toward the technical frontier more effectively than equal or even five times the amount of passive learning
  • In an era of increasingly ubiquitous AI tools, the ability to understand technology at a foundational level has become even more scarce and valuable
#reinventing the wheel#software engineering learning#FST data structure#SQLite optimization#hands-on programming#technical depth#learning by building
Share:

Related articles