W3C home > Mailing lists > Public > www-archive@w3.org > July 2001

Classes Considered Harmful

From: Sean B. Palmer <sean@mysterylights.com>
Date: Sun, 8 Jul 2001 00:30:23 +0100
Message-ID: <008201c1073c$cc86c0e0$a5d893c3@z5n9x1>
To: <w3c-wai-pf@w3.org>
Cc: <www-archive@w3.org>
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

This archive was generated by hypermail 2.3.1 : Wednesday, 7 January 2015 14:42:01 UTC