AI Did It in 12 Minutes. It Took Me 10 Hours to Fix It
4 hours ago
- #Code maintenance
- #Spaghetti code
- #AI-generated code
- Started personal projects in the 2000s, emphasizing understanding code rather than copying from Stack Overflow.
- Struggles with reviewing AI-generated code due to verbosity, unused blocks, and lack of mental model.
- Tackled a decade-old project: creating an image upload interface for a blog, previously using manual methods like scp/sftp.
- Used GLM-5 AI to generate PHP code, resulting in spaghetti code with embedded logic in templates.
- Encountered contradictions in AI instructions, leading to Node.js code mixed with PHP.
- Generated project had 12 files with ~5,000 lines, required fixes for permissions, SQLite, includes, and session handling.
- Rewrote and restructured the project into 22 files with 1,254 lines, reducing cognitive load.
- AI generated code in 12 minutes but took 10 hours to clean up; questions if manual work within existing framework would have been easier.
- Reflects on AI-assisted development: initial generation looks impressive but cleanup is crucial for maintainability.
- Cannot deploy AI-generated code without vetting and understanding it, skeptical of claims about high percentages of AI-generated code.