Hacker News new | ask | show | jobs
by kcartlidge 1166 days ago
I can sort-of answer with a personal example. A week or two back I asked Bing to give me the code for a Go API to list books. Here's what I did, and each bullet point was one single step in the conversation.

---

- It gave me the complete code for a Go API using JSON, with handler and routing, using a map to hold the data

- I asked it to switch to a website and it gave me the same code, with the route adjusted and the rendering returning HTML to view the books

- I said I needed a SQLite back-end and it updated the code to fetch from a database, including stuff to open the connection

- I asked it to seed the database with some random data and it added a method to do that

- I asked it for a page to add a book and it gave me the full code back with a route, handler, database code, and form handling logic to do add a book

- I said I needed the option to delete any book and it gave me updated HTML with a small form tag and delete button for every book in the item list, with code to delete the right book when a button is clicked

---

I'm not exaggerating when I say that each of the above was literally a single request. I pasted the code returned into a file and ran it and in each case it built and worked.

At only one stage did it get something wrong. I never kept the prompts/code as I was experimenting, but basically it had an off-by-one error in a loop where it did less than or equals to rather than less than. I described the problem (one prompt) and it "worked it out" and gave me the code back with the line fixed.

So that is 6 prompts plus an extra one for the bug, and the result was a working (trivial) site written in Go with a database back-end.

The other main use I've had is pasting in a screen or two's worth of existing Python code. No questions, just the code. It explained what the code did (including a nuance I'd missed) and proactively pointed out a bug I hadn't seen.

It was incredible to see, then it was worrying (am I needed any more?), then reassuring when I realised this was great for getting started with green-field stuff or iterating over small stuff, but less so with big-picture stuff on a large codebase.