Today I've been writing code. I love writing code. Perhaps too much. If a program is going well I have to reminded to do things like eat and drink etc etc.
This was one of those occasions. But as I was munching my sandwich I came up with a way to make the program even neater. If I'd carried on at full speed I'd not have spotted this for a while and then either missed out on a trick, or had to do some rework later on.
Having thought about this a bit more I think that it is actually quite a good idea to walk away from a programming task for a little while and go back to it, even if you are coding up a storm at the time. On any programming project (particularly programming coursework) I strongly advise people to start early so that they have time to fail. But it also means that you can stop and smell the roses every now and then, and this can make the result even better.