Understand and improve on LLM-generated code
2 min read1 day ago
–
You’re about to commit a chunk of LLM-generated code into your product’s codebase. Before you do, however, pause to consider and act on these questions:
- Does it work? A lot of generated code can ‘feel’ right but be either subtly or grossly incorrect. If you don’t already have an automated testing habit, it’s never too late. Vibes are not enough.
- Do you understand the generated code? Could you explain it if asked? Don’t accept the code until you’ve learned from it and you know what it does. [Don’t outsource your understanding](https://nautil.us/will-ai-harm-us-better-to-ask-how-well-reckon-with…
Understand and improve on LLM-generated code
2 min read1 day ago
–
You’re about to commit a chunk of LLM-generated code into your product’s codebase. Before you do, however, pause to consider and act on these questions:
- Does it work? A lot of generated code can ‘feel’ right but be either subtly or grossly incorrect. If you don’t already have an automated testing habit, it’s never too late. Vibes are not enough.
- Do you understand the generated code? Could you explain it if asked? Don’t accept the code until you’ve learned from it and you know what it does. Don’t outsource your understanding.
- What’s different between the generated code and what you might otherwise have done? Are the differences something you can learn from or something you should reject? Don’t accept code that is worse than what you would have written.
- Can you think of at least one way to improve the generated code? Make it so.
In software development, one of the (non-swear) words we use to describe things we don’t understand or feel empowered to improve is legacy. We should be careful both to avoid ‘optimising’ and accelerating the creation of legacy code and to mistake such pessimisation as productivity — especially if we’re doing so at the expense of joy, time and skill.
Press enter or click to view image in full size
mastodon.social/@kevlin/110136069252675177
In using Gen AI, many developers have unintentionally taken a back seat with both their knowledge and their destiny. By skimming past the friction necessary for learning, the pursuit of convenience can end up deskilling rather than enhancing skills. Many have confused meaningful productivity with the movement of a single metric or a subjective feeling.
It is easy — and common — to conflate progress through Jira tickets with actual progress in software development, or lines of code with needed functionality, or fixing defects with adding value to a product. Busyness is not the same as business. Getting better at getting through issues is not a benefit if you are creating disproportionately more issues over time, playing Whac-A-Mole with failure demand.
Use AI as augmentation. Treat AI as a power tool, not a replacement for craftsmanship.
AI coding assistants offer many opportunities for improvement of both our codebases and our knowledge. But just because the offer exists doesn’t mean it will be taken up. Without conscious effort and engagement not only is this opportunity lost, but the outcome could be worse in the long run. Being the human in the loop needs to be understood as an active not a passive role.
Don’t just turn the handle; listen to the music. Understand it. Feel it. Join in. It’s yours.