There is something irresistible about asking an assistant for a function and watching it appear almost immediately, complete with comments and an explanation. The cursor stops and I already want to press “run”. The difficult part comes when I need to decide whether that code can actually enter my project.
This transition is what interests me in From Prompt to Software. Speed is a wonderful thing. I would also like to reach the next day still able to explain what I put in the program. Even without reopening the conversation and hoping the assistant will remember on my behalf.
“Check the dates” sounds perfectly clear. To me.
Take the book lending application. I ask it to check the dates, and in my head the requirement seems complete. But are the dates already valid? Can I return a book on the same day? What should happen if the return date precedes the start of the loan? These are details I know. To reach the code, they need to leave my head.
So I specify the case: the dates have already been parsed correctly, an earlier return date must be rejected and a same-day return is allowed. I have written a few more words, but at least I now know what to look for in the result.
The equal-date case is my little spoilsport. A comparison can look perfect and reject exactly the loan I decided to allow. To find out, I run the function on the three cases and compare each result with the expected one. Turned into automatic checks, these are tests: I can repeat them when I change the code.
I read the function too. I want to recognise where it applies the rule and how it reports an error. An explanation full of good intentions only helps if I can find them in the program’s behaviour.
Then two readers arrive for one book
The dates can be correct and the loan can still have a problem. Imagine two people simultaneously requesting the last available copy. If both get it, my three date tests will have little to say. I also need an availability rule and a check of what happens when requests overlap.
That is why I consider verification part of the work from the initial request onwards. Each check answers a specific question; when the question changes, I prepare other checks. The number of generated lines, however impressive, does not tell me how many of those questions I have answered.
I still find it exciting to build so quickly. I want to do it while keeping the ability to understand, correct and maintain what I build. Before the toast, then, a few awkward cases. The code will get over it.