A tiny productivity tip: When working on something, you often think of new things to do. While changing some code, you might notice a bug that needs fixing or some code that needs refactoring. Write it down and do it later, don't do it at once.

If you do it at once, you will have to interrupt whatever you were doing, do a context switch, do the new thing, and then do another context switch to get back. Context switches are expensive in terms of concentration and time.

A stack of contexts becomes a big problem because you'll likely find yet new things while doing the new thing, eventually growing the stack quite large. This is not the way to get things done efficiently, or at all.

Another example: when researching something on the web, it is easy to get lost in a huge web of web pages you need to read. Don't interrupt reading one when you hit on a new page you'll need to read. Open the new page in a new tab, or put it in your bookmarks for later reading.

Of course, sometimes you do need to fix the problem you found, because it prevents you from continuing the first thing. Do what you must, but no more.