Comment

John Hiatt - Shredding the Document

306
BlackPearl5/30/2014 9:30:04 am PDT

EmmaAnne asked in the last thread:

Please explain this joke from the article:

Funny, right? No? How about this exchange:

“Is that called arrayReverse?”
“s/camel/_/”
“Cool thanks.”

Wasn’t that guy helpful? With the camel? Doesn’t that seem like an appropriate response? No? Good. You can still find Jesus. You have not yet spent so much of your life reading code that you begin to talk in it.

****

Because I am a dork, it became VERY IMPORTANT that I register to answer. I’m not a real programmer, so I may get it wrong, but the internet is like that. Hi everyone!

So… the first guy is asking if a thing (function, probably) is named arrayReverse.

arrayReverse is using a naming convention called camelcase. This is where the first letter is lowercase, and everything else is lowercase except the first letters of subsequent words in the name, e.g. helloIAmAVariableName . (See the camel humps?)

The second guy responds with a regular expression. This is where you search some text to try to find phraseX, and if you use the “s” or “substitute” flag you replace it with phraseY, like so: s/phraseX/phraseY/ .

Finally, there’s another naming convention where you delineate words by separating them with underscores, e.g. hello_i_am_a_variable_name .

So he’s saying, “Right general idea, but replace the camelcase convention with the underscore convention,” instead of being a normal human being and saying, “No, it’s not arrayReverse, it’s array_reverse.” And the point is to strive to be a normal person, I think. :)