Here, I’ll share some learnings from using ChatGPT and GitHub Copilot to write code. I mostly write Rust, Typescript, and some Bash nowadays, so its knowledge of those languages will guide my learnings.
First of all: try it. Depending on your usecase, it may be extremely useful. Here’s how I tend to see the two models:
ChatGPT:
- Useful as a rubber duck when you want to re-evaluate how you’re implementing a particular function.
- It has also helped me refactor, as described in Refactoring with AI.
- Extremely helpful when you don’t like writing tests, see AI writes my tests.
- I’ve used it to parse and format data from texts: AI coding - Extracting and reformatting data
Copilot: I’ve found Copilot useful generally when producing boiler plate. If I already have an endpoint handler, it can easily generate a new endpoint from a function name. It’ll largely reproduce existing code with slight tweaks, but sometimes it will modify things according to its own “opinions”, which often breaks my code in subtle ways.