When does a site start to stink? When do you know it’s time to refactor? These are questions I’m considering in Chapter 1 of my new book, Refactoring HTML. Here are some of the smells I’ve already written about:
- Illegible code
The most obvious symptom is that you do a view source on the page and it might as well be written in Greek (unless of course you’re working in Greece). Most coders know ugly code when we see it. Ugly code looks ugly.
- Slow page rendering times
If any major browser takes more than half a second to display a page, you have a problem. This one can be a little hard to judge, because many slow pages are caused by network latency or overloaded databases and HTTP servers. These are problems too, though they are ones you cannot usually fix by changing the HTML. However, if even a page saved on a local file system takes over half a second to render in the web browser, then you need to refactor it to improve that time.
- Pages appear different in different browsers.
Pages do not need to look identical between browsers. However all content and functionality should be accessible to everyone using any reasonably current browser. If the page is illegible or nonfunctional in Safari, Opera, Internet Explorer, or Firefox, you have a problem. For instance, you may see the page starting with a full screen width sidebar, which the content pane follows. Alternately the sidebar may show up below the content rather than above it. This usually means the page looks perfectly fine in the page author’s browser. However he or she did not bother to check it in the one you’re using. Be sure to check your pages in all the major browsers.
- Pages require dangerous or non-standard technologies.
- Your company’s home page suddenly says, “Pwned by Elite Doodz.”
Web site defacements are a major wakeup call, and one that gets everybody’s attention really quick. There are a number of reasons this can happen, but by far the most common is a code injection attack directed at a poorly designed form processing script.
- Your first appearance on Google is on p. 17.
Search engine optimization is a major driver for web site refactoring. Search engines value text over images, and early text over later text. They don’t understand table layouts, and they don’t much care for ????.
- The CEO can’t fill out his travel expense vouchers.
Usability on the Web has improved in the last few years but not nearly as much as it can or should. All but the best sites can benefit by refocusing more on the readers and less on the writers and the designers. A few simple changes aimed at improving usability can have disproportionately great returns in productivity. This is especially important for intranet sites, and any site that is attempting to sell to consumers.
- Readers send e-mail saying your site is broken
This is one of the absolute best ways of finding out you have a problem.
What would you add to this list? What else tells you you have a problem? Comments appreciated.