He demoed a quick addition to a small TODO list app. Using outside-in TDD (test driven development).
Outside-in? Just start at the outside (functional test that hits the TODO page). You try to click a not-yet-existing link. You add the link with a dummy url. You adjust the test. And so on.
And slowly you dive into more detail. And slowly you get to write more detailed tests. And slowly you descent from the functional test level to the unit test level.
A funny term for this is “programming with wishful thinking”. “I wished I had a list of TODO items”. So then you first mock it and then build it for real. “I wished I had a nice ‘List’ object”. Repeat.
He did the same thing with more unittests and mocking. But mocks aren’t fun and dirty. So he started cleaning up his code to get rid of the mocks. In the end, the code was cleaner and clearer than with his first effort.
Use unittests to force yourself to think about your code. This way your code will be better.
Main “vallée de la Doller” French railway station Burnhaupt in 2007.
My name is Reinout van Rees and I work a lot with Python (programming language) and Django (website framework). I live in The Netherlands and I'm happily married to Annie van Rees-Kooiman.
Most of my website content is in my weblog. You can keep up to date by subscribing to the automatic feeds (for instance with Google reader):