Reflecting back on the rather crude bit of programming I was working on for the last hour or so at work this afternoon, I was wondering if I could have approached the problem at hand in a smarter way. If I rephrase the question as whether I can approach the problem better, the answer is undoubtedly yes. Even before I had cycled out of the car park, I had a couple of improved strategies taking shape in my mind and perhaps I’ll try one of them tomorrow. However, could I have made a better start? I’m not so sure about that.
One of the reasons I needed to wrestle with the problem was that I needed to understand the data and develop an idea of how the results should look. I’ve sent the initial output back to the person I was providing programming support for and it is possible that it will meet all her needs. However, we are both involved in creating something that goes beyond what we have done before. Hopefully I’m travelling in the right direction but I suspect there is a bit further to go before I can claim a goal.
If I had waited until I had a clear plan before starting to code, I might still be sitting there. That isn’t to decry the value of planning, nor to suggest that ugly code will reach all the way to a good solution, but now I’ve got my hands dirty (and without spending too long about it) I am now in a much better position to review the results and work smarter tomorrow.