What a shame it would be, if you were a painter & you had to explain all of your paintings!
Well, shoudnt be difficult to imagine; if you are one like me. A developer, coz all most of us do is "Sit n Read Code" :) Ok some of us are lucky enough to make changes as well bbbut even that to already written code!
Tell me honestly how many times have you cursed the original developer for mess 'making? Wellll i am sure almost always.. C'mon Life need not be so difficult.
So then what's the solution? - "Delegating work" - of course not.
You know what it is!
Lets just vow today, that every time we sit back to write code we will make it as simple and readable that people would think twice before saying "Comments Please!"...I mean it really sucks writing something like "Code below does blah blah blah blah...".. I am yawning already.
There is a lot to readability of code- one of the important aspect of making your code readable is Naming.
If you think about it - its nothing new...we always loved naming things! in fact we need names.
Don't we have names for just about everything around us -be it a country, city, individuals, pets etc etc and we do name things to make sense at least within what i call the "scope of an object" for instance people belonging to one country will normally have names that they can relate easily, on the contrary they might not feel the same for names from a different country (scope).
Further to this certain set of names in a scope are reserved for only a certain type of objects( well not always but most of the times :) i'l write about exceptions later).
So, why should one name things properly - coz we luv abstraction..it saves us time - believe me.
When you say "John weds Lisa"...its clear who is the bride and who is the groom.
Imagine if we made method names as descriptive! Well someone debugging the method would not be required to dwell into it; if not absolutely essential - you see what I mean. Believe me he/she will not curse you.
Naming is not just about being descriptive and scope - It also should convey how you plan to use the thing (variable/method/object etc). Perhaps let me put it this way, I don't mind naming a variable as "i" -if it only helps a for loop. However i would never have a instance/class variable named "i".
To add here i realised ( reading a java book) packages in Java aid naming in a way...
Can't think of an alternate way of adding two Date classes (one in util and another in sql package).
I believe if Shakespeare was made to develop programs he would take back his famous quote "What's in a name!"
Thursday, February 28, 2008
Subscribe to:
Posts (Atom)