You have a big software system and something isn't right, for example you need to add a new feature but with the way the system is built it's not easy to fit that new feature in. So you need to do some refactoring. You get an idea of what needs to be changed to make the new feature fit. Before you start you have a rough idea of what needs to be changed, so you start working. After a while it becomes a bit overwhelming, because you discover that there are a lot of details you hadn't thought about yet. The list of things you need to change that you have in your head grows longer. But you push on.
After hours or even days of concentrated working, you start to notice that the idea is coming together. You start noticing that there's only one right way that the code should be, and it almost writes itself. The pieces of the puzzle are coming together and everything fits perfectly, and that's when you realize that your original idea was right.
I had that feeling the other way around a week or two ago. I was talking to a co-worker about a very difficult refactoring we just did and suddenly the right way to implement one of the features just flew out and hit me. It was so obvious.
Unfortunately the refactored version had already been installed a couple of months earlier and there is no way we are awakening that dragon for a while yet. The testers would kill us, for one thing.
There are few times when plan a way to fix the issue/new feature and over do the refactoring to get the new feature or a bug fix in. And if the code gets reviewed by the right person, I get caught and then I realize that there are a lot of unwanted refactoring done.
And I am currently in the same state fixing one issue - I can add workarounds after workarounds to get the issue in, but in the longer run this would not be ideal.
i can relate to that. i recently refactored an applet i wrote in 2000. it was terrible. i didnt understand OO then and it suffered from feature creep real bad. i just did whatever i had to to get it to work. i had been wanting to refactor it for a long time so i finally did. i thought about it for a while and realized i needed a data structure(bean i think). once i had that it wasnt that hard. now the code is easy to read and i isolated the text scrolling class so i can reuse it. once you have the right idea in your mind, the hard part is done.