Ăber-Semantics
Published on May 27, 2008 (⻠February 5, 2024), filed under Development (RSS feed for all categories).
This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.
Premasagar recently published a great demonstration of what can be considered âĂŒber-semanticâ code. I guess we can thank the microformats community here, which carefully avoids to rely on the semantics of HTML elements but instead uses non-defused classes for everything:
<div class="hentry hreview">
<div class="vevent entry-content item">
<address class="vcard">
<abbr class="fn author" title="Premasagar Rose">I</abbr>
</address>
<a rel="bookmark" href="https://example.com/statuses/555/">am</a>
<abbr class="updated" title="2008-02-17T15:30Z">now</abbr> at the
<abbr class="rating" title="5">wonderful</abbr>
<span class="description">
<a class="summary url entry-title" rel="bookmark tag"
href="http://barcamp.org/SemanticCampLondon">SemanticCampLondon</a>
(<abbr class="dtstart" title="2008-02-16">February 16</abbr> -
<abbr class="dtend" title="2008-02-17">17</abbr>)
<span class="vcard location">
<span class="fn org">Imperial College</span>
<span class="adr">
<span class="locality">London</span>
<abbr class="country-name" title="United Kingdom">UK</abbr>
(<span class="geo">
<span class="latitude">51.498</span>,
<span class="longitude">-0.179</span>
</span>)
</span>
</span>
</span>
</div>
</div>
The code translates to âI am now at the wonderful SemanticCampLondon (February 16 - 17) Imperial College London UK ( 51.498, -0.179 )â.
This sort of code is horrible. It should be questionable to everyone whether the end truly justifies these means. The only thing I like about microformats acting up like this is that I can keep this post short: Itâs crucial to get the HTML right.
About Me
Iâm Jens (long: Jens Oliver Meiert), and Iâm a frontend engineering leader and tech author/publisher. Iâve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, Iâm a contributor to several web standards, and I write and review books for OâReilly and Frontend Dogma.
I love trying things, not only in web development (and engineering management), but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (Please be critical, interpret charitably, and give feedback.)
Comments (Closed)
-
On May 27, 2008, 13:02 CEST, Premasagar Rose said:
Good point, Jens! This would indeed be painful to maintain by hand.
The demo was, of course, trying to illustrate the overlaying of multiple compound microformats, showing them in a super-condensed form, all enmeshed within each other. In practice, microformats are spread much more thinly in HTML.
-
On May 27, 2008, 20:38 CEST, Neovov said:
I totaly agree. Sometimes I fight against semantics extremist people.. Semantics with microformat and/or RDFa OK, but when itâs useful..
-
On May 27, 2008, 22:17 CEST, Jens Oliver Meiert said:
Premasagar, understood, Iâm glad that you donât see that as criticism against your work (it hasnât been)âyou uncovered this issue in a nice way.
Nicolas, absolutely. I like this, âsemantics extremist peopleâ đ
-
On May 28, 2008, 17:17 CEST, Duluoz said:
Hey I know, lets mix oil and water and expect a fantastic result like we did when we made that awesome website that incorporated microformats! đ
-
On May 28, 2008, 21:44 CEST, Dave said:
If the microformats community vows to never rely on the semantics of HTML elements, then why even use a combination of div / address / abbr / a / span ? Maybe there are technical limitations keeping them from including outright XML in pages the way theyâd like, but wouldnât it make much more sense to target those technical limitations rather than creating bad precedents that further entrench the limitations?
-
On June 2, 2008, 18:40 CEST, ManiquĂ said:
thanks to the microformats communityâs approach to never rely on the semantics of HTML elements
Is it there any other option? Current semantics of HTML canât do the job, or am I missing something? By now, the only option to add (desired) (ĂŒber) semantics is probably using ID and class names.
I agree that the code in your example looks monstrous.
Probably, no one will be hand-coding that code each time someone wants to publish his/her status, geolocation, etc.But then you can have a tiny app where you could just input the values (who, where, when, rating, etc) and then it spits out the âhorribleâ pattern. Like a CMS for microformats.
Why anyone would like to use that pattern? Who knowsâŠ
Maybe it can be picked up by another web 2.0 up that shows an smiley on a Google map.
But then, that is not our problem.As a side note, I canât think of any benefit of using microformats if they arenât used for re-using/feeding them somewhere else. One exception: it could be useful for humans looking at the code in 1000 years. HTML + classes (like microformats) are more future-proof semantics than
just HTML.Finally, I couldnât run a code to content ratio test to the Compound Microformats article. But I would bet it has a very low percentage.
-
On July 14, 2008, 14:16 CEST, Martin McNickle said:
The code to content ratio for the example is around 7%. Horrible..
â Martin
-
On August 21, 2008, 13:29 CEST, Drenthe said:
This looks more like an XML document lol
Read More
Maybe of interest to you, too:
- Next: Optional Tags in HTML 4
- Previous: Tip: vi Configuration
- More under Development
- More from 2008
- Most popular posts
Looking for a way to comment? Comments have been disabled, unfortunately.
Get a good look at web development? Try WebGlossary.infoâand The Web Development Glossary 3K. With explanations and definitions for thousands of terms of web development, web design, and related fields, building on Wikipedia as well as MDN Web Docs. Available at Apple Books, Kobo, Google Play Books, and Leanpub.