Try ending today with a failing test for a great start tomorrow
Nick Holden Jan 15 Updated on Mar 10, 2018
Tying up loose ends at the end of the day feels nice. Completing a task, committing my work, and shutting my laptop leaves me with a satisfying sense of accomplishment that sticks with me through the evening. And on those days when I grapple with a problem for a while and don’t come to any resolution, I can feel a little defeated.
While it’s nice to watch my test suite pass and call it a day, I’ve found that some of my most productive mornings come when I’ve left myself a failing test the night before.
Mornings are a great time to get caught up and plan. But it can be challenging to transition from organizing and digesting to opening a text editor and getting into a flow state. When I get some momentum working on a tricky problem later in the day, I want to bottle it up for morning. I can get close with one failing test.
Starting with a failing test means I know exactly what to work on: making it pass. Compared to an item on a to-do list, a failing test is better at returning my mind to the state it was in when I was focused deeply on the task. Maybe I even spent a bit of time the night before thinking about how I might approach it, so the implementation is a quick win.
It doesn’t work all the time. Sometimes, priorities change overnight, and I have to put the test aside and focus on something else. But often, I find that a little time spent writing a failing test at the end of the day lays the foundation for a great morning.