Geeks With Blogs

News
Shelfari: Book reviews on your book blog

.net alternatives by Michel Grootjans

I recently realized the many parallels you can draw between the theory of evolution and evolving software.

Evolution is not the proverbial million monkeys typing on a million typewriters, where one of them comes up with the complete works of Shakespeare. We would have noticed by now, since the proverbial monkeys are now blogging on the Internet ;-)

One of the main ideas of the theory of evolution is the balance between random mutations and natural selection. Random mutations happen all the time: millions of mutations over millions of years. Most of them are totally useless. Some of them are beneficial to the evolved species. Natural selection favors the beneficially mutated species. Less beneficial mutations die off. The mutated rabbit doesn't have to be faster than the fox. It just has to be faster than the other rabbits.

 

Theory of evolution Evolving software
Random mutations happen all the time. Most of these mutations are so bad, the new species dies off, or cannot reproduce. Developers write new code all the time. New ideas come up during the act of writing software. The really bad ones don't get past the stage of idea. The bad ones don't get committed to source control.
Natural selection favors the beneficial mutated species Good ideas and new code gets discussed in group during informal peer review. Less than good code gets refactored. Enhanced code makes it more readable, maintainable...
A good set of traits makes the species superior to others. It becomes widespread A good design tends to make it easier to add new features, easier to understand the current implementations, easier to optimize for performance...thus superior.
The best designs get carried over from project to project. They appear in blogs, articles and books about principles, patterns and practices.

 

Of course the act of writing software is deliberate. This can hardly be called random mutations. Though it sometimes might seem that code evolves through a will of its own ;-)

Does this mean that evolving software (evolution) is better than a big design up front (creationism)? Not necessarily. It's a false idea to think that a project starts from scratch and everything evolves from there. Everyone carries his experience of what works and what doesn't. Up front design is necessary, but is best kept simple and minimal, just enough to get you started. Let the good experiences and ideas help to drive the process, whether they come from you or from others, from past experience or from the most junior developer on your team.

Once again, balance is the keyword. Balance design up front with evolution on a daily basis. How do you know what balance is right? Through your own experience of what worked and what didn't (here's evolution again).

Notes:

The evolution of software can quickly degenerate without discipline. TDD is a discipline that leaves little to chance on that part. Write your test to describe the new behavior. Write just enough code to make it behave as specified. Refactor to evolve the code to a higher standard.

The responsibility of good design rests continuously on each developers' shoulders. Promiscuous pair programming helps quickly spreading the design to the whole team.

Posted on Tuesday, May 11, 2010 9:59 PM design | Back to top


Comments on this post: The theory of evolution applied to software

# re: The theory of evolution applied to software
Requesting Gravatar...
What you describe is known as MEME http://en.wikipedia.org/wiki/Meme

A meme (pronounced /ˈmiːm/) is a unit of cultural ideas, symbols or practices, which can be transmitted from one mind to another through writing, speech, gestures, rituals or other imitable phenomena. (The etymology of the term relates to the Greek word μιμητισμός (/mɪmetɪsmos/) for "something imitated".) Supporters of the concept regard memes as cultural analogues to genes, in that they self-replicate and respond to selective pressures.
Left by Mikhail on Sep 30, 2010 8:41 PM

# re: The theory of evolution applied to software
Requesting Gravatar...
I guess that would be right. Nice comment, thx.
Left by Michel Grootjans on Sep 30, 2010 10:15 PM

Your comment:
 (will show your gravatar)


Copyright © Michel Grootjans | Powered by: GeeksWithBlogs.net