Tuesday, February 22, 2005

WHAT WG or XForms: what is it going to be?

Just read an interesting article on News.com, in which WHAT WG's Web Forms 2.0 is compared with W3C's XForms. A journalist from a Dutch IT newspaper called me today to ask for Backbase's opinion on this. In short, Backbase sees good things in both initiatives, but our approach is closer to XForms because of our focus on XML and declarative development (as opposed to scripting). The big difference is that Backbase Forms work in most modern browsers without plugins. I'll write a bit more about this later.

PS. also an interesting discussion on Slashdot

Friday, February 11, 2005

Dell and buying via the Internet

May 2004 - On the first day of my new job I arrived at my new office punctual at 9am. I met my new colleagues, and after a while someone asked: did we buy a computer for him? Hmmm. Apparently not. No worries: the CEO gave me his car keys and his debit card and he suggested I buy a computer myself. So by 10.30 I was on my way. Unfortunately the recommended store was in the middle of Amsterdam, so by the time I arrived and found a parking spot it was 11 o'clock. Then I was waiting in line for 20 minutes in the 'fast lane', just to hear that buying a laptop did not qualify for the fast lane. Waiting. Model not in stock. Go to other store. Drive. Park. Wait in line. Then finally got it: too bad the CEO's debit card wasn’t accepted, so I had to pay for it myself. Hmmm.

After a small while, I became responsible for purchasing new computers for our company and I started buying from Dell: no hassles, just order via their website, via e-mail or over the phone. The computers are usually delivered within 2 weeks, and they offer good value for money. So if you manage to look ahead for about 2 weeks it sounds like an ideal solution.

Then some patterns started to emerge. With almost every order there was a new account manager, because the previous one was either fired or promoted. With 6 purchases over the last 8 months I had 4 different account managers. All of them were trying to sell me the professional line of computers (Latitude and Optiplex) instead of the cheaper Inspirons and Dimensions. They gave a high discount, but it was still more expensive than the consumer line. When you ask them for the differences between both lines, you hear a lot of vagaries, nonsense, lies and only 1 possibly valid reason: the consumer models change more often, which could result in higher support costs. Is that really true? I don't know, but for our company (30 employees and growing) it's certainly not relevant. One thing is sure: the Dell sales reps get more commission when they sell Latitude and Optiplex.

Of the 4 sales reps, two were fairly good so they were promoted almost immediately. Two were different, but similar in that they:
- Lacked any technical competence
- Broke their promises frequently
- Lied outright more than once
- Talked so smooth that it was either scary or hilarious
They promised things like 'I will take care of it today' and 'it will be delivered by October 1', and of course that didn't happen. They tell you lies like 'we don't sell Inspiron to corporate accounts anymore' and 'you will qualify for buying on credit'. For 5 times in a row they submitted an unsuccessful request to buy on credit (taking a couple of days), while we were perfectly happy to pay up front.

Finally I was so disappointed with the Dell sales reps that I decided to order without human intervention: via the Internet! I entered my order and indicated that I wanted to pay up front. A couple of days later the account manager called me: the request to buy on credit was denied (?), and if I could resend my order directly to him via fax. Even buying via the Internet doesn't work with Dell, apparently.

The Dell website itself is an interesting case, though: on the one hand it's great that you can configure your systems online, but from a usability perspective there’s a lot that can be improved. And they don't seem to have made any real improvements in the last couple of years. At my company we've created a demo application with some ideas how an improved Dell shop could work. It’s not intended to be completely foolproof, but it offers an interesting new perspective. Especially drag-and-drop and the animated sort-functionality are highly appreciated. Now just wait until Dell realizes their website is out of date...

Thursday, February 10, 2005

Custom attribute with namespace: hasAttributeNS()

A colleague today showed me that he had created a custom attribute in his own namespace. He created a small JavaScript function to sort an XHTML table, which is triggered by the attribute g:sort="yes". An example is on his webpage. The JavaScript file can be seen here.

He uses the hasAttributeNS() JavaScript as specified in the W3C DOM Level 2 specs. Unfortunately only Mozilla and Opera 8 have implemented this. I'm not sure about Safari: does anybody know more about this? I haven't see this function on Quirksmode yet. In any case, IE does NOT support this function.

Jim Ley mentioned that this will result in more complicated JavaScript code, because "IE doesn't have a getAttributeNS - you can only do getAttribute("chicken:feed") - which means you have to manage the namespace handling". I don't know what to think about that. Do you really want to handle namespaces? Or can you just do getAttribute("g:sort") and be happy with that.

Personally I'm pragmatic. I like it when scripts work on IE and Mozilla, and ideally on Opera 8 and Safari 1.2+. So getAttributeNS is elegant, but I wouldn't use it on my site. It's time for a JavaScript library that creates an abstraction layer, so you don't have to worry about all these browser quirks :-)

Sunday, February 06, 2005

Custom tags, namespaces and DTDs

When you want to add extra functionality to web applications, you might want to add extra attributes or tags. The idea of custom attributes is presented in a nice article by Peter-Paul Koch on A List Apart: JavaScript Triggers, and further explained on PPK's website.

In the article below I give some extra ideas about custom tags and attributes, and how they can be combined with namespaces and DTDs.

Namespaces and DTDs have a different purpose. Namespaces make it possible to mix different XML vocabularies in a single document. DTDs make it possible to check the validity of an XML document.

If you use a custom attribute ‘required’ in an XHTML document, you are basically mixing your own XML-language with XHTML. There could be naming conflicts if a future version of XHTML also introduces the ‘required’ attribute. Therefore it’s better to put your own tags and attributes in your own namespace. You indicate the namespace with a namespace prefix. This could be the result:

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" >

<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ppk="http://www.quirksmode.org/ppk" >

<body>
<form>
<textarea ppk:required="true"></textarea>
</form>
</body>
</html>

Then you might want to check for validity, both for XHTML and for your own attributes. Checking for XHTML validity is important to ensure compatibility with web browsers. You cannot change web browser implementations, so you better make sure your documents are compliant, otherwise your pages might be rendered incorrectly. Your own XML tags and attributes will NOT validate based on the standard XHTML DTD, regardless whether they are in their own namespace or not. But the good thing is that the browser also won’t mind about these extra tags: they’re just ignored (1).

So it’s your own responsibility to make sure that your own tags and attributes are processed correctly, using JavaScript. Then it makes sense to validate your custom markup, otherwise your JavaScript might not work correctly. For this purpose you can add your own tags and attributes to the DTD. For validation it is NOT important whether you use namespaces or not. A validating DTD parser is not even aware of namespaces (see Roland Bourret's Namespace FAQ). Validation is helpful during authoring of documents, and many authoring environments can use DTDs or Schemas for code completion and validation.

At Backbase we have introduced two additional namespaces (one for visible tags, and one for system tags), and we have implemented code completion and validation for DreamWeaver, Eclipse and Visual Studio.NET.



(1) NOTE: if you use a namespace, you have to declare it, otherwise some browsers (such as Mozilla 1.8) will display XML errors. In the example above I have declared the namespaces in the HTML tag.