Will.Whim

A weblog by Will Fitzgerald

RemoveSpecialCharsExceptQuote

Worse than Failure posts about a silly function named:

RemoveSpecialCharsExceptQuote
AmpersandApostropheOpenBracketCloseBracketComma
HyphenFullStopCommaForwardSlash

Hah! If I’d written this in Lisp, it would be the *much* simpler:

remove_special_chars_except_quote_ampersand_
apostrophe_open_bracket_close_bracket_comma_hyphen_
full_stop_comma_forward_slash

which is why Lisp is so much better than Any Other Language.

(I tend to write functions that have names that are too long, which is why I thought this was funny. I wonder what the longest function name that I’ve ever written is?)

Advertisements

3 responses to “RemoveSpecialCharsExceptQuote

  1. Michael Hannemann November 26, 2007 at 2:58 pm

    Holy self-documenting functions, Batman! Although as someone I’m working with pointed out, this is a terrible name because if the business rule for “special characters” ever changed, you’d have to change every reference in the code.

    (“For Thanksgiving this year, I give thanks for the ability to hit TAB to auto-complete function and variable names…”)

    I used to think that (multiple-value-bind) was a long name, but lately, I find myself writing functions like (construct-possible-acronym-expansions). And if that function becomes too large, or if I want to take out an inner loop, I run the risk of writing (construct-possible-acronym-expansions-helper), which is really just too much. Someone should confiscate my ability to make Emacs windows 150 characters wide.

  2. John Wiseman December 1, 2007 at 10:00 pm

    Will, you’re going to have to explain the underscores.

  3. Will December 1, 2007 at 10:17 pm

    OH, NO! I’VE BEEN RUBYIZED! I MEANT …

    remove-special-chars-except-quote-ampersand-
    apostrophe-open-bracket-close-bracket-comma-hyphen-
    full-stop-comma-forward-slash

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: