in reply to var comparison
/me nods ...
I learned a huge lesson about computer programming when I first encountered the following comment in source-code:
Dig me up and I’ll fix it then.
(Blink!)
But, you know, it’s true. Even though none of us likes to think about mortality, our source code will probably out-live us, even by a considerable interval. And, even if it does not, we always need to write for maintainability. If digital computers are not quite fast enough to execute our object-code now, you can be sure they will be in the near future. But the source-code will still be there, regardless. Therefore, above all other things, make your intentions of the moment abundantly clear, and strive to do so in a way that will create the least amount of headaches for your successor. (Too bad for you ... sux that a bread-truck was at just the wrong place at just the wrong time ... and by-the-way so were you). Change will come, and your if-statement will not last forever.
Most of all, the person who makes that change wants to be able to make his or her change without disrupting, and therefore having to re-test, your original source-code. Don’t get hung-up about “efficiency.” Don’t indulge in cleverness of-the-moment in sacrifice of maintainability of-the-future. If you do that, people just might throw AOL floppy-disks at your tombstone out of spite.
Replies are listed 'Best First'. | |
---|---|
Re^2: var comparison
by nemesisgus (Acolyte) on Sep 06, 2012 at 21:57 UTC | |
by sundialsvc4 (Abbot) on Sep 06, 2012 at 22:49 UTC |