Skip to content

Posts tagged ‘readability’

9
Oct

While or For? A Comment On Code Entropy

I just saw Olve Maudal‘s talk from JavaZone 2011. The topic for the talk is Code Entropy and the Physics of Software. (Note: The talk is in Norwegian.) In the talk, Olve discusses how likely two semantically identical pieces of code are to be changed into each other. For example, say you have the following snippet:

if (!isValid()) {
    // Handle the invalid state
} else {
    // Handle the valid state
}

How likely is that to change into this one:

if (isValid()) {
    // Handle the valid state
} else {
    // Handle the invalid state
}

… and vice versa? Olve defines that the higher probability a piece of code has to change into a semantically identical piece of code, the higher its entropy is. In this post I will share a couple of thoughts about this. Read moreRead more

Switch to our mobile site