I don’t use SciPy (a science/maths programming library), or indeed Python much at all, but I can closely relate to the experience of the author of this post.
Especially these quotes:
The bottleneck in writing code isn’t in the writing of the code, it’s in understanding and conceptualising what needs to be done. Once you’ve done that, i.e. come up with mathematical objects and equations that describe your algorithm, you simply express these in a few lines [..] and hit go.
[..] you spend months developing your complex algorithms and when you’re done you show somebody the result of all your efforts — a page or two of code. It looks like something that somebody could have written in an afternoon. Even worse, you start to suspect that if you had really known [..] and spent a few days carefully thinking about the problem to start with, then you probably could have coded it in an afternoon.
He’s talking about generating financial algorithms but I feel the same way about many things I’ve done. So many times I’ve written reams of code, fleshing out the way I think something should be, only to later realise I could generalise much of it and in the process shedding hundreds of lines and days/weeks of work. I just don’t know what I want until I see it expressed in front of me, and until I know what the product should be, I can’t generalise. It’s as if the process of coding is analogous to analysing a number series – it’s only when one has enough points of data, say 5 or 10, that one can guess at the equation that generated it. In my case, it’s only when I’ve implemented the same damn thing with minor changes 5 times in a row that I finally see the pattern and am able to collapse it down into an abstracted general form.
And then days, weeks, months, later, when one inspects the results of one’s labours, one’s greeted with a couple thousand lines of code, if that, with probably only a few hundred lines of actual “live” structural code. It does indeed look like something you could have bashed out in an afternoon if you’d really tried. And no doubt I could type it all again in a few hours. The trick is knowing what to type ..
November 17th, 2009 at 3:07 am
I’ve noticed a similar pattern around the process of simplifying code and UIs. Lets say a product has functions A, B, C and D. The code and UI for the first one or two functions is easy to code and keep simple. But after a while, the code, the layout and sometimes even the key objects displayed become too busy and complicated to understand. Now sure you can model these things before building them but modeling and using the real thing are different, and of course the code itself hasn’t been written yet.