Like most developers, when I start to work on a new project I don't generally do so from scratch. I have a series of code snippets I use to do common tasks. Things which can be added to a project quickly and safely - having been tested in the fires of other projects. This helps me develop faster and more robustly - it would seem growing old has some upside. Experience counts for quite a lot in development. Having a back catalogue of problems you have experienced and solved is very useful.
However, software development is a fast moving industry and I can see a trap waiting for me. Anything I wrote previously could have been superseded by others in open source projects. Unfortunately, it is much easier to use a familiar block of code than to learn something new... This is not a problem a more junior developer faces, there is only the unfamiliar. The code produced may take longer, but it perhaps has the advantage of being more relevant. My name for this issue is developer cruft, how much of my code at any one time is a bit old and past it?
My solution to this problem is to look toward peer review, having others dig about in your code and make fun of it is a great way to get to grips with new things that you've missed. Sometimes that's not really possible, for example, in a really small team. When you are on your own, it's hard work keeping up to date. The recent explosion in JavaScript and thus JavaScript libraries, frameworks and plugins make it hard work keeping up-to-date. I find reading other people's JavaScript a great way of getting development advice from others - sure it's harder work, but its really helpful. As well as reading other code, working with other code can be a real eye opener - if a project isn't highly time pressured, consider developing in a different manner, perhaps using a new framework, it will open you up to learning and that's never a bad thing.
Don't get me wrong, code doesn't become bad simply by getting old. Sometimes the code you wrote a while back was awesome then and still rocks the show today. Sometimes it was sub-optimal then and you've learnt enough in the intervening time to recognize and fix it. Whatever you find, its important not to rely too heavily on old code you wrote when you were less experienced than you are now.
Good post. This is a topic I think about regularly...especially as I'm approaching 40! Code I wrote 3 years ago is regarded as being out of date now although it was written with future proofing in mind. Is it a young persons game?....on a good day I think no, on a bad day I think yes...
ReplyDelete