HTML5 Microdata - Over-cooked?

What is Microdata?

Microdata is HTML5's answer to how we should go about embedding machine-readable data in our mark-up.

At a high level, microdata consists of a group of name-value pairs. The groups are called items, and each name-value pair is a property. Items and properties are represented by regular elements.

A simple example looks something like this:


<div item>
 <p>My name is <span itemprop="name">Frances</span>.</p>
 <p>My work for the <span itemprop="company">BBC</span>.</p>
 <p>I am <span itemprop="nationality">British</span>.</p>
</div>

Where the item has 3 properties with values (name:Frances, company:BBC, nationality:British).

You can then associate item properties with items that the property is not a direct descendant of, with the subject attribute.

Essentially, you have some new attributes at your disposal:

You can also type items with a URL, reverse DNS labels or a pre-defined type (and each itemprop can accept multiple properties, as you'd expect with class):

Here, the item is "org.example.animals.cat":


<section item="org.example.animal.cat">
 <h1 itemprop="org.example.name">Hedral</h1>
 <p itemprop="org.example.desc">Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.</p>
 <img itemprop="org.example.img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
</section>

In this example the "org.example.animals.cat" item has three properties, an "org.example.name" ("Hedral"), an "org.example.desc" ("Hedral is..."), and an "org.example.img" ("hedral.jpeg").

Quotes and examples (slightly personalised) come from the HTML5 working draft.

My reservations

My gut instinct with microdata is that it's overcomplicating things. We have RDFa already if you really want to get into the nitty-gritty of machine-readable data and, dare I say it, microformats and good semantic practice for creating shared vocabularies for plain-old semantic HTML. I'm not sure HTML5 necessarily needs this sort of extra solution.

The last example above, with the reverse DNS typing, just looks so... heavy. Something about it just doesn't feel right and it's actual value to me remains unclear, or at least I can't see the value of specifying the path on each element. Couldn't that be inferred from the structure, or subject used where ambiguities appear, and then as a last resort specify it on each element?


<section item="org.example.animal.cat">
 <h1 itemprop="name">Hedral</h1>
 <p itemprop="desc">Hedral is a male american domestic
 shorthair, with a fluffy black fur with white paws and belly.</p>
 <img itemprop="img" src="hedral.jpeg" alt="" title="Hedral, age 18 months">
</section>

The itemprop attribute bothers me most. I can't help but think that all the examples shown in the draft would still work if itemprop was replaced with class. The class attribute is already designed to take a semantically rich term for the element. Worse still, assuming class is used appropriately, you'll end up with unnecessary repetition across the attributes.


<div item>
 <p>My name is <span class="name" itemprop="name">Frances</span>.</p>
...
</div>

The subject attribute examples aren't great, which doesn't help their case - they don't seem that real world (although there are plenty of good reasons why you might need subject - just look at the microformat include-pattern for example, and how that would be improved with it). A few of the examples could be better represented and relationships then inferred from the element structure (and I wouldn't mind, but HTML5 already offers a boat-load of new elements to take away much of the ambiguity that HTML4 had - but just sections and headers go a long way to tying information notionally together).

The microdata proposal seems to be about making explicit what could otherwise already be inferred from the actual elements and values (although I'll concede that it's often inaccurate or very difficult). Wanting to be exact isn't a terrible idea (it works really well for the for attribute, for example) and I do like disambiguation. I just don't think the current proposal really solves the right problems as it stands.

I do think that subject has the most legs of the new attributes, though, but surely it could be as simple as:


