Review: Refactoring HTML

Refactoring HTMLThere’s nothing more dispiriting than being stuck with maintaining an old website with hundreds of pages of rubbishy “Netscape 4″-era code. There can be an overwhelming number of things which need fixing or updating. You may well be tempted to think it not worth trying to improve things incrementally and instead plan for a major redesign at some indeterminate point in the future – which maybe you’ll never get the time or the money to undertake.

If you find yourself in this situation, then Elliotte Rusty Harold’s book Refactoring HTML: Improving the design of existing web applications will be a good antidote to “wait for the redesign” paralysis. The book encourages taking a gradual approach to converting your website to a modern standards-compliant state, rather than trying to do everything at once. I think this is a great area to write a book about, since it fulfils a need a lot of website managers will have. Designing and building new sites is fun and there are an awful lot of books available about this creation process. Maintenance and incremental improvement of old sites is distinctly unsexy in comparison and gets much less shelf-space.

The book is a compendium of stuff, most of which you’ll probably already know you should be doing. It’s arranged with subjects listed in a cookbook fashion – covering why you want to make each change, potential trade-offs and the mechanics of how to carry out each improvement. The first chapter is an introduction to the subject of refactoring, which is a programming concept that may be new to a lot of web designers.

“Refactoring is the gradual improvement of a code base by making small changes that don’t modify a program’s behaviour, usually with the help of some kind of automated tool. The goal of refactoring is to remove the accumulated cruft of years of legacy code and produce cleaner code that is easier to maintain, easier to debug, and easier to add new features to.” From “Refactoring HTML”

In the second chapter, there is a thorough overview of automated tools you can use for refactoring. A lot of the information here is going to be of more use if you’re a programmer. However, the discussion of regular expressions should be of use to anyone who has to deal with outdated HTML code. It’s backed up by an appendix which provides a beginner’s guide to regular expressions. Throughout the book there are specific regular expressions supplied for fixing particular problems which will be hugely useful to non-programmers like me who find writing their own regular expressions a pain.

Chapters 3 and 4 cover all the aspects of well-formedness and validity in HTML documents. The author is sensibly not insistent upon validation for its own sake and on several occasions gives examples of times when it may be pragmatically better to go for an invalid option. He also points out where the standards don’t actually make much sense – the rule that block quotes can’t be within paragraphs is one example discussed which has always really annoyed me.

Chapter 5 covers layout, with some discussion of replacing table layouts and frames-based layouts with CSS. However this is definitely not a design-oriented book and its CSS advice is limited to providing some basic layouts and advising that CSS is ‘very much a technique for full-time professionals”.

The book continues with a nice-to-see chapter on accessibility and a section on web applications. The latter includes an interesting section on Web Forms 2.0 types as well as solid advice on older topics, like when to use POST or GET and the need to escape all user input. Finally, there’s a chapter on content which – like the section on layout – is pretty basic. Still, it’s nice to see an emphasis on the need for correct spelling in a book that seems to be aimed primarily at coders.

Refactoring HTML as a whole is certainly useful for anyone managing a badly-coded site, especially if they haven’t thought much about ways to semi-automate testing and improvements.

Refactoring HTML: Improving the design of existing web applications by Elliotte Rusty Harold is published by Addison-Wesley.

Review: Building Findable Websites

Building Findable Websites: Web Standards, SEO and Beyond by Aarron Walter is a book that I’ve got a lot out of. Its full of useful material which should be of real practical help to people involved in any facet of a web project. It has a refreshingly holistic approach which looks at website findability in the widest possible manner, avoiding the narrowly doctrinaire perspective of some writings on web standards, SEO or accessibility and including lots of examples which are immediately useful in the real world.

His wide-ranging remit means that the book will probably be most appreciated by webmasters or web project managers whose roles involve them needing to straddle a range of disciplines. Web developers, designers or SEO gurus may perceive some of it as unfocused as it switches rapidly between generalist explanations and low-level technical examples, with topics covered ranging over coding, server administration, marketing tips and WordPress implementations. However, this variety appealed to me and should ensure that most readers are going to learn at least something new about areas they may not know so much about.

After introducing the author’s concept of findability as a discipline, the book starts by discussing markup strategies. The importance of web standards and accessibility are predictably emphasised, but there’s also a spirited defence of the benefits of web standards for SEO which is interesting. The book then moves into a discussion of server-side strategies for findability with advice on domain names, search engine friendly URLs, redirects, 404 pages, optimizing performance and controlling search engine indexing.

The middle section of the book discusses content creation for findability and then includes a whole chapter on findability for blogs. This was probably my favourite single section and includes lots of specific stuff about using WordPress. There’s then a chapter on adding search to your site. This discusses a range of options, including both free and paid-for solutions. For me personally, the most useful tip in the book was on page 156 in this section. Here you can find out how to implement Google Custom Search Engine so that users who don’t have JavaScript won’t get an empty search results page, without having to direct all users to search results hosted on Google’s site. The apparent reliance on JavaScript had been putting me off using Google CSE where I wanted to integrate it into my own sites, so this was really useful to me.

The book continues with a look at solving findability problems with JavaScript, Flash and audio / video content. It then moves onto an overview of mailing lists before concluding with a chapter on “Putting Findability Into Practice”, emphasising the need to adapt the techniques introduced in the book to the specific needs of your own projects.

In general, the book’s got a nice readable style. The expected experience level of readers is pitched at “Intermediate to Advanced” according to the back cover and people just starting out may find some of the more technical stuff a bit daunting. However, there’s a decent effort made to explain even the more complicated concepts and beginners could still learn a lot. Good references are included to further reading and also to some relevant podcasts – which is something I really appreciate when authors include.

The companion site is a great addition to the published book. It includes a comprehensive list of links to useful resources and a further five chapters of the book available free. I thought the chapter on web traffic analysis was a particularly good introduction to the topic, but all of the free chapters are worth reading. There is also a Findability Strategy Checklist which acts as a quick reference for the topics covered in the book. This is a nice practical tool which could be useful for any web project.

Building Findable Websites: Web Standards, SEO and Beyond is by Aarron Walter and is published by New Riders.