When I’m not interrupted, I can code effectively for 20 to 30 minutes. However, constant notifications from instant messaging, emails, and meetings disrupt my concentration and make it challenging to finish tasks on time.
I once read an analogy that relates to this situation, stating that just like the value of money remains the same whether you have a $100 bill or in coins, the overall time remains constant even if you have small intervals.
How do I overcome this?
Most people will tell you to mute everything and they will not be wrong. HOWEVER managing your focus is a skill that might help you immensely and since you are motivated to work on, it I’d say give it a shot :)
For example, we often embark on long chains of thought, trying to understand some complex behavior. These greatly exceed our working memory, you can think of them as living in our brains’ volatile memory and will completely vanish once we are interrupted. In a sense, during this type of reasoning, we have been running heuristics but haven’t thought of anything “solid” yet.
You can try approaching problems in a way that could help you regain focus fast. For instance, trying to break down your reasoning in small logical chunks, or trying to extract intermediate conclusions as you process the problem. This can not only help you with your focus but also improve your problem solving skills in general, as you will be working in a more structured framework.