<div id="about">
<p>I'm Frances and I like to complain about things on the internet.</p>
</div>
...
<p subject="about">I own no cats. :(</p>

Let the subect do what for has done for label, but across all elements, tying wayward bits of information to an ID (or maybe simply use subject alone to tie pieces of information together - but then this starts to feel like a class job again).

Or an example with class in place of itemprop and using a pre-defined vocabulary:


<div id="vcard">
<p>I'm <span class="fn">Frances</span> and I like to complain about things on the internet.</p>
</div>
...
<p subject="vcard">I still own no cats. :( I do work for the <span class="company">BBC</span> though. </p>

My final concern, which actually could apply to HTML5 as a whole and is more of a general are we ready for this yet? thought, is that this is a lot for an author to consider. You look at the web as it stands now, and most of it isn't well written. Elements are abused, misused or completely forgotten (and attributes fair worse).

HTML5 offers a raft of new elements and attributes to aid clarity in information, accessibility and flexibility. Do we really think that authors on the whole have a great track-record of implementing the specs well? These new microdata attributes make what could already be a simple lesson (use class meaningfully) into a much steeper learning curve, watering down the overall benefit.

I'm not suggesting that that should be an excuse to not make HTML5 as rich as possible, but it should always be in mind that the web is about enabling normal people to share information - it's not just an intellectual experiment for web developers.

Microdata is in the early draft stage - so I realise things will change.

Disclaimer

It's well known that I'm a microformats busy-body, but this has nothing to do with my distaste for microdata as the spec stands. Sure, the two things have similar aims, but microformats has always been a solution for the here-and-now. HTML5 still "supports" microformats, and when HTML5 is ready, microformats will simplify (using the time element can't happen soon enough) and continue to do what they have always done. I like HTML5 and want it to succeed. I am in no way condoning microformats over microdata or generally comparing the two.

Metric/Conan Moccasin

Conan Moccasin

Pretty dull on the whole. Kept expecting them to really get going, but it just never happened. Best we could say about the lead singer was "sounds like a chipmunk" and they murdered a Teenagers cover. Oops.

Metric

Certainly can see the much more rocky direction they're beginning to take, and essentially it was a decent show. Disappointed that two albums were more or less entirely overlooked (I may occasionally want the moon on a stick, but I don't think it's unreasonable to show a bit of love to your early fans by playing more than Dead Disco.)

Metric at The Electric Ballroom, 19th May 2009

Della - Dell netbooks for women?

I recently opted to replace my first generation Asus EEE 701. It's very convenient and mostly functional, but I decided I wasn't finding it the best thing in the world for really Getting Stuff Done™ outside of sending a few emails.

I chose to get one of the new Samsung NC20s. I highly recommend it - it's really on the netbook/laptop border, but the larger screen size and resolution is worth that little bit extra weight (and at just under £400, it's a bargain too).

When I was selecting my new ultra-portable, the kind of things I had in mind were battery life, weight and form-factor (for carting it around to events), the specification (can I code and run photoshop?) and reviews of it's performance. The one thing I wasn't particularly interested in was whether it went with my handbag or shoes.

So why exactly have Dell opted to create their new "Della" site, which appears to be about specifically that one aspect?

The site is clearly aimed at women since it features lots of glossy photos of groups of ladies chatting over coffee and standing in fields staring thoughtfully off into the distance (or on the beach - because sand and cooling fans go so well), but it appears to assume that they're not interested in the specifications or technical features of the laptop - merely how pretty they look and how they'll help you lose weight or some other inane Heat magazine-esque topic. I'd call this patronising at best.

Perhaps they could be making a bigger deal of their "nipple" cursor controller and getting a few more blokes buying their mini range, just to be fair?

Oh, and my NC20 is an always classic little black number.

Update: Sounds like Dell have had a turn-around on the marketing campaign, pulling the name "Della" just days after it's launch (although a sneaky look at the website's mark-up still shows the della references throughout).

Slow Club/Jay Jay Pistolet

Jay Jay Pistolet

An unassuming man in a jumper far too warm for the tiny venue and hot lights, but a mesmerising acoustic set with 50s tones and twee lyrics.

Slow Club

Energetic, heart-felt and as good-humoured as ever. I genuinely can't watch them for long enough. Chair percusion and the occasional screw-ups add to their charm.

Slow Club at The Enterprise, 20th April 2009

Rewired State

I was lucky enough to get to attend Rewired State's "National Hack the Government Day" last weekend. It was a really good day and probably the best Hackday I've been to.

Things that really made it work:

  1. It was focused. Having a very specific set of goals makes it easier for people to come up with ideas, especially when it's only over the space of a day.
  2. It was in an office. Swanky new Guardian ones at that. As much as I like beanbags, they just don't fit for getting much work done. Having desk space just really felt productive and comfortable and felt more conducive to code.
  3. The group was small and selected. It might sound kind of pretentious to be selective about the attendees, but it worked. I've been to so many events where anyone could sign up, and the tickets have been taken by people who simply don't show up because there wasn't much incentive to (or they just weren't that committed in the first place) or the people that did show weren't necessarily relevant. RWS managed to get a busy group of people who were good developers and interested in the topic. Turn-out was excellent (350 applied, there were 100 places, and 80 attended).
  4. The atmosphere was friendly, productive and helpful. Everyone seemed really positive and interested in what everyone else was doing, and offered help and advice when asked. It was a good mix of skill-sets too.
  5. There was beer and pizza.
Personally, I didn't get much done. I'm not really an ideas kind of person - but I'm more than happy to help out someone else or just build what's given to me. Although there was a list of potential things on their wiki, it wasn't clear if those were being built by people already and such.

I think what would work really well at something like that is mixing it up with some of the BarCamp methods. A great thing about BarCamp is seeing the 2 day schedule go up on the wall, and it being filled in with hand-written (often decorated) cards of ideas and names - as soon as you stick up your own card, you feel a bit committed to actually making sure you get your talk done. Perhaps what Hackdays need is to get all the ideas written up on cards, stick them up somewhere, then let people move them into "Doing", "Would like to do" and "Rubbish/Off-topic" groupings etc. Then it'd be easy to see what's up for grabs, or if there's some people who want to do something but need a bigger team to get it done, and just generally get a buzz around what's going on in the room.

Cool things did come out of RWS though, and you can check most of them out on the project page. Work seems to be continuing on many of the projects, and quite a few were offered further funding at the end of the event too. Kudos to James and Richard (and everyone else) for such a successful event.

Older Posts

Newer Posts