07 December 2010

Old and New

This is an unusual post—imprecise, written late in the night, with no apparent purpose, and no apparent question. As I said, it is unusual. Not for the web, but for this blog.

All else being equal, and sometimes even when all things are not equal, some prefer old over new and others prefer new over old. Suppose you may choose between reusing a piece of code and writing it yourself. Suppose further that you have no objective reason to believe one option is better than the other. It is not clear that reusing old code will ensure you will have fewer bugs to fix in the future, since, obviously, you are an awesome programmer. (After all, you are reading this blog and recommending it to others. Nah. Forget that. I'm drunk. Really.) Back to the subject: You are awesome. I'd like to meet you. No. That was not the subject. Oh, right! So it's not clear that the old code you may reuse has very few bugs. There is also no obvious reason why you should be able to write more efficient code. That may be the case if your problem is a specialization of a general problem solved by the existing code. But that is not the case. Your problem is just as general as the existing library was designed to handle. But, wait! The library is there. Surely it must be quicker to just use it? No, it is not clear. Apparently you must coerce your build system through some hoops in order to accommodate the existing code. And you do need to write a "little" glue code. Just how little is "little" is hard to say. In short, as I said, you really have no idea of what would be better: to reuse or to write from scratch?

Yet, in spite of all I wrote above, I bet you know what is the right thing to do. You feel like telling me, like it is obvious. However, I am willing to bet that all your arguments have a counterfactual or philosophical flavor. Depending on who you are, you may feel like telling me that reusing code is the right thing to do, because it surely cannot be right for humans to keep reinventing wheels. We need to focus on the new stuff, right? "No. No. No." yells the other reader. It is much better to write the code yourself. In the long run, your purpose is to become a better programmer, and not writing the code yourself means giving up a great learning experience.

The point is that most people either prefer the old, or prefer the new—very few are indifferent. I happen to be in the former camp, but this is beside the point. I wonder if psychologists know what I am talking about.

No comments:

Post a Comment

Note: (1) You need to have third-party cookies enabled in order to comment on Blogger. (2) Better to copy your comment before hitting publish/preview. Blogger sometimes eats comments on the first try, but the second works. Crazy Blogger.