The Productive Programmer
In my early years of programming, I’d get into flow states and have a great time, and other times, it was an uphill battle. I didn’t know how to control this. And as we all know, success is not about bursts of energy, it’s about consistent effort. Over the years, I’ve created a framework that allows me to be my best, productive self.
It starts with three high-level categories:
- Physical & mental state
- Environment
- Working effectively
These all need to work together:
- If you’re in peak physical + mental state ✅, but have family members making a racket and interrupting you every 15min ❌, you’re not going to be very productive.
- If you’ve got the best home office setup with no distractions ✅ but you’re exhausted ❌ and approaching the work inefficiently ❌, you’re not going to be very productive.
- If you’re in peak physical + mental state ✅, in the best home office with no distractions ✅, but are watching TikTok videos in between every line of code ❌, you’re not going to be very productive.
1. Physical & mental state
Sleep. Good sleep is the foundation. For me, the right amount of sleep is however long I’d sleep without setting an alarm. Finish eating a few hours before bed, have a relaxing evening routine, a good bed, and a cool + quiet + dark bedroom. @hubermanlab and @bryan_johnson have lots of tips on how to improve sleep. If you’re tired during the day, take a nap and work a little later: a 10-30min afternoon nap is way more effective than a coffee.
Exercise. The body was meant to move. If you want to spend hours in front of a computer screen (sitting or standing), you have to earn credits. Get 15-30 minutes of walking in between your deep work blocks, and do standard strength training + cardio a couple of times a week. Don’t overexercise either.
Stretch. Not just before workouts, during the day. Yoga poses, hamstring stretches, thoracic stretches, etc. This is one of the best ways to get rid of chronic back pain.
Get a massage. Helps overall mood, relaxation, and energy. You’d be surprised how much tension you’re holding that’s negatively impacting sleep, digestion, and focus.
Eat. Hunger is a huge distraction, and the fastest way to kill your energy. Eat healthy meals every few hours, have healthy snacks in between focus blocks, and listen to your body. I start most days with a fresh juice, some fruit, and then 2 eggs + sourdough + avocado about 15min later. Whatever you eat, you should feel satisfied afterwards and it should sustain you without eating again for a few hours. I’m more focused after a hearty breakfast like eggs + toast than a light breakfast like muesli + yoghurt. Don’t under or overeat.
Drink. Make sure you’re properly hydrated. I keep a full glass on my desk and drink as I need to. Sparkling and a slice of lime/lemon/cucumber is nice too.
Deal with loose threads. Whatever is going on in your your life affects your mental state at work. That class you want to book, that call you need to make—get it done on the weekend or before work so it’s not nagging you when you need to focus.
Schedule downtime. Your brain and body need breaks from programming and screens. Instead of doomscrolling during your commute, try staring out the window and let your mind wander. On a weekend, go play sport with friends, go for a long walk, go to a café and read—do whatever fills your cup. This is critical so you are recharged when you go back to work.
See a chiro/physio/health practitioner if you need. If you get pain that distracts you, this is worth looking into. ABC chiropractic adjustment has helped my back issues.
Take care of your eyes. Look into the distance periodically. Blink enough. Make sure your monitor is the right distance away. Ensure good lighting / screen brightness, and make sure all font sizes are large enough that the text is easy to read. Avoid irritants in the air like smoke. Important: If your eyes are tired/sore/a bit blurry, take a break! A warm/cold wet face towel can refresh them too.
2. Environment
Desk, chair, monitor. Get good ones. I used to think I couldn’t be productive working from home. Turns out, the issue was using a laptop on cheap couches. (Fastest way to get back pain!) Get a standing desk so you can vary it up. Make sure the height of the chair, desk, and monitor are comfortable.
Quiet. I love this post from @paulg:
The rich love quiet because they’re trying to work. https://t.co/7HfJq1Rzkx
— Paul Graham (@paulg) June 15, 2024
It’s so much easier to think clearly in a quiet environment. No wonder devs love working late at night. Music can be good sometimes, but I find total silence is best for high-focus tasks. If you have a noisy environment at home and at work, try working at a quiet library without headphones and see how much easier it is to focus.
Comfortable temperature.
Lee Kuan Yew, founder of modern Singapore, once said:
Air conditioning was a most important invention for us, perhaps one of the signal inventions of history. It changed the nature of civilization by making development possible in the tropics. Without air conditioning you can work only in the cool early-morning hours or at dusk. The first thing I did upon becoming prime minister was to install air conditioners in buildings where the civil service worked. This was key to public efficiency.
Even in more favourable climates, being too hot or cold is a major distraction, so make sure you’re comfortable.
Fresh air. This directly impacts brain function and general health. Make sure you’re not in a stuffy room and have some airflow.
Nature. Having somewhere pleasant to look out at and where you can go for a walk/run makes a real difference.
Good lighting. Poor lighting makes you want to escape. You should want to be where you’re working.
Interruptions. Whether in person or online, disruptions are toxic for your productivity. I often turn on Do Not Disturb and simply ignore Slack/Teams/email while I’m in a focus block. Going to the bathroom is also an interruption, so make sure you go before you begin a focus block. 🙂
Time. Fairly basic, but you need enough uninterrupted time in front of the screen. You can’t complete a 2h deep work task if you have a meeting in 30min.
3. Working effectively
Schedule tasks based on energy and duration.
- 2h feature task or complex bug: best when no meetings and lots of energy, like after a meal or workout.
- 15min copy change or simple bug: do this in between meetings or at the end of a long day.
Second time should always be faster. Build out mock data for all the common scenarios in your app. Save Jira/Figma links to your bookmarks bar. Fix ambiguous error messages. It’s not just about saving time, you also want to reduce your future cognitive load. The more you streamline, the more you’ll find yourself smiling saying “I’m glad past me did that”.
Pull the thread, if you have time. I discovered a bug in Preact by digging deeper when I saw a DOM attribute was camelCase that I thought should be snake-case. Investigating unusual behaviour strengthens your codebase/personal knowledge and saves time later. Sometimes you have a deadline to hit though, so in these situations, make a note of it and then work around the issue.
Write a plan of attack. Think like an AI agent. Before you begin a task, write down what exactly you need to do, how you’re planning on doing it, and how long you think it will take.
Do personal retrospectives. Did you complete a task in the time you estimated? What assumptions turned out inaccurate? How can you prevent these mistakes / improve in future?
Have multiple things on the go. While you need to focus on one task at at time, sometimes you’ll need to wait on a build, a person, or some other dependency, so it helps to have something useful that you can quickly jump across to. Switching tasks can also give you variety if you’re in a rut.
Conclusion
You won’t get all of these right every day—nobody does. But awareness is the first step. Once you know what’s working against you, you can start fixing it. Over time, the good days stop being lucky accidents, you can bounce back faster from bad days, and you can focus on doing your best work without anything holding you back.
Have I missed anything? Let me know on X or send me an email at steve@steveharrison.dev.