home of the madduck/ blog/ ocat/
madduck's droppings - blogs previously filed under the coding category

This page exists to ease the transition since I migrated my blog to a new software. You are interested in the posts previously filed in the “coding” category, which are listed below.

My new blog can be found at http://madduck.net/blog. Future articles, which would have been filed as “coding”, are going to show up here as well. However, please watch this space as these transitional pages may disappear at some point.

Test-driven development

Lars, I strongly suggest test-driven development. It seems to preemptively do the most relevant of what the debugging rules you quote instruct you to do later. The principles:

  1. design your interface
  2. write tests that fail
  3. write the code to make the tests stop failing
  4. refactor
  5. lather, rinse, repeat

It’s a philosophy that anticipates bugs and errors, yet it uses that very fact to guard against them.

Test-driven development has changed the way I (and many others, I learnt it while becoming a Plone developer) plan, design, think about, and implement code. And yet, it’s really not far away from how you’re already doing things. Really.

For C++ coders, I recommend libtut, which is elegant and non-intrusive.

PS: The definitive (and quite good) book on test-driven development by Kent Beck is only 200-something pages, so it’s also in the domain of shorter books.

Update: sorry, liw, for making it sound like I assumed you had spent the last years in a cocoon or cave or curled up in a corner. I didn’t intend to doubt that you know of TDD, just wanted to get that off my mind what your post put there.

And of course, I agree with you: TDD will not eliminate debugging. But it will make your debugging sessions a lot less frequent, even though the really long and painful ones are exactly those that it won’t prevent…

Posted Fri 11 Jul 2008 11:21:03 CEST Tags: ?coding
C++ is dead, long live Python

So after a long break I get to return now to my C++ neural network library which implements our neuromodulator framework to be used for learning in embodied agents. And I am now wiser by the following two facts:

Why is it that I always end up spending two or three days implementing something spiffy only to find out then that there’s some preprocessor loop or C++-braindeadness preventing me from doing what we get working in Python in a matter of hours?

Posted Fri 11 Jul 2008 11:20:57 CEST Tags: ?coding