I see all these posts/articles about ChatGPT building apps/games/etc in a few hours and wonder if I'm missing something obvious or doing something wrong while interacting with ChatGPT. 99% of the things I've asked to help with solutions to software problems, I got non working code or sometimes even worse code that doesn't compile. Last time I've asked ChatGPT to refactor some code that was generating strings based on regexes that was overflowing for some regexes. The given solution was even worse than the original. Am I missing any clever prompt? Or specific context I need to feed before asking for the solution?
In my experience it works well when you discuss specifics and compare approaches - how do I do $x, compare $y and $z, I have this functionality so far, help me extend it in such and such way etc.<p>I don't think that asking it for a big refactor, or generally leaving it do all the coding on its own is the way to go. A lot of the value it provides comes from the conversation you're having with it and from the fact that it can help you discover patterns and tools you didn't know existed (e.g. what are the best practices for solving a given problem).<p>Using the paid version with GPT-4 is much better too.
Iterations and assigning roles to the GPT help. Give a small block of code, ask GPT to review this with a panel of developers (frontend, backend, ...), users and UI/UX experts for 5 iterations, and then provide the final code. GPT 4 works better. However, a lot of times the code is outdated and creates new issues. Manual review and fixes are needed for most custom code blocks. It works well for standard code modules.