what's the opposite of unobtrusive?
May 29th, 2007
There were two articles on ajaxian recently that made me question the sanity of the code’s authors. Did they not think as they were developing just how ridiculously convoluted and completely non-unobtrusive their behaviour-attachment is?
The author of the code written about in the first link doesn’t exactly do himself any favours in the comments, and clearly can’t comprehend that giving an element a classname of fValidate['required','phone'] is horrible. He argues that it is no better than having “required phone”, and that by ‘namespacing’ it’s in some way better. HTML documents are hierarchical. Inputs and Selects sit inside (at least) a Form. There’s your namespacing.
The form validation proposed for HTML5 (I can dream) will allow the use the ‘type’ attribute of fields to deal with client-side validation. A required ‘email’ field, for example, will be declared with type="required email". Does it not make more sense to mimic that style now, in readiness for support?
What if I, later, wanted to make ‘required’ input fields look different to the user? (Something the Ajaxian author hinted at in the summary). I’d either need to add CSS rules, or add an additional classname to for each input. That wouldn’t be fun.
I’m willing to be a bit more forgiving to the author of the code covered in the 2nd of the articles, as it seems his work was submitted to the site by someone else (what people get up to in the privacy of their own homes is none of my business) but the premise behind it is equally ridiculous.
It suggests that in order to trigger a function with the onclick event of a link, I should add the classname bvr-observe-click-xhrTheFunction. How this is possibly any easier or less obtrusive than
$(the_link).observe('click',theFunction);
I’m not entirely sure. As an aside, the ‘example’ alternative he gives is unnecessarily verbose, the anonymous function is redundant. I’ve also heard rumours that future versions of Prototype will be even more succinct.
If people are happy using this kind of system, then it doesn’t really have any effect on me and so I probably shouldn’t care, but when a fairly popular news-channel is passing it off as worth knowing about, then that annoys me.
September 25th, 2007 at 09:05 AM Is the opposite of unobtrusive possible obtrusive?