Here are my Reddit comments on this story: I've always programmed thus: * Try to assimilate a mental model of the bit I'm working on, and as much of that bit's dependencies as is practical, into my head. This may involve fiddling with the code and seeing how it breaks when I do certain things to it, or hammering at it inside a REPL or similar. The bit that I'm concerned about could be a single method, but is usually…
On one project, we initially gave ourselves a ridiculous deadline and subsequently made a lot of ad-hoc "fuck it" decisions without properly thinking out the consequences. The system is sufficiently complex that we ended up with something that _barely_ did what it said on the box (if it worked at all). I dreaded even adding the simplest of features, because I could just feel how fragile the whole thing was.
We ultimately made the decision to scrap the project (and piss off or outright lose some customers waiting to pay us money) and restart from scratch, and I spent a few months part-time just building up a mental model of the system and stress-testing it against all of the different requirements and scenarios we had to handle. I went through a couple of notebooks in that time, but I didn't write a single line of code.
For me, it was a lesson in the importance of deliberation and knowing what you should be building before building. As my uncle liked to say when we built houses together, "measure twice, cut once."