AI Writes Code Fast, But Understanding It Is the Real Cost
I recently came across an article called "Writing Code Is Easy, Reading Is Hard", and it really resonated with me.
The core idea is simple: writing code is easy, but the real challenge is reading it. You need to spend time building a mental map of the entire system in your head, and that's where all the real costs lie.
But the AI era has made this paradox even more acute.
AI Makes "Writing" Easier, But "Reading" Hasn't Gotten Cheaper
AI has indeed made writing code faster than ever before. Features that used to take hours can now be generated in minutes. Getting a large language model to write an entire function? Even easier.
But here's the problem: the cost of reading code hasn't decreased—it's actually increased.
Why? Because AI-generated code lacks the "thinking process."
When you write code yourself, you go through a complete thought process:
- Why design it this way?
- Why choose this algorithm?
- Why handle edge cases like this?
- Why name variables this way?
But with AI-generated code, you see the result, not the process. It's like inheriting someone else's saved game—you're thrown straight into the middle of a boss fight with no idea what happened before.
The Cost of Building Mental Models
The article "Writing Code Is Easy, Reading Is Hard" talks about the concept of "mental models"—your internal map of how the system works, marking where the landmines are and what depends on what.
AI-generated code also requires building mental models, but this process is much harder.
Missing Context
AI only sees the prompt you give it and doesn't understand the entire system architecture. It might:
- Choose an inappropriate library
- Use coding styles that don't match your existing codebase
- Introduce dependencies you don't need
- Ignore your system's performance requirements
Inconsistent Styles
Code generated at different times might have wildly different styles. Today's function uses async/await, tomorrow's uses Promise.then(). This inconsistency makes code harder to understand.
Hidden Dependencies
AI might introduce libraries or patterns you don't know about. You see a simple function, but to understand it, you need to:
- Trace where this function is defined
- Understand what data structure it returns
- Know how it interacts with the database
- Find out if it has side effects
- Figure out who else is calling it
To understand one AI-generated function, you often need to look at five other files.
Where the Real Costs Lie
Let's look at the cost distribution of software development in the AI era:
Writing Code: From Hours to Minutes
This is AI's contribution. The time previously spent learning syntax, looking up documentation, and debugging errors is now almost zero.
Reading Code: Still Takes Hours or Longer
AI hasn't solved this problem. You still need to:
- Understand the code's intent
- Analyze the code's structure
- Track the code's dependencies
- Understand the code's side effects
Debugging: Even Harder
Because you don't know AI's "thinking," debugging becomes more difficult. When code breaks, you don't know:
- Why did AI write it this way?
- Did AI consider this edge case?
- Does AI know about this performance issue?
Maintenance: Even Harder
Because you didn't experience the building process, maintenance becomes more difficult. When modifications are needed, you don't know:
- What else will this change affect?
- Can this design decision be changed?
- Can this dependency be optimized?
The bottleneck in software development has shifted from "writing" to "understanding".
How to Better Use AI
Since the cost of understanding can't be avoided, how can we better use AI?
Let AI Help Understand, Not Just Generate
Instead of having AI generate huge blocks of code, have it help us understand existing code:
- Let AI explain existing code: Throw complex functions at AI and have it explain the logic
- Let AI generate documentation and comments: Have AI add explanations to existing code
- Let AI analyze code structure: Have AI analyze code dependencies and call chains
Control Generation Scale
- Generate in small chunks, verify incrementally: Don't generate entire modules at once
- Avoid having AI generate entire modules: Maintain control over code structure
- Understand before using: Don't just copy and paste
Stay Engaged
- Don't copy and paste directly: Understand first, then use
- Refactor manually when necessary: Transform AI-generated code into something you understand
- Maintain consistent code style: Establish team coding standards
Thoughts on the Future
What we need isn't a "faster code generator" but "better understanding tools."
AI's next breakthrough should be in "helping understand" rather than "helping generate."
Imagine if AI could:
- Instantly analyze the entire codebase structure
- Automatically generate code dependency graphs
- Intelligently identify design patterns in code
- Automatically detect potential issues in code
That would be a real revolution.
The future of programming might not be about generating more code faster, but generating "understanding" faster.
Final Thoughts
AI has changed how we write code, but it hasn't changed the essence of software development.
Understanding and maintenance remain the core costs. We've solved the "typing speed" problem—now we can generate far more code than we can read and understand.
But unless we solve the "understanding" problem, the cost of software development remains unchanged: it still depends on how long it takes a person to figure it all out.
Use AI wisely: let it accelerate understanding, not just generation.
That's the right approach for programmers in the AI era.
If you're also using AI programming tools, I'd love to hear about your experiences and challenges. Let's discuss how to find the balance between rapid generation and deep understanding.