Code Evolution

I had an interesting brief conversation with another developer about code evolution and that got me thinking. What follows is really just some thoughts along those lines.

Wikipedia has evolution defined as:

In biology, evolution is the process of change in the inherited traits of a population of organisms from one generation to the next. It is also known as a change in a species over time.

There is an analogous concept in software development. Well written code is not static, it grows and “evolves” over time in response to changes in its environment. One could define code evolution with the following:

In software development, evolution is the process of change in the code from one iteration to the next. It is also known as a change in the code base over time.

Just as in biological evolution, new “traits” enter the system and are tested against unit tests, use cases and other influences which will eventually reveal whether the code itself is useful and will continue to exist or whether it should be refactored (evolved) or removed from the system.

Static code that does not (or cannot) participate in this kind of growth and evolution will become stagnate and malignant much like a tumor in your code base. This is not to say that all code which does not change is static and bad; however, it is code that resists necessary organic change that is truely malignant. This code is usually entered with fear and hesitation due to its brittle and change-resistant nature such that only minimal, often poorly designed (hacked), modifications are made just to fix the current issue at hand… and this only adds more layers to the tumor, moving farther away from healthy growth.

Obviously a major difference between biological evolution and code evolution is that with software there external factors to consider, usually “The Business”. “The Business” tends to enforce counter-evolutionary constraints on the system, which only serve to further entrench the problem areas in an ever-worsening feedback loop. Not all businesses allow this to happen, hence the emphasized “The Business” title; some companies are very involved in promoting good software development and stable code evolution. “The Business” in the bad sense is the entity that does not truly understand the needs of the technology and only knows results and time lines.

There is a balance that needs to be struck between “The Business” and its goals and the evolution of the code. A company needs to understand that if the code becomes truely unwieldy or cancerous, it will become more and more difficult to fix bugs and produce quality releases. Eventually it will fail/die under its own weight. Also, developers need to understand the goals of the company such that development recommendations are communicated and put into the overall release plans.

Healthy, evolutionarily sound code is to the benefit of developers and managers alike and it should be a common goal to produce the best code possible. I think clients and users would also appreciate that kind of focus and dedication.

Also, one final note… this kind of growth seems to be inherent to the agile development strategies; however, I see no reason why it could not be practiced with any other development strategy as well. It’s more a development philosophy.

No votes yet