> I carefully considered execution flow and made sure the simple looking code actually did everything correctly
That is what I love about coding. Not just insofar as it's necessary and useful (it is both), but just as a puzzle in its own right, to a fault. It's just a type of "imagination" that I don't really apply often otherwise, since e.g. I'm not into math, not an organizer or manager etc. Though I did have jobs where I instantly saw ways to optimise some things I do credit to having practised with code. You just try to think through what will happen given the known landscape and the given decided plan, what could happen given the known unknowns, how your heuristics would deal with that, and unless it's all green you see if you can change the landscape, the plan, explore some unknowns, and/or improve your heuristics (by which I just mean what you use to make ad-hoc decisions when things don't go according to plan). That kind of becomes a habit which can get applied to and improve lots of things. Measure twice, cut once, so I don't have to spend three days because of a stray comma (again).
omfg all those days and money lost to a single character.