Prevent cognitive debt by manually retyping LLM-generated code
This post advocates for the "grossly inefficient" method of manually retyping LLM-generated code. The author argues this practice fosters a deeper understanding, prevents cognitive debt, and helps build a spatial map of the codebase. It resonates with developers grappling with how to integrate AI tools without sacrificing their craft or creating unmaintainable "slop."
The Lowdown
The article by Ankur Sethi proposes an unconventional method for interacting with AI coding assistants: manually retyping all generated code. He admits to still using LLMs for personal projects despite prior reservations, but finds simply "one-shotting" features leaves him disoriented and creates significant cognitive debt. His solution is designed to offload boring tasks without ceding control or understanding.
- The author leverages LLMs for mundane tasks, but warns that blindly accepting their output leads to "cognitive debt" and makes reviewing "overly-defensive, badly-commented, subtly incorrect code" an unpleasant chore.
- His workflow involves instructing the LLM to only provide code in chat, which he then manually types into his editor, never allowing the AI to directly modify project files.
- This "inefficient" method slows his overall speed (2x faster instead of 10x) but allows him to build a strong mental model, detect potential errors or poor design choices, clean up and refactor code, and develop a spatial map of the codebase.
- He likens this process to the traditional learning advice of retyping code examples from books or tutorials, prioritizing deep comprehension over raw productivity.
- The author expresses concern that the software industry is accumulating significant cognitive debt by relying too heavily on AI without truly understanding the underlying systems it produces.
By manually retyping, he aims to ensure he fully understands every line of code in his personal projects, viewing it as a professional responsibility to prevent future structural issues and maintain his craft.
The Gossip
Pedagogical Practices & Productivity
Many commenters resonate with the author's approach, comparing it to traditional advice for learning programming by retyping code, not copy-pasting. They acknowledge that while it's slower, the increased understanding and mental model building is invaluable, especially for personal projects or learning. However, some question the practical implications for productivity, particularly in professional contexts, arguing it could make progress too slow and detract from the 'joy' of building.
LLM's Code Quality & Developer Skill
A spirited debate emerges around the quality of LLM-generated code relative to human-written code. One side argues that developers who can't write better code than an LLM are 'cooked' and need to study more, viewing over-reliance on LLMs as a 'religious addiction.' The opposing view posits that LLMs already produce PhD-level code and often write better code than most humans in many domains, suggesting that the traditionalist aversion to AI-generated code might be the actual 'religious addiction.'
Cognitive Control & Code Clarity
The discussion reinforces the article's core idea of preventing cognitive debt. Commenters express similar frustrations with the 'code review fatigue' of AI-generated code, noting its often overly defensive, badly commented, or subtly incorrect nature. The manual retyping method is seen as a way to maintain control, ensure clarity, and avoid the eventual degradation of an AI-dependent codebase where no one truly understands how it works.