For me code is like a story which I can play forward and backwards and also pause in my mind. Before I write code, I think of multiple stories and I try to choose the one which fits best into the big picture.
Sometimes the story feels too complicated and that means it needs to be rewritten.
Sometimes there might be lots of different stories that converge in very pleasant ways and with ideal timing.