How do you review code when coding with ChatGPT?
I've been using ChatGPT quite a lot for personal projects lately, but I feel uneasy about using the generated code as-is, so I'm trying to review it.
I'm curious how everyone verifies it.
6 answers
Agreed, this is surprisingly important. I usually just run it first and start from wherever errors pop up, but I guess that’s not really a review lol
At first, I just copied and pasted too, but later when debugging I lost my mind, so now I've set some rules.
1. Extract and verify only one function at a time
2. Check that library versions match (this is really often wrong)
3. Check for places missing exception handling
4. Have it write test code separately and run it
Doing it this way made me feel at least a bit less anxious. Number 2 especially is absolutely essential. Sometimes it even makes up functions that don't exist...