Time management is a subject near and dear to my heart. I got my start as a developer in a support role where we had to be reactive and give into whatever was demanding our attention at the time (I literally had to monitor an error queue and manually intervene whenever something didn't process correctly). It was a nightmare.
After moving from that role into a more development focused one, distractions still persisted. Emails needing to be answered, back and forth design meetings with other teams because the system we were building off of was older than any of the devs in the meeting, people popping by my desk to ask questions. Over time I realized that if I were to get any work done that was deep and meaningful I would have to manage my time better.
Here are four strategies I've tried and had success with for managing my time.
A good start to managing time is to assert more control over where your time is being spent.
An exercise I like to do is plan out my day via time blocks, Cal Newport, the Author of Deep Work, and my inspiration for this strategy, wrote an excellent post about time blocking.
What I do is divide my time into blocks based on how long I think a task is going to take. If I complete the task faster than my estimated completion time, I update that block with the time I finished the task, then proceed to the next task.
If something demands my attention that I can't ignore, then I pencil in the start time, focusing in on that task until it's completed, then move back to the task I was previously working on. Even if the work is reactive, it's important to take charge of the time spent on it. Don't let reactivity spend your time for you.
This might sound tedious, but at the end of it you have a detailed picture of where your time is being spent, and armed with that knowledge you can start to strategize ways of eliminating certain activities that don't contribute to your overall goals.
I'm not saying become a productivity hermit where you find a hole to hide in and stay there until you've completed your work.
But consider the amount of time you've passively allowed yourself to be contacted. Email, Slack/Teams/Discord/etc., phone, all of these can become time sucks.
When I have to zone in a focus on something for an extended period of time. I close my IM client, email, and anything else that could sap my attention. Sometimes I find another desk in the office to sit at, believe it or not the change of scenery can help a lot!
And it's not this way all the time. As someone who leads a development team, it's a job duty of mine to be available to assist other members of the team. I try to set aside time for myself to be available to help, but when I don't need to, my email and IM clients are muted and I'm focused in on the task at hand.
Nothing good comes out of being at work for 12 hours trying to understand some esoteric log message that you had to obtain by debugging COBOL that could have graduated high school before you were born.
Go home. People tend to have times of the day where they work most optimally. If it's at 9pm then more power to you, but don't burn yourself out trying to push through to a successful conclusion, most things can wait until tomorrow.
Most of us work in an environment full of distractions, people coming to your desk to ask questions, apps ding-donging at you, meeting invites from people who sometimes-maybe-might think you need to be there to listen or correct someone or ask questions, or even worse, a meeting to schedule more meetings.
Knowing what to cut out / prioritize goals is an invaluable skill. Besides time blocking, I use Todoist to prioritize and schedule certain goals and reminders. You can create projects to assign tasks under as well as nest tasks together if you need to group them. I find it incredibly helpful for keeping things organized.
In the end. Time management isn't a easy thing to get perfect the first time you try it. It takes a lot of discipline and assertiveness in order to get a good groove going. Just being cognizant of where your time is being spent is the first major step to managing your time better!