As the guys around the office are well aware, I tend to obsess over minor details in our code. Whether it be fixing code formatting to be tabbed properly or renaming variables to better fit naming conventions of a project, the developers hate when I meddle in the codebase. Is it my fault that sometimes I miss a few when I go through and rename variables, functions, methods, etc? Clearly, no. The joys of being the boss.

But what I really want to discuss is something I don’t consider so minor, complying with web standards. Most times when I am doing web development I prefer to go with the HTML 4.01 strict doctype. We try to observe strict standards wherever we can, and they have helped us to avoid patterns of behavior that are more prone to errors. We make sure that notices and E_STRICT are enabled on the PHP side. While developing, our templating system is set to validate our markup against its doctype in a very angry way that we both love and hate. The added benefits of sticking so closely to the standards is that you can pick up errors through malformed output that browsers obfuscate, and you can achieve a greatest amount of compatibility between browsers. As any good website designer knows, creating web pages that render the same in every browser can be a royal pain (thanks Microsoft).

I greatly advocate every website and web application be created to conform to the W3C standards. The tricky part is selecting the appropriate doctype for your needs. In recent years there has been a huge increase in the number of websites and applications being published with an XHTML doctype. The problem is that most people probably aren’t aware of the true difference between XHTML and HTML doctypes. They believe that XHTML is merely the next iteration of the HTML doctype and therefore should be used without question. This is wrong and dangerous thinking. Shame on you! Didn’t your mother teach you to understand the tools you use before you start using them?

There are many differences between XHTML and HTML but the biggest and most important in my opinion is that XHTML isn’t even properly handled or supported by IE. In many of the XHTML websites which I visit, developers are better off using good ol’ HTML doctypes. Without taking proper steps your XHTML page is effectively being served as text/html tag soup. The number of people that actually use XML in their XHTML documents is slim. I would say even less than the number of people that use XML in their AJAX.

Some web applications such as WordPress are perpetuating this bad practice by forcing people to use an XHTML doctype merely by way of the generated code that it spits out. Web app developers: if you are going to release an application that can be merged into someone’s website then give them the option to toggle between doctypes. It might also be wise to provide some mechanism for validating plugins and allowing them to be toggled as well. Just a thought…

As I said, I am a stickler for details. Applications that are going to be integrated into my projects better be up to snuff in terms of being fully compliant with these standards or else end-users like myself (and there are a lot of sticklers out there) are going to start shopping elsewhere, forking versions, or just rolling their own from scratch.

Posted in: Design, Rants