Spec-driven development doesn't work if you're too confused to write the spec
2 points by josephjnk
2 points by josephjnk
I’ve been mulling on a related idea recently that I’ve not yet made fully concrete. Something like: does the friction of fighting with code give feedback on the quality of the domain rules which one is attempting to encode? When I’m writing a library I want to try to use it; if using it feels bad then I’ve probably done a bad job implementing it. Does this extend to the level of applications, not just libraries? If so, does cutting out the struggle over the concrete representations cut off an important feedback channel by which we monitor and evaluate the direction of our system’s evolution?
Yes.
The code I ship to implement a nontrivial algorithm is rarely the first attempt. I make an attempt, realize it feels wrong, and go for a walk to think. This usually repeats, and I end up with something good.
does the friction of fighting with code give feedback on the quality of the domain rules which one is attempting to encode?
There is an approach in the digital humanites called exploratory programming [1]. The idea is that you don't (just) write a program to automatize a process that is known to be correct, using structures (and relations) that are provably correct. What you do when you program exploratively is that you encode and iterativerly refine your theory, your current understanding of a problem domain. Error after error, edge case after edge case.
If you stumble upon an error, you don't jump to blaming your wrongful implementation, but you rather question whether your current theory is sound. For example: if the compiler or the interpreter tells you that your data structure cannot be constructed because it is recursive, you don't hack around that, but instead ask yourself if your theory really requires circular references between entities and their parts.
If you remove the friction, you remove the learning aspect of the act of programming and the chance to reflect on your approach to the problem.
[1] Exploratory Programming in Digital Humanities Pedagogy and Research. Nick Montfort. In: A New Companion to Digital Humanities (2015).
I agree; ever since using functional languages with ADTs, I find them extremely useful to structurally break down problems. And without understanding the structure of the problem, whatever prompt I come up with is probably solving the wrong thing.