Type info less valuable than label

Interesting quote from Tim Bray:

Historically, it would appear that it’s more valuable to know what something is called than to know what data type it is. That’s an interesting lesson.

That is interesting. Scripting languages have been doing great without strong typing for years. Tim brings this up as a reason XML and RDF have been successful where others have not fared as well (OSI and ASN.1). Yet the RPC model for SOAP invocations proposes to send type info within the XML document, intertwined with the data, in hopes that the receiving system will dynamically figure out how to handle it. Dynamically, because if we thought it was handled beforehand, say via the type info in the WSDL, we wouldn’t need to send the types along with every message.

Let’s get rid of this type business and treat the incoming message as what it is: XML. Parse the XML, deal with the data. Relax about strongly typing your fields; it doesn’t buy you much anyway. How many systems do you know that actually XML validate the message? At scale it doesn’t make sense, because type level validation is typically not enough anyway, so you validate a second time based on your business rules…

Strong typing in XML doesn’t buy you much, so relax about it. Consider the XML as the first class citizen, not an artifact of your serialization process.

Leave a Reply