Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

Re: var comparison

by sundialsvc4 (Abbot)
on Sep 06, 2012 at 19:43 UTC ( #992176=note: print w/replies, xml ) Need Help??

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.


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

    I'll remember that one!

    Wow! I had never guessed how an apparently simple question would lead us to such a kind of deep thoughts.

    You are right, of course. I have to confess myself too worried about efficiency at the expense of clarity very often.

    Tip of the day: "clarity over efficiency". Or, at least, over small improvements in efficiency.

      Thanks.   (It makes me feel a wee bit younger.)

      Moore’s Law pretty much wiped-out any consideration of “efficiency” in my book, a couple of decades ago ... with the notable exception of the very valid edge-cases that my esteemed colleague, BrowserUK, routinely and legitimately encounters in his daily work.   Aside from such performance über alles edge-cases (and therefore, IMHO “as a general rule”), maintainability and simplicity trump just about every other imaginable concern in this business.   It is frankly, literally, true that ... “at 1 billion ops per second (give or take...) these days, no one can hear you scream.”

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://992176]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (7)
As of 2018-01-19 15:59 GMT
Find Nodes?
    Voting Booth?
    How did you see in the new year?

    Results (221 votes). Check out past polls.