February 2009

« January 2009 | Main Index | Archives | March 2009 »

20
Feb

Maybe targeted web advertising would be more successful if it chose its targets more wisely: (From A Modern-Day Ada Lovelace)

It never works. No matter how much mainstream, ad-targetable, genderblind information I provide, more than half of the targeted ads I see are for weight loss (usually in terms of dress sizes or low calorie stereotypical craving snacks), snake oil anti-aging secrets and stretch mark removal. Today, facebook tried to give me a $10 off coupon at diapers.com and “acne care in a chocolate”.

I see a very simple solution to avoid the ire of increasing numbers of folks online, a very simple option M or F or ‘I’m not telling’ or ‘don’t use this information for ad-targeting’ and the same on ages. But the traditional sales force doesn’t want that, I’m sure. It would break everything they know in marketing, to think we want to be approached as people.

The DOM Stigma

  • 7:07 AM

One of the more annoying things about being a Java developer is the stigma the language developed far too early in its existence from being “that Applet language”. You'd mention Java and the first thing that popped into anyone's head was those annoying, out-of-place and usually worthless applications that dotted websites before everyone gave up on Java and turned to Flash for their annoying out-of-place and usually worthless applications. It was unfair1, and I would spend far too much of my time pointing out that when you took Java out of the web browser, it was actually pretty useful.

As such I feel I owe Javascript an apology as, if only through laziness, I have been committing the same sin in its name. When recommending JQuery to co-workers, friends, random passers-by and the occasional hobo (as I have been wont to do recently) I have tended to summarize its merit as “it makes Javascript not suck.” Which is rubbish. Javascript has always been perfectly cromulent. What JQuery does is make the DOM API not suck.

The Document Object Model is a platform- and language-neutral interface that will allow programs and scripts to dynamically access and update the content, structure and style of documents. The document can be further processed and the results of that processing can be incorporated back into the presented page. — W3C

The fatal words here are “language-neutral”. And the particular definition of language-neutral that the W3C uses here is “Java and Javascript”.

The W3C only defines normative bindings for Java and ECMAScript, however we also reference known non-W3C DOM Bindings for languages other than Java or ECMAScript. — ibid.

This is a problem. Java is a strongly and statically typed language with a Smalltalk-style object model. Javascript is a loosely and dynamically typed language with a prototype-based object model. Force them to share an apartment and you've got an instant sitcom. Try to write an API common to both languages and you'll end up having to pick the lowest common denominator.

Which is why DOM manipulation looks like a Java API. Java developers, bless our hearts, are used to the kind of API that requires five lines of code just to populate an array. What JQuery and its ilk do is provide a way of manipulating the DOM that is idiomatic Javascript rather than a strange transplant from another language.

I guess the fact that there is starting to be such a thing as idiomatic Javascript demonstrates if not a maturity of the language, then at least a promising late-adolescence.

1 Java has since accrued more deserved stigmas, but that is a story for another day.

Have you ever…

  • 11:25 AM

We were interviewing tech lead candidates last week, and on a whim I decided to print out the Scientology “Whole Track” Security Check as an amusing prop. The check is a list of questions that are supposed to encompass all your past lives, and includes such gems as:

  • Did you come to Earth for evil purposes?
  • Have you ever enslaved a population?
  • Have you ever made a planet, or nation, radioactive?

The idea was that I would leave the printout in a prominent position next to all my other papers in case the candidate got a little too curious. During the course of the interview, though, this question caught my eye:

Have you ever done anything which you hoped would be wiped out by the passage of time?

So I asked it1.

Unfortunately, I think the shock value of the question (and the fact the other interviewers laughed when I asked it) made it less than useful, but for the record here are the answers I gave when later the question was turned around and directed at me.

Don’t Try This at Home, Kids

Somewhere deep in Confluence there is a block of code that, through reflection, messes with the private internal state of a core Java library class, amongst other things causing it to disobey an IETF RFC. Above, there is a comment that still gets me in trouble with my co-workers: “This is a truly egregious hack. Please don't do anything like this in your own code.”

AbstractPage

The initial cut of the blogging code in Confluence was developed in a rush. 1.0 was approaching fast and one of our early adopters had flatly said they weren't buying the final release if it didn't have blogging in it. As a result, I made one of the classic mistakes of object oriented programming and used inheritance where I should have used delegation. The tendrils of this mistake still creep through a large portion of the product's content-handling code, and make it a lot harder to add features in that area than it really should be.

