What good are standards if we don’t follow them?

Written by corrodedlotus | Published 2018/04/12
Tech Story Tags: development | programming | thoughts | standards | coding

TLDRvia the TL;DR App

From Randall Munroe’s XKCD comic: https://xkcd.com/927/

Recently, I have been working on a project where I had to deal with a bunch of agencies that use a standard format of XML called REAXML. You can see the ‘standards’ here. Let’s talk about what’s good about this. For one, almost every real estate agent in Australia uses this format to send their property data to a bunch of websites (including theirs), and this is great. That means everyone uses the same format, and everyone’s data is compatible with each other, right?

Wrong.

You see, REAXML has a very lenient standard. It accepts a wide possibility of inputs and values — so much that it hurts. Here’s an example: a property can have multiple ‘features’ in it like a fire place, pool, air conditioning, etc. If you do want to show that a property has those, it is as easy as adding it to a features node like so:

<features><airConditioning>1</airConditioning><openFirePlace>yes</openFireplace><pool>2</pool></features>

Eas — wait, what?

Yes. All three examples basically mean “it has ____”. If you don’t believe me, have a look!

A whole number greater than or equal to zero is accepted as valid. Any value greater than 1 is considered to be 1. Alternatively, yes or true are accepted, while no or false are counted as not present. An empty value is considered as there being no air conditioning present within the property.

Okay. So to say that you have a property that has air conditioning, you can either give the node a value of 1, yes, true, or any other positive whole number. WOW.

I know most of these were done by a whole team of very intelligent people, most likely smarter than me. I do understand that some agencies will probably want the option to say “This property has 2 pools and 3 fire places”, but since this is an XML file anyway, why not just add it as an attribute and keep the value as a boolean? And by boolean, I mean ONE OR THE OTHER: TRUE or FALSE. Not 1 or 0. Or yes or no. I mean that just creates a whole lot of complexity in everyone else’s code / interpreters!

Here they are, having almost a monopoly on all the agents and basically forcing them to use REAXML, but why are we being lenient? For me, a standard is a set of hard rules.

A quick google shows us the definition of “standard”

From the result of a quick Google, we see the first two definitions of “standard”: a level of quality or attainment and something used as a measure, norm, or model in comparative evaluations. Quality. Norm. Both these words scream “strict” to me. If you have a standard, BE STRICT ABOUT IT! Everyone is following you anyway, so why not just force it down their throats? “Hey everyone, since you’re all beautiful and smart people, FOLLOW THE RULES!”

This actually triggered a bunch of flashbacks from my early days of being a front end developer: the W3C Standards. Who remembers IE6?

So the problem is, even if we had W3C to set the standards, the browsers all had their different opinions and implementations! Take a look at the box model before. How can it be a standard if everyone is using a different version of it anyway?

Without a consensus, everyone loses. Everyone will now have to cover x other cases that were not in the format they were using. I remember back in the early days of CSS3 — border-radius was quite a new property and not all browsers supported it. They then all had the brilliant idea of just implementing their own, so Mozilla (Firefox) had a vendor prefix of -moz and the Webkit browsers (Chrome and Safari) both had -webkit.

So much for standards!

Solutions?

To be honest, the XKCD strip above summarizes it best. The usual solution is to create YET another standard. But is that really the solution? I think the solution is to just follow the standard. If there is confusion to something, then fix it. It means that the standard might be too vague or it has too many options (like the boolean option in REAXML above). Just be strict, enforce it, and follow it. Spread the word and the knowledge.

If you find yourself using a standard and another person or organisation is using it but with different interpretations, then it is a sign to start a conversation — because you might both be doing it wrong.


Published by HackerNoon on 2018/04/12