Overwriting new and delete
In C++, you can generally use your own stuff if you do not like what you get from the language and standard library: You can overload functions, inherit classes and specialize templates – you can change things into what you want. You do not want to overload &&, || and comma. And you almost never want to overload the global operator new and operator delete.
But I am special, so I do want to.
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 more

