niloy / blog

blog raw files
3 stars 1 forks source link

Cleanliness is next to Godliness #11

Open niloy opened 11 years ago

niloy commented 11 years ago

Cleanliness is next to Godliness

We all have known this proverb since childhood but only recently I kinda understand its true meaning... at least thats what I think so. I always took this proverb literally, as in, a neat and clean environment and place. But it turns out, "cleanliness" can have meanings at multiple levels... the physical, spiritual.... and the software.

So we often hear we Indians being accused of hypocrisy when it comes to cleanliness. As in, we dont bother to keep our country clean, but when we travel abroad, we suddenly transform into highly cleanliness conscious people. While, this maybe true, but its not hypocrisy. The thing is, when you are standing in a place surrounded by litter all around, there is no motivation at all to carry that empty can in your hand till you find a dustbin. The good thing is, the reverse is also true. A person who usually doesnt care about keeping environment clean will also start caring about it since he would feel very, very guilty of littering a clean place. The point is... cleanliness promotes more cleanliness.

But the reason I am talking about cleanliness here is its amazing resemblance to software. If you have a code base that reeks of hacks and patches, its a very bad code base that smells at every corner. Since the code base is so bad, even good programmers who take pride in writing clean code will start writing bad code. Simply because the surrounding code is so bad, there is no motivation to write anything good. On the other hand, if you have a clean, well maintained code base, the not so good programmers will be afraid to introduce hacks into the code and spoil the code base. The clean environment will force them to learn the right ways to doing stuff. This way, both the individual programmer and the project benefits from a clean environment.