As a programmer, who works with programmers, writing programs that are primarily targeted for programmers, I find that I’m blessed with the ability to drop into a pseudo-language to communicate complex ideas concisely with my peers.
Occasionally, when I come up for air to deal with the rest of the world, I have to revert back to English. For me, the context switch is effortless, and occasionally I find myself using programmatic terms, like ‘context-switch’, in standard sentences.
The problem is, for a technical person, we don’t grasp what it’s like not to deal with technical information on a constant basis and then be abruptly exposed to it. Today I got to find out, and it was insightful. No wonder so may people fear their computers.
This morning, I was reviewing some basic documentation on Objective-C. Here’s the section (skim it):
Sending Messages to nil
In Objective-C, it is valid to send a message to nil—it simply has no effect at runtime. There are several patterns in Cocoa that take advantage of this fact. The value returned from a message to nil may also be valid:
- If the method returns an object, any pointer type, any integer scalar of size less than or equal to sizeof(void*), a float, a double, a long double, or a long long, then a message sent to nil returns 0.
- If the method returns a struct, as defined by the Mac OS X ABI Function Call Guide to be returned in registers, then a message sent to nil returns 0.0 for every field in the data structure. Other struct data types will not be filled with zeros.
- If the method returns anything other than the aforementioned value types the return value of a
message sent to nil is undefined.
My wife came over to see what I was reading.
Curious to know what a non-programmer’s take on this would be, I asked her to read it to me, interjecting her comments along the way. It went like this:
“Sending Messages to nil” (she paused for a moment, internally analyzing what she’d just gotten into)
“In Objective-C, it is valid to send a message to nil—” (pause) “it simply has no effect at runtime.” This sunk in for a second. “Well it it has no effect, when the heck are you sending it messages for?” She resumed composure.
“There are several patterns in Cocoa that take advantage of this fact.” Confusion set it. “Several patterns? You need more than one to have no effect?”
“The value returned from a message to nil may also be valid: …” Her eyes combed the list.
“If the method returns an object, any pointer type, any integer scalar…” She hung on that word, and when I sat quietly, she continued. “…of size less than or equal to size of void star…” This was too much, “What?! Black holes can be different sizes?”
Frustrated, “a float, a double, a long ” (…pregnant pause…) “double, or a long long,…” She stopped again. “A ‘long long’? You’re making this up.” She checked my face to see to see if I was pulling a fast one.
She continued, “… then a message sent to nil returns 0.” By this point it the sentence had no meaning.
“If the method returns a struct,” apparently she liked that, adding, “Oh boy! A struct”, but it was unclear if she was teasing me now.
Resuming, “as defined by the Mac OS X ABI Function Call Guide” (which again meant nothing) “to be returned in registers.” I saw a furrowed brow drop, internally wondering what cash registers had to do with any of this.
“…then a message sent to nil returns 0.0 for every…” and she stopped herself.
“What?!? Zero-point-zero is different than zero? What the f***!?!” At that point she burst into an embarrassed laughter at just how mind boggling her internal monologue had gotten and refused to continue.
I had never looked at documentation from an outsider’s perspective before, it really did seem like techno-babble in that …context.