oh_my_god_thats_some_funky_stats()

Once upon a time, I was asked to write some software to help manage an Internet café. It was actually pretty neat: a CGI script (written in Perl) that used a Unix named pipe to talk to a daemon process (also written in Perl) that would add and remove firewall rules to enable and disable the various computers in the cafe. There were also a few rudimentary accounting functions, and some nifty ASCII-art graphs of desktop utilisation over time.

The problems arose from the fact that I was (1) young, (2) underpaid and (3) firmly believed I was getting a new job soon and would thus never have to maintain this script. As a result, I committed some egregious and entirely deliberate crimes against maintainability:

  • I decided this was a great opportunity to teach myself OO Perl, despite not really understanding OO (or Perl, for that matter)
  • One method required five local variables, occasionally swapping their values. I called them $binky, $banky, $bonky, $bunky and $benky
  • Many functions were named after the song I was listening to at the time (see above).

Three months later, of course, I was still working at the same job and we got word from the café that they wanted to change from pre-paid access to billing people once they were done. So really, the joke was on me.

1 …with the immediate qualification that I was only asking in a professional context.

25 Things…

  • 8:00 AM

I was tagged with yet another of those ‘tell me a list of things I don't know about you’ memes, this time on Facebook. So for those of you who care, here is another random collection of facts about Yours Truly.

  1. I cannot fall asleep without the sound of Donna Summer's "Back in Love Again" playing in the background.
  2. Halfway through my first ever driving lesson, the instructor informed me that you do not, in fact, have to make the "brmmm brmmm!" noises yourself.
  3. At seven years of age, I met Chuck Norris. I still have a small scar just next to my left eye.
  4. I find it difficult to keep friends for very long. As an attempt to remedy this, I've taken to fitting their ankles with radio receivers so I can track them as they migrate.
  5. My favourite dance is the Lambada, the forbidden dance.
  1. My great-uncle Harold declared war on the United States of America, and spent the rest of his life drawing up surprisingly plausible invasion plans. Sadly he died before he could procure an amphibious landing craft.
  2. My first ever girlfriend was called Sarah. It was a short, intense affair with a short, intense woman. The coroner would later classify her death as ‘spontaneous human combustion.’
  3. My astral form is a small parrot called George.
  4. In the dark of night, when nobody else is looking, I boot all my computers into Windows XP and attempt to summon The Hornèd One.
  5. I am a few inches shorter than my actual height.
  6. Wherever I go, I carry a small LED display that always reads ‘9.8 ms⁻²’. When asked why, I say that I'm watching my weight.
  7. I have written four novels, but all were refused publication under the Official Secrets Act.
  8. I am obsessed with the television show "Doctor Who", to the extent that I have replaced David Tennant with an animatronic robot so I can keep the real actor in a trunk in my closet. Sometimes I bring him out at parties and ask him to sing.
  9. I am allergic to most common household cleaning products. Also vacuum cleaners, lawnmowers and dead light bulbs.
  10. Every so often I break into the Sydney Aquarium late at night to keep the fish company. I think the rainbow trout fancies me.
  11. After a terrible childhood accident I received ground-breaking surgery during which the doctor crafted a new nipple from tissue taken from the inside of my cheek.
  12. When very drunk I will admit that yes, I have been to Adelaide.
  13. I have always been interested in writing software. When I was eleven I entered the Kessel Coding Challenge in my home state of Western Australia, which I completed in less than twelve parsecs.
  14. My career as an exotic dancer was short-lived.
  15. I am the founder of the ‘stealthy fish’ school of martial arts.
  16. I am one of the few people to defeat Chen Kenichi, Iron Chef Chinese, although some observers still claim I was lucky the theme ingredient for the day was Vegemite on toast.
  17. Quantum Physicists have proven that if you say my name three times, there is approximately a 10⁻⁷² probability of my appearing at your location. For those tempted to try, be warned that the chance of our molecules occupying the same space and thus annihilating us both is non-negligible.
  18. Natalie Portman never returns my calls. The bitch.
  19. It is well known that I am not a morning person. What is less known is that I am also not an afternoon person, an evening person or a night person. I am only properly functional between the hours of 2 and 3 PM. On Thursdays.
  20. I've been to paradise, but I've never been to me.