Machine-augmented Test-Driven Development
By Manuel Odendahl
March 10, 2023
0:00 / 9:37
Machine-augmented Test-Driven Development
Manuel (2)

All right. So this is going to be a tiny made up example of how to do test driven development with large language models.

Writing our function interface

have an empty go project here and I want to write the first function that I want to write is because I'm generating Excel sheets. I kind of want to have something that transforms a column index and to a column name with characters. So for example, one would go to a. And then things like if you had 27, it would go to AA, for example.

So the first thing I'm going to do is I'm gonna write a little text, because this is human language, right? So this function transforms a column index, an integer, into a string that can be used to designate an Excel column.

Good way to start. Maybe that's kind of what I would do as a documentation, if I were to program normally. So now that I have that, I'm going to think about an API for this, I'm going to think really hard.

I have an API for this.

It's going to be called ColumnIndexToColumnAlphaString and it's going to take an index as an integer, it's going to return a string.

Asking for edge cases

So, that's my function. Obviously, this is kind of simple enough that I would, you know, that I can write most of the unit cases by myself, but I think that makes for for a good example to put into ChatGPT. So you're going to put it in here and I'm going to ask ChatGPT, what are some edge cases I should consider when writing the following? And go, I don't think, I even need to say that it's go.

What are edge cases I should be considering, and I'm actually to not confuse it too much. I'm just going to remove what looks like an implementation. And writing the following function in go.