More wisdom

Every time you use “#define”, God kills a start-up.

The inability to spell is still no excuse for abbreviations like CUST_TBL and PROD_REM. At some point before this you’ve crossed into being lazy.  [It might have been an excuse in the days of 80 column punch cards, but you’ve got a 21″ monitor now, don’t you, you lazy bastard, and I’m not really worried that meaningful identifier names are crowding out the pixels currently devoted to Reddit and Facebook.  Really not.]

Author: landon

My mom thinks I'm in high tech.

12 thoughts on “More wisdom”

  1. Well I prefer even the most inscrutably named #defines to having unnamed magic numbers everywhere in the source code. Lots of weird arbitrary constants are annoying to figure out what they mean, but even worse is mystery functions called with arguments like [-1,0,1,2,n] without any clue as to what they mean in context (or whether it means the same thing everywhere it’s used).

  2. Ah yes. And don’t even get me started on returning ‘-1’ for an error code. From anywhere. A flogging first offense. Not sure about serial offenders.

  3. I dunno…there’s a fine line there. Code with 20+-character labels can be unreadable as well.

  4. “tempStavkeUlazneKalkulacije”….Damn, if it weren’t for advanced tools like autocomplete and refactoring, i’d go nuts.
    Still, when you have to type these collumn names into a console window, you start cursing really fast 🙂

  5. I totally agree with this rant.
    People keep bugging me about making function names like:

    RGBA *GetPixelValueFromScreenLocation(long XPosition, long YPosition)

    }/*End function GetPixelValueFromScreenLocation*/

    They offer lame suggestions like:

    RGBA *GetPValSLoc

    Pffft!!… (??!!!)

    I also get hassled if I add actual comments to my code because
    ‘It takes too much time’ .

    ‘5 flippn minutes will save me 2 hours six months from now’
    ‘5 hours if I have to debug this over a year from now’

    Alright, I’ve offered my two bits, back to programming….

  6. “Ah yes. And don’t even get me started on returning ‘-1′ for an error code. From anywhere. A flogging first offense. Not sure about serial offenders.”

    That’s what I wonder, why “reinvent the wheel”, when there is perror and errno.h?

  7. I agree, these days. My excuse is that I cut my teeth on the Atari 800 (6502) and 6800 assembly programming. Variable names couldn’t be longer than 8 characters on the assembler I used, so even today I find myself waffling over short variable names.

    I’m getting better though!

  8. I can’t say for sure, but I think my most frequently used variable names over the course of my 16 year programming history are i and x. Of course, now with all the fancy things like foreach loops and iterators and godknowswhat, I use them for less frequently.

    I keep reading about that lovely language Forth on this blog. I actually once made a Forth language subset interpreter in JavaScript. Fun times.
    355 113 / .

  9. I like #defines on arrays, especially char arrays, for a max size. Like, you know, the max size of some object’s “name.” (E.g. #define qkcchName 64 which is q (global) k (constant) cch (count of chars) in a name.)

    Also, anywhere a “max” variable is used more than once, or even once, which is useful for fine tuning my own unit testing of some part of a code that won’t be left up to QA or the user.

  10. Sizeof is your friend. And macros that are not named ALL UPPERCASE are death, death, death.

    … and I pillory people for using Hungarian.

  11. I am so happy so see someone else extol the virtues of commenting your code. I don’t know how many times I’ve had to go through something I inherited from a predecessor and attempt to make sense of it without any comments by the original author.

Leave a Reply

Your email address will not be published.