Evolution and software engineering

I came across this (slightly NSFW) post shared by Roshan on Facebook and started wondering about how evolution does not have foresight and cannot see forward nor can it go back and re-design things from scratch. I also remembered this (NSFW for gore) video of the autopsy of a giraffe where they trace the path of the laryngeal nerve from the brain to the throat which goes all the way down to the heart and back. Notice how many times Richard Dawkins uses the word `legacy` in the video. That made me realize how similar evolution is to programming on large software projects. So much of programming on large projects involves building on top of code that already exists and that involves, many a times, writing patchwork code that keeps adding on top of things so as to not break legacy support. Now, nature does not need to do maintenance and provide user-support unlike software engineers. After a point, doing this kind of patchwork starts to get unmaintainable. No wonder programmers are so eager to throw everything away and start from scratch most of the times.