Few things are more distracting than avoidable errors. While fixing errors is a good thing, having to fix them takes you down less productive paths. So spending time in areas that could help recover more quickly from errors or prevent errors entirely is usually well spent.

As we’ve looked at in previous chapters, lack of sleep, overwork, increased anxiety, and rushed deadlines all lead to an increase in mistakes. Those errors need time to correct which further shortens the available time to complete work. It’s a vicious cycle, and it hurts our ability to focus because we become more reactive than proactive. All of this increases anxiety and chronic stress making it even more difficult to maintain focus.

And fixing a bug after the fact often takes more time and is more likely to introduce new bugs as a result because we don’t have all of the same information and context loaded into our head. Bugs that make it to production also cost some additional time via support. So we have to spend even more time digging into the bug and then risk introducing new bugs. It’s a downward spiral that’s hard to break out of.

Of course, avoiding unforced errors is easier said than done. What qualifies as an unforced error? There’s not a clear cut definition, but if overwork, lack of sleep, and similar related problems are leading to an increase in mistakes, it doesn’t have to be that way. If working an extra couple of hours each day only adds a couple of exhausted and error-prone hours of work, it’s counter-productive. It might look good on a timecard, but that’s where it ends.

Take your time to do it right

The best way to reduce errors is to slow down. When you rush and things are piling on, your brain goes into reaction mode. You spend less time thinking things through and more time making mistakes. This is just human nature. With unreasonable deadlines or stressed out team members multi-tasking, errors beget errors. Teams are forced to cut corners and create technical debt that becomes incredibly expensive to pay off. Things like code reviews and documentation get cut or don’t get developer’s full attention. The problems compound quickly after that point.

When you slow down, you’re able to plan better and write better code. Few things can help prevent errors like better code. When you document your code and interfaces and add explanatory comments, you help anyone working with that code from making a mistake. And, when there is a mistake, the surrounding documentation and automated tests make it significantly faster to correct.

Don’t ruin your weekends

On a similar note to slowing down, it should go without saying, but you never want to release the day before time off. Whether it’s a weekend, a week-long vacation, or just a day off, it’s never worth it. When you have time off, it’s imperative to use that time to recharge. Having to work unexpectedly because some new code broke something is never a good thing, and cutting into your recovery time is even worse.

If it’s a significant problem that requires working through a weekend or vacation, you end up working through a much longer period with no break. Regardless, your brain ends up not getting the downtime it needs to recover so you can be at full strength. Without that recovery time, you’re stuck in a reactive mode, and it’s incredibly difficult to work your way out of that mode.

Level up your debugging

Of course, errors aren’t entirely unavoidable. But you can always mitigate the amount of time lost to fixing errors by investing in debugging skills. That can take many forms. You could use a robust exception handling framework that enables you to both get alerted to issues faster and track down the cause of problems with less effort. Tools like Honeybadger and Sentry can work wonders when debugging exceptions. Or you can increase the automated test coverage. The sooner you’re alerted to them and the faster you can fix them, the sooner you can get back to your primary work.

The only thing worse than time lost to an unforced error is time lost because you’re not able to efficiently correct the mistake. Dedicate time to learn about the debugging tools available in your language or framework of choice. If you can short-circuit the time between becoming aware of a bug and discovering the root cause, you just freed up time that can be put to better use.

Bugs and mistakes are never any fun, but we can take steps to reduce their impact. Given that they’re an inevitable part of creating software, we instead need to work to ensure that the impact on our focus is minimized. Ensure that they’re found early and that the system is designed to help troubleshoot and correct quickly through code reviews, automated testing, and robust exception handling.

Your next steps

  1. Invest in robust exception handling.
  2. Learn the debugging tools for your language of choice.
  3. Take care to ensure that problems don’t interrupt your downtime like vacation.