TDD and To-Do Lists

May 16, 2012

As I continue to experiment with TDD, I find that I often need to make notes to myself so that I don’t forget to come back and do something later, whether it be add a corner case test, refactor some code, or add another piece of functionality that I realized I need.

It wasn’t until reading Test Driven Development: By Example by Kent Beck, wherein I saw him creating and managing a “todo” list as he worked, that I realized this is what I needed.
I started looking at free applications to do this for me and was overwhelmed by the number available. So I decided to make a list of criteria I cared about and decide whether or not I could use something out there, or if I’d want to make my own:

  • It must be unobtrusive. I don’t want any extra features or fluff getting in the way of me quickly making a note and then going straight back to coding.
  • I want to be able to keep multiple lists. This helps me keep things organized if I have to switch between tasks.
  • I want keyboard shortcut. Ideally, I’d like to be coding, then be able to alt-tab to the “todo” list app, enter a note, and alt-tab back. No mousing required!
  • I’d like to be able to send my new items to the front or back of a list at the time of creation.
  • I’d like to be able to navigate and rearrange my items. Preferably with shortcut keys!
  • I’d like to be able to mark items as complete (and undo that), and have “completed” items automatically sorted to the bottom of the list

The closest I’ve found so far, while not perfect, is Wunderlist. It does have some of the keyboard shortcuts I want, but unfortunately they don’t seem to work after alt-tabbing into the app. I have to click on it at least once first! But other than keyboard friendliness, it satisfies the rest of my desires. It’s got a pretty clean interface and doesn’t get in my way while working. It does have some extra fluff features I don’t want, but happily they don’t get in my way!

If anyone knows of an app that better matches my criteria, please drop me a line.
In the first week of our TDD study group, we were given with 4 BDD-style stories (11 scenarios total) and tasked with implementing them through TDD. I approached this by first sitting down, reading through the scenarios, and rewriting them as test descriptions (such as “I should not be able to delete a location which has items”). It wasn’t quite a 1-to-1 mapping to the scenarios, but it wasn’t far off. Each of these test descriptions became an item on my todo list.

Next, I took a minute looking at these and reordering them on my list. I ordered the smallest, easiest tests to the top, as in many cases these became the building blocks for other tests. Then I just started working my way down the list. Often those initial tests would get be broken into smaller items on my todo list. Corner cases that I thought of but which weren’t called out by the stories got added as todo items. Refactoring possibilities were listed as I thought of them. I just kept working, adding items as I thought of them and crossing them off as they were completed. At the end, looking at my expanded list of 30+ items, all crossed off, and a suite of green tests, I was able to feel confident that I had fully completed my assignment.

In the past, when I’ve done TDD without a todo list app, I typically end up either breaking out of TDD mode to handle thoughts as they come to me, or I end up completely forgetting about it. Our TDD trainer mentioned a good rule of thumb: It’s okay to interrupt yourself, but never interrupt your interruption. Well, before the todo list, I was interrupting my interruptions all the time. I’d often end up with 3 or 4 half-written tests as I thought of a corner case, started working on it, thought of another, started working on that one too, and then halfway through writing four of them at once, started doing some refactorings. Not ideal! With the todo list app, I’ve just got one interruption… writing the item in my todo list. Then I get back on track and finish my current item. Once my item is complete, I can look at my list again, re-prioritize items, and continue.

Build awesome things for fun.

Check out our current openings for your chance to make awesome things with creative, curious people.

Explore SEP Careers »

You Might Also Like