Since AI-generated code is finding its way into production codebases, I thought it’d be good to summarise some guidelines I recommend to avoid pitfa

My guidelines for AI-assisted coding - by Noah Hall

submited by
Style Pass
2024-10-28 11:00:02

Since AI-generated code is finding its way into production codebases, I thought it’d be good to summarise some guidelines I recommend to avoid pitfalls.

These guidelines are specifically aimed towards developers using tooling like Copilot, Cursor, or Continue. No-developer solutions (i.e things made purely through AI without human coding) have different considerations, so I’m not going to talk too much about them in this post.

Before GenAI, many people would take code snippets straight from StackOverflow. The general wisdom at the time was to see the code, and write it out yourself. That advice particularly applies if you are starting out coding.

The less code you write yourself, the less muscle memory you build up. Imagine you were stuck on an island with no internet, and had to write your own parser for coconut counting purposes. If you only relied on output from GenAI (or copy/paste from StackOverflow), you’d probably have a difficult time remembering how the language you’re using works. Can you do isEdiable = isRipe ? true : false in Python?

Once you’ve got all the syntax and nuances of a language understood, then you can start leaning on GenAI copy/paste. Before that, I’d recommend using GenAI only as a pair-programming partner - you write the code, but you discuss what you need to do with GenAI 1 .

Leave a Comment