AI - Your Overeager Intern
Some developers love AI Coding Assistants. Others find them useless. Other professions may experience the same split. Why is that, and what can it teach us?
What's bad
Most complaints about AI tools for coding revolve around a few common themes.
Hallucinations. The AI might suggest using a library that doesn't exist.
Bugs due to improperly handled edge cases.
AI forging ahead but misunderstanding the task, not aligning with the context or overarching guidelines
What's good
Fans of AI tools find that it's great at
Writing unit tests from a high-level specification
Creating small incremental functionality that satisfies a given test
Filling in gaps in
The secret
Current AI assistants fail when the initial ask is too large. That's when they start hallucinating libraries, going off the deep end for some rabbit hole, or committing some very basic mistakes. They shine when given small, clearly defined, asks, like writing a single unit test, or creating a small piece of functionality.
In short: To get AI coders to produce good code, you do the same thing you'd do to get a human coder to produce good code:
Break down features into small, incremental steps.
Cycle back and forth between tests and code that makes the test pass.
AI as the overeager intern
AI coding tools have been likened to "over-eager junior programmers who can type fast." It's a simplification, but it gives us a good mental handle on how to get the most out of our AI tools:
How would we delegate this task to a generally capable junior employee who might need a few guard rails so they stay on track?
Marketing – Instead of asking AI to "write a full campaign strategy," prompt it to "draft three headline variations for a product launch post targeting tech enthusiasts."
Legal – Instead of asking AI to "draft a full contract," guide it with "generate a confidentiality clause for a partnership agreement between two tech startups."
Product Design – Instead of asking AI to "design a full mobile app UI," prompt it to "generate three layout ideas for a login screen with a modern, minimal aesthetic."