TechBookReport logo

Keywords: HTML, web design, CSS

Title: Refactoring HTML

Author: Elliotte Rusty Harold

Publisher: Addison Wesley

ISBN: 0321503635

Media: Book

Level: Beginner/Intermediate

Verdict: Useful


In addition to authoring a number of best-selling Java and XML books (including Processing XML With Java, Java I/O and Effective XML), Elliote Rusty Harold is also the seasoned webmaster of the Cafe au Lait and Cafe con Leche websites (specialising in Java and XML respectively). As such the day to day reality of having to maintain and update page upon page of HTML code is one that he is intimately familiar with. The sad fact is that web sites accrue cruft in the same way that software does. And how do you tackle de-crufting software? You refactor it. And, in the same way Harold suggests that web sites need refactoring too.

The approach that Harold outlines in this book is well-structured and can be implemented incrementally rather than requiring a big-bang approach. At the heart of it is the need to move towards standards based web sites. Specifically this means moving to XHTML and CSS, with a clear separation between structure and layout. And, as with software refactoring, the emphasis is on discrete steps that make changes without breaking the application (or web site).

Like other books on refactoring this one focuses very much on the concrete rather than the purely theoretical. The book includes numerous refactorings, from things like replacing the bold tag with the strong tag, to replace HTML GET with POST. So you get both the big picture of what to do and the small steps necessary to get from an existing messy site to one that is cleaner and more maintainable. He also makes the point that a cleaner, standards-compliant site is going to be easier to spider, which can improve site rankings.

Harold also takes time out to explain why all of these refactorings are necessary. He very clearly outlines the benefits of XHTML versus HTML, of CSS versus mixing presentation and content in vanilla HTML and so on. Additionally the book introduces a number of essential tools that aid the refactoring process, including validators, unit testing and of course the ubiquitous HTML Tidy.

While there's nothing radically new in this book - in fact it's hard to find a book on web development that doesn't champion XHTML and CSS - the emphasis on how you move existing web real-estate makes this one different. The concepts are clearly explained and the advice proffered is definitely on the useful side. Definitely worth a look for those who've built up or inherited an existing web site that needs maintenance.

Hit the 'back' key in your browser to return to subject index page

Return to home page

Contents © TechBookReport 2008. Published November 03 2008