namespaces-considered-harmful

From Microformats Wiki
Revision as of 20:35, 6 April 2009 by Tantek (talk | contribs) (provided evidence/citation/example for literal string matching a common namespace prefix usage)
Jump to navigation Jump to search

namespaces considered harmful

In particular namespaces for content are considered harmful (e.g. XML namespaces, QNames in attributes etc.). Namespaces for code is outside the bounds of the topic of this page.

Author/Editor: Tantek Çelik

namespaced content has failed

Namespaced content on the Web has failed.

It's been tried by numerous groups, before microformats, and after. It's even been tried in the context of RSS and RDF, and in practice people write scrapers that look for namespace prefixes as if they are part of the element name, or perform literal string matches on common namespace prefix uses (e.g. 1), not as mere shorthands for namespace URIs.

If you want to carry on a theoretical discussion of namespaces, please do so elsewhere, for in practice, discussing them is a waste of time, and off-topic for microformats lists.

namespaced content is not well supported

Namespaces are actually *not* well supported in sufficient modern browsers, nor even sufficiently with enough W3C technologies or test suites as compared to (X)HTML + semantic-class-names + CSS.

articles documenting the failure of namespaced content

The mixed namespace approach has already been tried by *numerous* others since 1998 and has failed on the Web.

implementation experience lacks beneficial anecdotes

As hsivonen noted in IRC 2008-08-01:

I had dinner with friends who write software. It seems to me that when people who have had to deal with Namespaces in XML can talk freely, they never have anecdotes about how Namespaces have helped them. Instead, they have negative comments. OTOH, devil's advocate scenarios where Namespaces could help come from people who don't have to deal with Namespaces as part of their work.

namespaces for content are a negative

Namespaces are actually a *huge* negative. Search for:

namespaced content discourages interoperability of data

Namespaces encourage people to seclude themselves in their own namespace and invent their own schema rather than reusing existing elements in existing formats. This hurts interoperability because a dozen different namespaces can all have their own slightly different semantics for the same element. See BuildOrBuy for support for this argument, specifically

Use somebody elses rather than making aliases on purpose. It's one thing to make your own and then discover that there's something equivalent out there. It's quite another to willfully clutter the semantic web with aliases; the latter increases the burden on the community of consuming your data, so it's anti-social.

If you start thinking about the web in terms of OOP and polymorphism, namespaces break the polymorphic model that allows you handle widely varied data structures using the same methods.

using namespaces cost a lot of time

From the #whatwg IRC channel on irc.freenode.net on 2007-10-25:

# [15:43] <hsivonen> I wonder how many hours in my life has been wasted looking up namespace URIs for copying and pasting

example of fundamental software engineering error

As othermaciej observed in IRC 2008-08-01:

Namespaces are an example of the Fundamental Software Engineering Error, which is that something too terrible to actually use can be fixed by adding a level of indirection. Sometimes that is true but software engineers try to do it even when it clearly is not.

non-namespaced techniques have been succeeding

On the other hand, XHTML + semantic-class-names (aka POSH) has seen widespread adoption among the web authoring/design/IA/publishing community. Microformats is leveraging the approach that is both working better and frankly dominating in practice on the Web.

more

Well, what about hAtom?

hAtom appears to use to namespaces. In particular:

  • entry-title
  • entry-content
  • entry-summary

It just looks like it uses an "emulates namespace" - the definition of those three items is so specific to the problem domain that we invented names specifically for that. For example, "entry-title" isn't any old title, it's specifically the Atom concept of a title. You could imagine a blog post semantically marked up where a "fn" is around the entry-title with some more information ("David Janes says...").

see also