Recycle or trash?

One of the dilemmas I run across every day is what to do with old code.  Not unlike the plastic bottles we bin at home, old code needs to be recycled.  A lot of code can be reused, what we use daily, we have built on knowledge of years past.  The problem is, that like the plastic bottles, sometimes making new code from old is inefficient as compared to starting from scratch.

With our DDA Pulse project, which is the large project I’m working on when I don’t have pressing client projects, I am trying to take a number of our projects from the past, and put them together into one project that can be pulled together using modular installations.  It would then run similarly to a number of open source projects where you can pick and choose the modules you need for your particular application.  In theory this is a great idea.  Trying to get the code together to make that happen is another matter entirely.  

Sometimes I wonder if I wouldn’t have been better off creating the code over, simply using what I know now instead of my old code which I’ve been consistently improving upon.   But the base is there, and I’ve put in some good coding standards to make development in the future better, there are just points where things still don’t work as they did before.  Now one might say ‘well, why did you change it’ and my only answer is that if I was to work with this code in the future, I would want the code to be standardized and organized, not just strung together happily working along because that was the time constraint under which it was written.

I’m also starting to believe in the theories I used to laugh at, the standard programming procedures, such as getting your requirements and building data structures, flowcharts and things prior to starting any actual code, but that’s for another day.