Custom Search

Wednesday, September 21, 2011

The myth of "costs nothing"

A common argument to hear when a new feature is proposed for some program or programming language is "If you don't use it, it costs nothing." This argument is generally false, and I'm getting tired of hearing it. So I'm going to explain why it's false here where I can easily refer to it.

The first problem is that nothing is actually almost nothing. For the cost to be nothing, then the code paths would have to be identical to the code paths if the feature wasn't  in the program. If that's the case, then how does the feature get used at all? At the very least, there needs to be a test somewhere that decides whether to use the feature. That code almost certainly adds to the size of the application - even if the feature is only in a shared library, you have to load it to use the feature. Data files and the like may also get bigger.

The difference between nothing and almost nothing is more than a quantity, it's a quality. In particular, you can add arbitrarily many nothings together, and you still have nothing. But if you add enough almost nothings together, you get software bloat. This is why they call it feature creep: each feature adds almost nothing, so the bloat creeps into your application over time.

The second problem is that you are seldom the only user who gets a say in whether a feature is used. Especially in our networked era, where data is routinely shared between users of a program, and collaboration is easy. The problem is that when you're using data from some other user, they get a chance to use a feature even if you've decided not to. So you may wind up paying for that feature, or at least paying the cost of removing the use of it.  Word and document processors share documents as part of a collaboration, and often have a shared template library. Accounting software can download transactions from financial institutions. And so on.

If you're writing a program, the problem is worse, as you may wind up having to read and comprehend the language features you have decided not to use. You almost certainly use the standard libraries that come with the language, and quite often use third party libraries as well. If someone writing one of those libraries decides to use a feature, you're going to pay the cost for it. Either that, or you're going to pay the cost of forking the library to confirm to your coding standard, and of maintaining that fork. More on this in the future.

Bottom line: the problem with "if you don't use it, it costs nothing" is that you includes people that may disagree with a personal or corporate decision, and nothing is only almost nothing, which is actually something.