Thursday, May 3, 2012

Code aging:Can a computer program age?

Aging is a life phenomenon. A life always age from birth to the day it ends. A computer program also dies; we in software industry like to replace a piece of code with completely a new one. We do it by rewriting the software. Here is what happens for software:

Birth: We write the software with a purpose.

Growth: We find some bugs in the behavior of the software; we fix the bug. We do it again and again.
One fine day we feel the software is bulky to fix bugs or the purpose has grown to such an extent that we need to rewrite the software.

Death: We rewrite the software and replace the old one with the new.

How a code age? Here is how it happens (IMHO):

Software gets fat by added code all the time. We add code to fix bugs, to add feature etc.
Code becomes complex. As in life, with time, code also becomes complex by code complexity (like if –else –then). It so happens, that code becomes complex by overloaded methods, multiple entry points, more than one way to do one thing, etc. With time it becomes hard for the developer to understand the code.

The code can also age due to library it uses has aged and being replaced with newer one. Even the programming language may have morphed. Like in case of Java, concurrency, generics, etc. are making some code look old.

The other indicator of old code is its interfaces and deprecation. If an interface is filled with same methods with just parameter or return type mismatch (overloads), I suspect the code has aged.

That’s all that I can think. If you know any others please share.

No comments: