Classes Considered Harmful

After weeks of puzzling this problem, I've finally decided that
"classes" are to be considered harmful in markup. Why? The simple
reason is that they attach additional behaviours to markup [1], and
extend them in ways which should be done using (things like)
substitution groups and xsi:type denotations.

Consider: classes are (in XHTML) practically universal attributes.
They can apply to almost any element of worth. However, most of these
elements already have functions. What does it mean to attach a class
to an element that already has a function?

Let's allow QNames in classes, and see what happens:-

   <img class="xhtml:ul" src="abc.gif" alt="abc"/>

What's going on there? So surely classes only apply to elements that
don't have behaviours already attached to them, i.e. abstract
elements. But in that case, one should simply derive new element types
from the abstract elements.

I conclude that classes are simply hacks in languages which don't have
proper extensibility mechanisms, and hence should be wiped out.

No more classes!

[1] An express violation of "2.7 Don't overload the semantics of
individual elements" in XML GL,
http://www.w3.org/WAI/PF/XML/gl-20010706

--
Kindest Regards,
Sean B. Palmer
@prefix : <http://webns.net/roughterms/> .
:Sean :hasHomepage <http://purl.org/net/sbp/> .

Received on Saturday, 7 July 2001 19:28:57 UTC