• (cs) in reply to DanixDefcon5

    There's even a reference in literature (well, sort of) for entertaining variable names. In "The Wizardry Compiled" by Rick Cook, a programmer has a variable called corned_beef. it's a hash table, of course.

    DISCLAIMER: Comment written from memory, so apologies if details are wrong.

  • (cs) in reply to Phill
    Phill:
    me:
    Jim:
    Cirdan:
    Earl Purple:
    And so, Sally can wait.
    She knows it's too late
    As we're walking on by
    Her soul slides away
    But don't look back in anger
    I heard you say
  • sir_flexalot (unregistered)

    IMHO, it's much more likely that there was no real guide to the names, than that a person took the time to actually document function names.

  • wgc (unregistered) in reply to Saladin
    Saladin:
    I agree with that, my main beef is how so many instructors teach that as the "fallback" name to give anything if you don't know what to name it. Surely /something/ that at least gives some sort of insight into its purpose would be better than "myInt," if only to help readability and make things easier for a new reader to figure out. I mean, why "my" anything? If you're going for simple counters, just use "index" or "i" or something, not "myIndex" or whatever. You're the programmer, of COURSE it's "yours."
    • "my" has good meaning for scoping. Even if you didn't drink the M$ koolaid for the last few years where everything visible to the user is "my @#%^", Perl uses "my" to scope variables locally to the block and I've seen the terminology in manuals. At some point you have to go with common usage.

    • PLEASE, NOT "i"! Have you ever tried to search for all occurrences of a variable with that name using a text search? If you can't come up with something meaningful, at least use something like "ii" which is effectively the same but you can do a text search for it.

  • Teddy (unregistered) in reply to foxyshadis
    foxyshadis:
    Teddy:
    You should have read RFC 1178, "Choosing a Name for Your Computer".

    No, this is not a joke RFC! Everybody should read that one before choosing a hostname.

    Cute, but less useful now that things like UUCP are long dead and gone. Still useful for servers, but for basic client computers names are nearly meaningless. I just name them by office-dash-user, and take the 10 seconds to change it when someone moves.

    (Unless you have one of those lovely offices where this guy shares out his excel "database", that guy runs sql server express that the mail server connects to, another dude is the office's mp3 repository, and so on.)

    There is that, sure. By effectively prohibiting people to have services on their machines you are hindering the creation and growth of new and useful network services. (The early well-known FTP site "tsx11.mit.edu" started as the desktop machine of a guy who wanted to mirror some european stuff (Linux) that was slow to access over the old transatlantic links. This site effectively brought Linux popularity to the USA. The same with Yahoo, who started on students' dorm room machines, IIRC.)

    But there's also the fact that many programs saves the hostname everywhere, especially in UNC paths. I'd rather not tempt fate by changing stuff beneath programs' feet any more than I have to.

    (UUCP? The RFC doesn't even mention UUCP. I don't know what you're on about.)

  • Teddy (unregistered) in reply to Franz Kafka
    Franz Kafka:
    wfl:
    I work for a corp. that names all the servers after employees' kids - we all feel a little sad when one of the admins tells us that Susan died overnight for no reason, but they replaced her before anybody noticed.

    Did anyone else think to themselves "she died, but we got another one that looks Just Like Her!", followed shortly by "THAT'S NOT SUSAN!, WAAAH!".

    /evil

    "I've got someone who looks a lot like you; she does the things you do, but she is an IBM."

    • Electric Light Orchestra, "Yours Truly"
  • (cs) in reply to Benanov
    Benanov:
    I sometimes call her "The Karen" because I already have a computer named Karen. We had a (thankfully humorous) discussion about who had the name first. :)

    Plankton (of SpongeBob fame) has a computer wife named Karen.

  • Michael (unregistered) in reply to Saladin
    Saladin:
    Surely /something/ that at least gives some sort of insight into its purpose would be better than "myInt," if only to help readability and make things easier for a new reader to figure out. I mean, why "my" anything? If you're going for simple counters, just use "index" or "i" or something, not "myIndex" or whatever. You're the programmer, of COURSE it's "yours."

    Always always always always (did I mention always?) be descriptive with variable names. In my experience, "my(Anything)" is used by noobs who can't tell the difference between variables they declared themselves, and reserved words or classnames or whatever. The prefix "my" is a good way for them to tell the difference.

    And don't reuse variables for different things.... unless you're doing something embedded or realtime, you're unlikely to be killed by the overhead of declaring a new variable.

    Reading code should be like reading a well-written textbook, you may not understand everything at first glance, but the names start to make sense as you read the text.

    The ONLY exceptions, would be a counter in a for-loop, where "i" is so standard, that anything else might just be confusing, and any place where obfuscation of some sort is useful.

  • Robert Pearson (unregistered)

    This reminds me of some COBOL code I had to look at (early70's) with a view to modifications where all the 'lables' were rivers in New south Wales-- Australia

  • nil_ptr (unregistered)

    I wonder if there's another function called TrishaHappyEnd().

    ;)

  • (cs) in reply to wfl

    One of our biggest technological assets was named after the (actually very awesome) engineer that took over the project years ago. The next generation version of the project is named after his daughter, Amelia.

    When bugs are found, it's very hard to get angry about them: you can't just yell "Amelia is retarded, my data is gone!" across the room. One has to actually think about and share the problem reasonably and clearly.

  • unknown (unregistered)

    I just loved this.

  • anon_user (unregistered)

    I took a class... in 2005... from someone who had a routine to generate unique function names.

    As in 'PF0001','PF0002','PF0003'...

    His reasoning? 'Meaningful variable names can be misleading when the purpose of the function changes.'

    And he's the guru -- wrote-the-book, consults, teaches courses -- for an obscure but still selling programming environment.

    (Yes, yes, I know, maybe there was some requirement that function names be globally unique, I don't know. I didn't ask. I got out of there as quickly as possible.)

  • puffinpricess (unregistered) in reply to dolo54
    dolo54:
    Well I generally try to make my names meaningful, however occasionally I do throw in the odd joke here and there. For instance I have something called a wordTextField... in my code this is abbreviated to "wTF" of course!

    is this the same dolo who lived (lives)in harlem?

  • (cs) in reply to wgc
    wgc:
    - PLEASE, NOT "i"! Have you ever tried to search for all occurrences of a variable with that name using a text search? If you can't come up with something meaningful, at least use something like "ii" which is effectively the same but you can do a text search for it.

    Get a real IDE. Why are you still doing text searches instead of looking for references?

  • Arunava Banerjee (unregistered) in reply to Robert Pearson
    Robert Pearson:
    This reminds me of some COBOL code I had to look at (early70's) with a view to modifications where all the 'lables' were rivers in New south Wales-- Australia
  • Sebastian (unregistered)

    I use meaningful variable names. My code is usually clean. But ... i can't avoid funny references ...

    For example, on one of the systems I maintain I use Lock files ... off course, they are called Locke files, and the array where they are store after being read is $John.

    I think the most obscure reference I ever wrote is this one:

    I save store the ethernet's MAC Address in a variable, and later into a file. Both are named ONEINFINITELOOP. Explained: Mac Address = Apple's Address = 1 Infinite Loop. :)

Leave a comment on “Little Black Book”

Log In or post as a guest

Replying to comment #:

« Return to Article