25
LLAMS
3y

“Stop trying to name it and name it”

Kevlin Henney adapting Morpheus’ iconic “stop trying to hit me and hit me” with regard to choosing names for classes/functions/vars. Too often we pussyfoot around with computer sciency sounding words instead of just calling it exactly what it is.

Comments
  • 3
    var a, b, x, y, z;
  • 7
    "Too often we pussyfoot around with computer sciency sounding words instead of just calling it exactly what it is." - nope. too often, there's just no way to exactly nail "what something is" down to a short word.
  • 3
    @tosensei i agree, but we don't need a perfect variable name. We must juggle around a tension between abstraction and distinction.

    On one end, it must be abstract enough to encompass the meaning of the variable in the context of the scope.
    On the other end, must be specific enough so that there is no redundant information in the definition itself.

    The inbetween tension of the two ends contains a golden range where the variable name is best understood by the majority of developers. The range size is context dependent.
  • 2
    @bioDan aaaand you've perfectly explained _why_ naming stuff is hard.
  • 1
    @tosensei funny enough, its a problem with language and communication as a whole (Naming titles of movies/books/articles/etc.)
  • 3
    @tosensei & @bioDan
    Now, kiss.
  • 2
    @scor nah, i'd have to move for that, and i'm lazy.
  • 2
    done is better than perfect.
  • 1
    @scor - @tosensei already did when he wrote "Naming stuff is hard"
  • 0
    Just use some sort of varname to get started, find/replace later when you think of one that's better. Repeat, if you want to, for as many times as you want to. Don't waste time agonising.
  • 0
    Well sometimes it goes out of hand also:

    I once ended up with AutoRenewTokenRetryOnceOnUnauthorizedAuthorizedServerHttpService, was a class name though
  • 0
    global, general, common, shared, parent, root, source, base, core

    hmmm
Add Comment