RSS Feed

December, 2008

  1. The entropy of code

    December 23, 2008 by max

    Physics deals with an interesting concept called a href=””entropy/a that measures the state of disorder in a closed system. a href=””The second law of thermodynamics/a looselly states that over time a closed system will become more disorderly and chaotic if nothing is done to prevent it. If you haven’t been to your basement for a while you can go down there and see for yourself that this is true: Things have become more disorderly and chaotic over time. And you will have to put in some work to get things back in /br /Code is the same – if you don’t do something to actively prevent it the chaos and disorder of your code will increase when you work on it. This is why a lot of old code is a mess, nobody has worked actively to keep the entropy /br /Preventing entropy in your code is fairly easy, and it’s a good habit to get into. Whenever you write new code for a project make sure you lower the total entropy of the system by beautifying or simplifying something in the codebase. It doesn’t have to be the code you’ve just been working on – the key is to lower the entropy of the whole /br /If you work actively to keep the entropy of your code low it age gracefully.