There are moments during development where you realize some things are not that easy, here is a result I achieved experimenting with rectilinear connection editing earlier today 🙂
Here is what I really wanted to do:
It is clear that it is a good idea to create a test suite for something as complex as rectilinear editing. When it comes to an interactive application, you often reach the limits of test-driven development. In particular, how do you express the tests about how an interaction should work, if you can’t imagine it ?
Therefore, if I want to design an interaction, I usually do “explore-first”, which means to write tracer code, like in the above example. It helps me to explore how to write the code and/or the tests when I have absolutely no idea. It is not a prototype in the strictest sense, since the code has production quality (or what I consider to be production quality) from the beginning. I just can’t write prototypical code, which for me is a good thing, because once I have fleshed out the functionality, I am practically finished.
This is also an example that even though the general advice is to tackle the hardest problems first, that this is not always possible. In this case, I needed to have the basic abstractions available and get the understanding about them in order to design the feature in this context. Often the understanding of the system in development has to grow before more difficult tasks can be executed.
Even though I could probably hack it in until tomorrow, I would not be happy without the tests in place. I take a rather liberal approach to unit testing, but in this case, I insist to have a test suite. So I will need to push my release date to next Monday. I am sure that these additional four days will result in higher quality.