I recently read a post from J.P. Hamilton where he admits that he sometimes writes bad code. I quote:
That’s a brave admission in our industry, but I am willing to bet that even the best of best write bad code now and then.
I would go even further than that. Any developer who claims he never writes bad code is either lying, ignorant or living in a fantasy world. The thing is, as J.P. points out, is that good developers will try to minimize the amount of bad code that they write, and when they do, that they try to get rid of it as soon as they can. But if those developers are so good, then why do they occasionally write bad code in the first place?
Building software takes resources and requires dealing with constraints. With resources i mean more than just the number of developers that are available to work on a project. Software libraries are resources. Tools are resources. A lot of things can be resources or constraints (sometimes they can be both simultaneously). And obviously, each resource has a certain level of quality, which can have a positive or a negative effect (which enables these resources to also become constraints).
The cumulative effect of all of these resources and constraints means that you sometimes need to make compromises. One of those compromises can be that a good developer comes to the realization that for whatever reason, he (apologies to my 2 female readers: it's not easy to refer to developers in a gender-neutral way all the time
) needs to write bad code to make a problem go away. Code that is not up to his usual standards and that he is not proud of.
This is usually referred to as incurring some technical debt. Nobody likes to incur debt, but sometimes you just can't avoid it. If incurring some debt enables you to start creating value sooner rather than later, then it might actually be a good idea to do so, provided that you have the means to pay back the debt later on at a reasonable cost. You definitely should strive to keep that debt as low as you can (or even eliminate it entirely) because if you don't pay off the debt, you're definitely going to regret it sooner or later.
I honestly have a lot more respect for developers who can identify the need to occasionally write a bit of bad code instead of foolishly clinging to a dogmatic "i shan't write bad code, no matter what the circumstances" stance. Well, as long as they remember to pay off their debts as much as possible, and that they do strive to write clean code as much as possible ![]()
Pingback: Acai Berry Select reviews