On CNET: Start your holiday tech shopping
BNET Business Network:
BNET
TechRepublic
ZDNet

January 6th, 2006

It's Its, its' ... Apostrophic!

Posted by Paul Murphy @ 4:00 am

Categories: General

Tags:

My wife bought Lynne Truss’s Eats, Shoots & Leaves for Christmass - what a mistake! turns out, her tendency to delete commas is wronger than my tendency to put them in. Worse, at least for her, there’s an IT angle allowing me to poke fun at her in this blog.

I’ve recently had the unhappy experience of writing this bit of javascript for an onChange() function:

function opensr() {
var npage= ‘main_url’ + token=’+ self.document.leftform.usrid.value;
parent.frames.right.document.location.href=npage;
self.document.leftform.usridb.value=npage;
}

An incredibly clumsy construction that works for Mozilla and Firefox but fails, of course, when used with onChange() in IE.

I should have gone with getElementById() and the rest of that DOM set, thereby expressing, if not agreement with, at least complacency toward, the much decreed constructive agglomeration of Ms Truss’s penultimate chapter (take that! Kerry-Anne).

In reality, however, I see this kind of construction as an example of the pernicious influence of BASIC in all its uninformed and generally pig ignorant glory - - and I’m just not going to write anything that looks like loadRightTokenTriggerByCount() where "opensr() will do. Period. Full stop.

To a large extent what seems to be going on here is that the people behind the language change this reflects are all speed typists playing at using the object model without really understanding either its underlying purpose or what the consequent naming structure is fundamentally about.

Look at Microsoft’s DOM on their terms and it looks simple enough to be effective: just initialize according to the window.document.element heirarchy and everything will work whether you subsequently add elements or not. Thus:

parent.frames.right.handle.appendChild(window.document.createElement("DIV"));

sure looks cool - but collapes of its own weight when you find yourself writing: IfAspectPostiveCallUnitTokenElseDoReplay(listChildNodes(),addChild()); with fun references like parent.frames['rightiframe[3]‘].window.document.hackform.byteme.value.

And what would be wrong with treating the page as an element array and writing: D[right;tokens;1] <- 1; instead? It ain’t BASIC, that’s what.

The last word, however, should go to Ms Truss:

As I mentioned in this book’s introduction, by tragic historical coincidence a period of abysmal under-educating in literacy has coincided with this unexpected explosion of global self publishing. Thus people who don’t know their apostrophe from their elbow are positively invited to disseminate their writings to anyone on the planet stupid enough to double click and scroll.

That doesn’t apply to you and me, of course - but the book is well worth reading and the application to Microsoft’s absurd object representation in the naming conventions it grew by merging BASIC with a less than basic understanding of the object paradigm something those of us susceptible to typing errors should probably be more vocal about.

 

Paul MurphyPaul Murphy (a pseudonym) is an IT consultant specializing in Unix and related technologies. See his full profile and disclosure of his industry affiliations.


Email Paul Murphy

Subscribe to Managing L'unix via Email alerts or RSS.

  • Talkback
  • Most Recent of 16 Talkback(s)
Long variable names
"I've always tended toward long, descriptive names for variables and functions "

I agree absolutely. I wonder about how many times I have had to wade through heavily maintained code where accou... (Read the rest)
Posted by: jorwell Posted on: 01/08/06 You are currently: a Guest | | Terms of Use
Namespaces  Roger Ramjet | 01/06/06
Agreed, in fact, I did something like that once  murph_zZDNet Moderator | 01/06/06
What's your point?  rapson | 01/06/06
Roots in Ada  Roger Ramjet | 01/06/06
Ada  rapson | 01/06/06
Nah  Roger Ramjet | 01/06/06
I get it...  rapson | 01/06/06
Just what is Paul saying?  Erik1234 | 01/06/06
Yep - here's some obfuscated perl for you...  murph_zZDNet Moderator | 01/06/06
Long variable names  jorwell | 01/08/06
You're both right  murph_zZDNet Moderator | 01/06/06
Just a thought  mdemuth | 01/06/06
Look at the title of Lynne Truss's book!  Anton Philidor | 01/06/06
More punctuation  Anton Philidor | 01/06/06
as usual another blabbering rant by Murph.  zzz1234567890 | 01/06/06
the title should have been  zzz1234567890 | 01/06/06

What do you think?

SponsoredWhite Papers, Webcasts, and Downloads

advertisement

Recent Entries

Archives

ZDNet Blogs

White Papers, Webcasts, and Downloads

Meet Doc