4 ms·
I’ve had good success with ChatGPT and with Copilot, but I’ve found it really depends on how I use it and my expectations. It is NOT good at generating complex
by dkersten 3y ago
I’ve had good success with ChatGPT and with Copilot, but I’ve found it really depends on how I use it and my expectations.
It is NOT good at generating complex functions or code but simple cases and I do not use copilot for “comment driven development” as my experience with that wasn’t good.
I use it as a fancy autocomplete, I use it to explain code, I use it for refactoring code (eg it’s good at tasks like “change all variables backed to snake_case”), I use it to provide api usage examples for functions, I use it to generate basic docstrings (which I then hand edit to add the detail I need), I use it to point out flawed in code (it’s bad at telling me if code is good, but it’s pretty good at spotting mistakes if the code is bad).
I’ve also used it to generate functions or algorithms that I wouldn’t have been able to do by myself and that includes complex SQL (TimescaleDB windowed queries), in an iterative process. I find the best results are when you generate short snippets at a time with as few requirements as possible but with as much detail on what you’re asking for as possible, and then it’s an iterative process. You also need to guide it, it works if you already know how you want to approach it and just want the AI to figure out the nitty gritty specific details. I’ve used this to generate a concurrent bitset-based memory allocator. I don’t think I could have done it by myself.
I’ve also had success generating little Python scripts in their entirety, although to get the exact behaviour I wanted was a process of repeatedly pointing out problems and eventually noticing it was not where the LLM was editing. So it’s important you understand every bit of code that it generates and don’t accept code until you’re certain you understand it.
As an example of a recent script it generated for me, it reads a TOML file containing a table, it looks for a key that you specify as a command line arg. It then generates a CSV for all keys it finds. Eg it turns this:
[test.a]
x = 1
y = 2
[test.b]
x = 3
z = 4
Into this:
x,y,z
1,2,
,3,4
It did this a lot faster than it would have taken me to do it myself.
I’ve also had good experience using ChatGPT to do pros and cons list of approaches or do some basic research for new eg into algorithms (now that it can search the web).