andy at hexten.net
Fri Feb 8 17:08:48 GMT 2008
On 8 Feb 2008, at 16:44, Paul Johnson wrote:
> I've never fully understood this argument. Or more accurately,
> I've never really believed it. Or even more accurately, I suppose,
> the end of the week and there's only a few minutes left before I go
> to get
> my train and I can't be bothered to start anything new so I'm going to
> write mail to londom.pm.
Yeah, it's a great sounding canard :)
> But in any case, debugging seems to me to be an integral part of
> programming. If you crank out loads of code which doesn't work
> you're not programming. If you can't understand what you just wrote,
> then why did you write it?
> Now I'm not suggesting that debugging isn't more difficult than
> code since it clearly is. I'm just suggesting that the code without
> debugging isn't much use.
Programming to 100% of your ability should mean programming /well/
(i.e. in a way that's easy to debug) rather than programming in the
most tricksy way you can. Maybe a couple of times in the last twelve
months I've written something and then thought "shit, I can't even
understand that and I just wrote it". In each case I rewrote it - even
though it worked. And then later I thanked my earlier self.
I suspect the rule was coined at a time when programming at 100% was
more likely to imply writing gnarly code that was right on the edge
(or slighly over) the limit of your ability to understand it rather
than optimising for debuggability.
> Now sometimes I find myself in the happy situation where having
> written a
> bunch of code and associated tests it all just works the first time
> I run
> it. But I still have to go back and look at it to make sure it is
> actually working rather than just appearing to be working.
Yes, that's always disconcerting...
> But even in these situations I think I have done pre-emptive
> That is, experience has taught me to approach the problem in a certain
> way. Or when I have been writing the code I have remembered to pay
> special attention to certain points because I have learnt that that is
> where bugs could easily creep in.
> Actually, I suppose I'm not really disagreeing with anything here.
> Perhaps I'm just being disagreeable. And I'm not sure I really have a
> good point to make either.
I think you do :)
> Perhaps it is just that writing code beyond the extent of your
> ability to
> debug it isn't really programming. If the code works at all it is
> presumably by luck, or because you copied it from somewhere. That's
Andy Armstrong, Hexten
More information about the london.pm