Jan 14, 2010
What, who, how, why code
Recently I realized what is missing from programming languages. What, why and who.
All we have is how. When you fire up an IDE or open a file in a text editor all you get lots of how.
Stuff like.
If(camera.isavailable == true)
{
camera.snapShot();
}
You have to figure out the what from the how. You read that and you realize that there is some object called camera and that it has a property that says if it’s currently available and that if it is that it should execute its snapShot(); method. None of that explicitly tells you what the person who wrote the code was trying to do, you have to guess.
Why does he want to take a snap shot? you would have to read a lot of code to know for sure and in some cases you might not be able to tell even if you read all the code in the whole app.
Why is even worse. There are lots of times that I have been left wondering why a developer tried to do something In a particular way. Often that cost me and the projects I was working on lots of time.
Who is in most cases non existent. Ok a good IDE usually puts the name of the developer at the top of the file but if you have just been sent a load of code you have no idea who John doe was, where he worked what he was doing on the project.
So all of this is left to documentation and we all know how often that is inaccurate or simply not available.
Isn’t it time we developed a language that had who when how what and why as an integral part of the code? Time for a language that is truly self documenting.