Live data from Hacker News

Ask HN: Those with success using GPT-4 for programming – what are you doing?

news.ycombinator.com

21–30 of 109 posts

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#23

SQL queries. I am poor at writing SQL queries with bunches of joins. I just show it the table definitions and tell it what I want. Sometimes it doesn't get it quite right (which is why you need some knowledge of what you are asking of it) and I point it out and it fixes it. Regular Expressions. I hate doing regexps. It is excellent at them. Wiki articles for an encyclopedia I'm developing. It is great at this, but oc…

I've also been using ChatGPT to create SQL queries -- it's genuinely really, really great at this. I do have to say "I'm using PostgreSQL with DataGrip IDE" and feed it back any errors I get, because there are a lot of permutations for SQL, but it's a pretty seamless experience overall.

Here's an example of one that helped me a lot. This takes no time at all to get ChatGPT to generate by giving it anonymized snippets of table data saying:

"here's an example of the relevant tables, I want output that looks like this, what query does that?"

and it just works instantly.

ChatGPT did NOT format it this way, I changed the line breaks and indentation formatting to better fit viewing in Chrome/Safari. I also renamed tables/columns out of personal responsibility, to generic names which make it all the more confusing.

  -- Existing Records
  WITH search_table_A AS (
    SELECT * FROM tableA
    WHERE some_primary_key = :searchKey
  ),
  search_table_B AS (
    SELECT * FROM tableB
    WHERE some_primary_key = :searchKey
  ),
  combined_query AS (
    SELECT COALESCE(search_table_A.our_UUID, search_table_B.our_UUID) AS our_UUID
    FROM search_table_A
    LEFT JOIN search_table_B ON search_table_A.some_primary_key = search_table_B.some_primary_key
  )
  SELECT tableC.* 
  FROM tableC
  JOIN combined_query ON tableC.our_UUID = combined_query.our_UUID;

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#24
I have found it completely fucking worthless for anything I have thrown at it.

Computing how to dilute a concentrate into a fruit punch, how to create and render a template in golang, how to parse an int in golang, what makes a chord progression a "lydian" chord progression... it goes on and on.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#25
I'm great with backend software but not so great with frontend, so I had GPT4 write me a simple React app to test out some endpoint. Works really well. After the code was working, I pasted the app into it and asked it to make it "more visually appealing" and it did.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#26
Top tips:

* If you can write it from memory, go ahead and do so. Do not consult GPT-4

* If you know what to do but need to look a few things up - put your best effort into GPT-4. It will flesh it out

* If you're using a library that is new, you can copy paste the library examples into GPT-4 and then describe what you want to do. It will give a great starting point

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#27
post #10

I'm the creator of rqlite[1], an open-source distributed database written in Go. It's saving me time (sometimes 2x speed up on certain, well-specified, tasks), and I enjoy using it. I wrote a blog post with some details on how it has helped me code the database: https://www.philipotoole.com/what-did-gpt-4-find-wrong-with-... That said, the most recent release of GPT-4 seems a little more buggy[2]. [1] https://www.rql…

Reading your blogpost it wasn't clear to me how you ran your code through GPT-4. Which prompts did you use?

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#29
post #27
post #10

I'm the creator of rqlite[1], an open-source distributed database written in Go. It's saving me time (sometimes 2x speed up on certain, well-specified, tasks), and I enjoy using it. I wrote a blog post with some details on how it has helped me code the database: https://www.philipotoole.com/what-did-gpt-4-find-wrong-with-... That said, the most recent release of GPT-4 seems a little more buggy[2]. [1] https://www.rql…

Reading your blogpost it wasn't clear to me how you ran your code through GPT-4. Which prompts did you use?

I brought up the web UI, and said something like this: "Here is a Go source file, see any problems, issues, or suggested bug fixes? "

Simple as that. Of course, sometimes I got the "message too big" error. So I pasted bits of the sources files, choosing pieces I thought were reasonably self-contained. I also fed much of my unit tests through it, asking "see any missing test cases?" While some of the answers were not that helpful, digesting the feedback from GPT-4 made me think more about my code, and make some changes for the better.

Re: Ask HN: Those with success using GPT-4 for programming – what are you doing?

#30
Writing in a language that I don't know that well, but I know enough. Okay, my javascript isn't the strongest, so I'd prolly have to spend 30-45 minutes just coming up to speed again on my basic AJAX and modern syntax, or BAM write a schema of my idea and get GPT to get my idea on paper with halfway decent style, syntax. I can take it from there.
Post reply on HN