Yesterday was one of those days where I was in 'flow'. I was rewriting one of my early attempts. A changed requirement now forced me to generalise the process. Previously I used procedural code, copying an even earlier version of the script written by my predecessor here.
But yesterday I decided it had to be implemented with a reasonable design (and that means OO for me) instead of more ad-hocery on top of existing ad-hocery. I still wasn't sure how to implement my design but I started coding and put a stub class and/or method for everything which was still unclear. As I proceeded the design crystallised in front of me. The script is small enough to allow me to rewrite the whole class hierarchy within a couple of hours if necessary so I had no fear of refactoring and refactoring again.
When my alarm went off to remind me to go home, I realised I'd spent the whole day in 'flow', totally absorbed in the code.
It doesn't happen often but when it does it reminds me why I love programming.