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.]

This entry was posted in Rantage. Bookmark the permalink.

0 Responses to More wisdom

  1. Fred Blasdel says:

    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. landon says:

    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. Bob Montgomery says:

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

  4. Vlastimir says:

    “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. Peter says:

    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. UX-admin says:

    “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. coderpunk says:

    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. boskabout says:

    Yeah, but COBOL is still around, you know, although variables may have a length of max 30 chars.

  9. superjoe says:

    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 / .

  10. Adrock says:

    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.

  11. landon says:

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

    … and I pillory people for using Hungarian.

  12. Doppelbock says:

    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 to Doppelbock Cancel reply

Your email address will not be published. Required fields are marked *