Monday, March 10, 2008

Reinventing the wheel

It’ something you get told all the time when you’re writing code – ‘Don’t re-invent the wheel.’


It’s usually in response to the fact that innovation takes time and effort. While it may be true that using tried and tested code can save time and effort, it does not advance anything. And if you’re not advancing you’re going backwards.


I used to get told this all the time, ‘just download something off the net’, usually by people who didn’t understand coding, innovation or the cost involved in trying to shoe-horn someone else’s code in your application. Not to mention the ongoing support and security issues.


It has to be said however there are limits. I mean if you innovated every time you did something you’d probably never complete anything. There is certainly a place for using what others have done before if it will make your life easier, but it’s never as good as getting the old grey matter working away at doing it better yourself.


I use code, frameworks etc all the time, and I re-use stuff I have written previously as much as possible. But I’m always thinking of better ways of getting the job done.


A good example of that it what happened today –


I was working on a web-form template. This template is designed to be able to take just about anything you want to throw at it and it will build a cohesive form for you.


So far so good.


Last week I had it all going well, it was doing just what I wanted it to and I was quite happy with it. But then today I was adding a select box control that had to be coded differently from the other controls (text, checkboxes etc), and I looked at a different way of doing it.


I figured out a way that worked really well and then it occurred to me my other controls could be coded this way and it would be heaps better. (It solved a problem I had with multiple controls with the same name accessing the database).


So I spent the afternoon re-coding my code from last week to reflect the evolution of the select box control.


I ended up with a form that is much more robust and flexible.


So if you have to opportunity to innovate, don’t waste it, get in and see if you can come up with a better way. You’ll b glad you did if it works out. And f you don’t, the mental exercise is always good :-)

No comments: