I am easily distracted. Two things tend to distract me and boom its 3 hours later... I've wasted half the day.
This happens a lot when I'm coding. While I'm adding one feature I think of 3-4 others that would be great to have. They aren't as high priority, and if I start down the road of implementing one, it could be hours before I'm done. For example a CGI script I'm working on has a "test mode" that makes the program act differently: writes to the test database (not the live one) and emails that get generated go to me (not the real users). It dawned on me that I should put a message on the web page that warns people when they are writing to the test database. The URL will be different (projectname-test instead of projectname) but wouldn't a pretty red message saying, "Test mode" be great? It should be easy, but soon I've discovered the test mode variable doesn't get propagated to the part of the code that generates HTML; so I'm figuring out the best way to pass that info to the HTML generator, I'm writing unit tests, etc. Three hours I wish I had back.
This happens in non-coding situations too. I think to myself, "I better do this now, because if I don't I'll forget to do it later." For example, writing my next blog post. An hour later, I realize this little thing isn't so little.
The tool I use to prevent this kid of thing happening to me is my "Not To Do List". I've written plenty about the importance of keeping a written TO-DO list. Well these distractions are things I add to my "Not To Do List". This is the list of things that I certainly don't want to forget about, but they are very low priority.
For software features, I write them up as simple bugs in our bug tracking system. For other ideas I have a category on my Todo list system called "would-be-nice".
In both cases I have to force myself to resist the temptation to do these things now. Some of the lies my brain comes up with include "I'm already editing the source code to that file, creating a bug involves opening a new window, logging in, etc. etc. I'll just add it now" or "I might as well do it since I thought of it now and I have the context".
How do I deal with the next-ending list of things I add to this list?
I've noticed that ideas always seem awesome when you think of them. If you write it down and come back to it, that's when reality sets in and you realize you don't need to do the task.
Studies have found that the act of writing something down releases the same brain-satisfying chemicals as achieving the goal. So by writing down the distraction, your brain feels like it has achieved it. Thus is really is easier to cross off your list when you come back to it.
If I've filed the ideas as a bug, then there is usually some bug review process where it gets rejected. Or, by being asked to explain the feature request out loud I realize how unworthy it is of my time, so it is easy to close the issue "wontfix".
In the past I've talked about my "2 minute rule". That is, if something is going to take less than 2 minutes to do, do it now rather that write it down, come back to it, and regain context. However, I have to remind myself that there are no software features I can add that take less than 2 minutes, and that truly brilliant ideas take more than 2 minutes to implement... always.
Since I've developed this technique the only problem has been sticking to it. To make that easier I've gone as far as to always keep a window open to our bug tracking system and to put my phone (which is where I keep my personal list) on my desk as I read email. Both of these help me stick to using my not-to-do-list.