Loading ...
Sorry, an error occurred while loading the content.
 

Re: [XP] How to name variables

Expand Messages
  • J. B. Rainsberger
    Isn t the object in question essentially raising its voice about something? As for only you know what it means, that s not fair: everyone knows what it
    Message 1 of 62 , Dec 1, 2001
      Isn't the object in question essentially raising its voice about something?

      As for "only you know what it means," that's not fair: everyone knows
      what it means, because I told them and they liked it -- except Mike. :)

      I will admit that "scream" is not quite right, but it's the spirit of
      "scream" that I'm looking for... something that fits with "say" and
      "warn"... maybe English just doesn't have what I'm looking for. I just
      know that "say" is a better abstraction than "registerMessage". The
      parameter is a message, so "message" is redundant in the method name. If
      we tie the method name to the intent, rather than the severity of the
      message, then we have more freedom of movement to change our minds about
      how to represent the severity of message we'd merely "say" rather than
      "warn" or "yell", "scream", "worry", "caution", whatever...

      I think you're both missing one point: "scream" is what I said when I
      vocalized what I wanted the system to do. Surely a name that aligns so
      closely with exactly what I wanted to do at the time is worth something!

      JBR.

      Bryan Zarnett wrote:

      >"It makes my pair-partner smile. It's funny. It's cute... and we'll
      >remember it! We know exactly what it does!"
      >
      >Yah, but only the pair (you and your current partner) know what it
      >means. When I hear scream I presume to hear some vocal
      >unpleasantness. When someone screams at me, I generally don't listen
      >as well. So why would I listen to a screaming message about
      >something that is wrong?
      >
      >Screaming also has nothing to do with errors, its just the amount of
      >sound we emit, generally when pissed off. Although in your dialog it
      >made sense, as a variable or a method it hardly defines what you are
      >actually doing aside from raising your voice about something.
      >
      >
      >B.
      >
      >JB Wrote =>
      >When I write a test later that hour, I say to my pair-partner, "If
      >this goes wrong, we should scream 'Invalid code!'".
      >
      >I have an epiphany.
      >
      >The method is now:
      >
      >scream(code, args)
      > registerMessage(code, args, "error")
      >
      >If I want to scream, then I should scream; so I name the method
      >"scream". It makes my pair-partner smile. It's funny. It's cute...
      >and we'll remember it! We know exactly what it does!
      >
    • Phlip
      ... The algorithm is a playful example. The real issue here is that hard-to-remember names, or hard-to-reconstruct names, are a DesignSpell. -- Phlip
      Message 62 of 62 , Dec 12, 2001
        > How do you know that algorithm will converge?

        > > I have memory issues. So suppose I type the name of an
        > > object. Then I type a
        > > dot. (I can usually remember the procedure this far.) But
        > > then I need to ...
        > > "remember" ... the method name the object should call.

        The "algorithm" is a playful example. The real issue here is that
        hard-to-remember names, or hard-to-reconstruct names, are a DesignSpell.

        --
        Phlip phlip_cpp@...
        http://www.greencheese.org/PeaceAndCalm
        -- "In my experience, the customer doesn't know what he wants
        until you don't give it to him." --David Brady --
      Your message has been successfully submitted and would be delivered to recipients shortly.