Conventions versus Standards
What are Conventions?
The dictionary defines the word "convention" as this:
Convention: A rule, method, or practice established by usage; custom
For example [1], by convention street signs in the U.S. are placed at street corners, we expect to find them by looking up, not down, and we expect them to be horizontal, not vertical. The benefits of this convention are:
- We can locate street signs quickly, with a minimum of effort
- Their appearance makes it easy to distinguish them from everything else
Another example: by convention books have a table of contents that occur somewhere in the first few pages, page numbers are somewhere in the margins and they will look like a table of contents and page numbers.
What are Standards?
The dictionary defines the word "standard" as this:
Standard: Something considered by an authority or by general consent as a basis of comparison
For example, the XML specification is a standard. It requires, for instance, every XML document to have a root element.
Differences between Conventions and Standards
- Using a convention is advisable, but not required, whereas the things listed in a standard are required.
- Conventions are the product of a bottom-up, grassroots evolution, whereas standards are generated top-down by an authority.
Broadly Adopted XML Conventions
Here are some conventions that have been adopted by the XML community:
- Indentation is used to reveal the nesting structure of the document.
- Standard namespace prefixes, e.g. xsl: for XSLT documents, are used to qualify elements.
- Attributes are typically not associated with a namespaces.
- Metadata is encoded as attributes, rather than as elements.
- Elements and attributes are given meaningful names.
- Text that depends on markup for meaning is wrapped in tags, i.e. mixed content is avoided for data where the content is meaningless without the tags.
- Comments are used for things that are not relevant to the content.
Emerging Convention - Dereferenceable Namespaces
A convention that is becoming increasingly adopted, particularly by large standards organizations, is to use a namespace URI that is also an actual URL.
Acknowledgements
Thanks to the following people for their input to this document:
- Len Bullard
- Roger Costello
- Michael Kay
- Bryan Rasmussen
Last Updated: July 19, 2008
[1] The examples in this document come from the book Don't Make Me Think by Steve Krug.