Live data from Hacker News

Tips for better coding with ChatGPT

nature.com

11–20 of 114 posts

Re: Tips for better coding with ChatGPT

#11
I've been using it for weeks, but recently it was so gutted that it barely understands TypeScript. I do my own coding again because sifting through all the possible bugs is more work than just writing it yourself. A true shame, because before it got "faster" it was capable of creating entire apps.

Re: Tips for better coding with ChatGPT

#12
I've been using the openai apis to write and edit code for 3-4 months now. So I think that makes me an old timer (ha!). I have also been building tooling for improving the chat based coding experience [0]. All of this work has given me an opportunity to think about how to work best with GPTs on coding, and I've shared some thoughts about this in the past [1].

Here are some of my thoughts on how to code with chatgpt. Many overlap with topics covered in the Nature article.

  - It really does help to think of chatgpt as a junior coder. I mentioned this in the writeup about my first AI coding project [2]. A bunch of things in this list would also be helpful when working with a junior dev.
  - GPT isn't good at code architecture. It will repeat code and take the shortest, laziest path to coding up your request. You need to walk it through changes like you might with a junior dev. Ask for a refactor to prepare, then ask for the actual change. Spend the time to ask for code quality/structure improvements.
  - Don't copy-and-paste between a chat session and your files. Use a tool like Copilot [3] or aider [0] that will give GPT your code to edit and apply its changes automatically. This is critical as it removes friction and lets you iterate quickly on code with GPT.
  - GPT is amazing at generating fresh new self-contained code. It takes more skill and better tools to work with it to edit existing code.
  - Break down a big change and ask for a series of smaller, self contained steps. This is a smart way to code solo, but really helps GPT succeed at more complex code modifications.
  - GPT has a wide breadth of coding knowledge, and impeccable command of syntax... but it is sometimes overconfident about details. So it will usually choose the right library for a task, but sometimes make an error about the details of the api/method/params. Paste doc snippets or error messages into the chat and it will fix those bugs.
  - GPT is really strong at churning out good boilerplate and roughing in a solution. This reduces the activation energy required to start larger changes or changes which will require unfamiliar libraries/packages/languages. GPT can can quickly prepare the ground for you to do the interesting work.
  - If you can, use gpt-4 (not gpt-3.5-turbo) since it can successfully generate larger, more complicated code changes.

[0] https://github.com/paul-gauthier/aider

[1] https://news.ycombinator.com/item?id=36020809

[2] https://github.com/paul-gauthier/easy-chat

[3] https://github.com/features/copilot

Re: Tips for better coding with ChatGPT

#13
post #6

> Trust but verify... Based on my own attempts to have ChatGPT generate code for me, it's better to NOT trust it. It tends to hilucinate even with simple requirements.

I think they should use a different name altogether for chatGPT 4 as it is very different and superior to 3.5. And when people say chatGPT doesn't work for me, I would like to know which one they tried.

Re: Tips for better coding with ChatGPT

#15
post #6

> Trust but verify... Based on my own attempts to have ChatGPT generate code for me, it's better to NOT trust it. It tends to hilucinate even with simple requirements.

I think they should use a different name altogether for chatGPT 4 as it is very different and superior to 3.5. And when people say chatGPT doesn't work for me, I would like to know which one they tried.

Mm. One of the cases where cute corporate names for each version would actually help.

GPT: Alice; GPT-2: Bob; GPT-3: Carol; GPT-3.5: Mountain Carol; GPT-4: Dallas; …; GPT-19: Sydney

Re: Tips for better coding with ChatGPT

#17
post #15

Earlier quoted context omitted.

I think they should use a different name altogether for chatGPT 4 as it is very different and superior to 3.5. And when people say chatGPT doesn't work for me, I would like to know which one they tried.

Mm. One of the cases where cute corporate names for each version would actually help. GPT: Alice; GPT-2: Bob; GPT-3: Carol; GPT-3.5: Mountain Carol; GPT-4: Dallas; …; GPT-19: Sydney

They did that for a while during the GPT-3 days, Ada, Babbage and Davinci all were/are different variations of GPT-3.

Re: Tips for better coding with ChatGPT

#19

I've been using the openai apis to write and edit code for 3-4 months now. So I think that makes me an old timer (ha!). I have also been building tooling for improving the chat based coding experience [0]. All of this work has given me an opportunity to think about how to work best with GPTs on coding, and I've shared some thoughts about this in the past [1]. Here are some of my thoughts on how to code with chatgpt.…

I’ve been using aider since last week when I got GPT4 api access and it has easily quadrupled my coding productivity. I didn’t realize how slow it was to constantly be pasting and copying in the browser until I started using it
Post reply on HN