Posted by todsacerdoti 8 hours ago
There is only one source of truth and that is the source code. To define and change contracts written in an ambiguous language and then hope the right code will magically appear, is completely delusional.
Iteration is the only game in town that is fast and produces results.
I've seen this exact process play out in my own work. The AI generates code and tests that pass with high code coverage and honors invariants set by spec. I look at the code and find a rats nest / ball of mud that will cost 10x more tokens to enhance should I ever need to add a feature.
So, I think you're on to something, but I think the process might be discounting extensibility and resilience under change.
It really forces you to do outside-in testing; I usually describe the kind of API I want when chatting with the agents. For example, the CLI options, the routes that might be useful for an API, etc.
> I look at the code and find a rats nest / ball of mud that will cost 10x more tokens to enhance should I ever need to add a feature.
Agreed, I don't know if there are good forcing functions to avoid complexity. The providers have a huge incentive to have you waste your tokens (for example when it re-outputs the complete file when you ask for a tiny change).
- write a test for method that does not exist, it just calls the method and nothing else
- write method that does nothing
- add/extend test that uses that method <-- this very loop starts
- modify method until tests passes
- go back to loop start until you're done
I always hated it. When I work with LLM i first massage interface that tests, then tests, then implementation until all these tests pass.
> for example when it re-outputs the complete file when you ask for a tiny change).
well with sonnet 3.5 and 4.5 (can't say about 4.6) it often will get stuck in a loop trying to update just the required parts and iether waste tons of tokens doing these updates or waste tons of tokens to a point where restring file from git is required. Tokens get wasted regardless.
https://www.oreilly.com/library/view/simplicity/979888865170...
If you can't be bothered to write it, why should i be bothered to read it?