March 19, 2023

Background: I had written this Python package, and realized that I needed a version written in JavaScript.

I used ChatGPT for the following purposes: translating the Python code to JavaScript; creating a test suite from the code; creating a README with API documentation and examples from the code; creating package.json and typescript configuration files; and asking for naming advice for the function and filenames.

ChatGPT did a first pass on translating the code. (This was good enough that I only needed a few minutes of cleanup.) Then it wrote the initial README, the test files, and the package.json and tsconfig.js files. (Ditto.)

(Spoiler: here is the final JavaScript version.)

I didn’t time the amount of work this took, but I would estimate ChatGPT saved me 80% of the effort, and 90% of the drudgery. Most of the remaining work was adding some material to the README, and adding a feature that I had omitted from the Python version that I gave to ChatGPT. (I decided to port this feature without ChatGPT, at least in part because I wanted a change of pace to coding from prompt whispering.)

The responses shown were the first responses. Nothing was cherry-picked.

Initial Translation

Screenshot of Safari (3-24-23, 23-47-14).png

[Here, I posted this version of the code.]

<aside> 😓 The code in that file doesn’t meet my standards for code readability, or something that I would contribute to a team. As a side project of a side project, I was just using this library as an excuse to write in what I think of as an old-school Lisp-y style. Excuses, excuses…

</aside>

The ChatGPT response. It goes on; this is only the first page.

The ChatGPT response. It goes on; this is only the first page.

The end of the response.

The end of the response.

Notes:

Test Cases

Screenshot of Notion (3-24-23, 23-53-18).png

Note that ChatGPT is generating these from the source code. It only has access to the function names and implementations. I didn’t enter the Python README or test cases, and these didn’t exist on the web until a few days before this chat.

Generating a README

ChatGPT generated this from the source. It also had access to the test cases that it previously generated, and which it therefore could have used as a form of loud thinking.

Untitled

Untitled

Generating Configuration Files