Home > Store > Programming

larger cover

Add To My Wish List

Refactoring HTML: Improving the Design of Existing Web Applications

Register your product to gain access to bonus material or receive a coupon.

  • Description
  • Reviews
  • Sample Content

Product Author Bios

Elliotte Rusty Harold is an internationally respected writer, programmer, and educator. His Cafe con Leche Web site has become one of the most popular sites for information on XML. In addition, he is the author and coauthor of numerous books, the most recent of which are Java I/O (O’Reilly, 2006), Java Network Programming (O’Reilly, 2004), Effective XML (Addison-Wesley, 2003), and XML in a Nutshell (O’Reilly, 2002).

Like any other software system, Web sites gradually accumulate “cruft” over time. They slow down. Links break. Security and compatibility problems mysteriously appear. New features don’t integrate seamlessly. Things just don’t work as well. In an ideal world, you’d rebuild from scratch. But you can’t: there’s no time or money for that. Fortunately, there’s a solution: You can refactor your Web code using easy, proven techniques, tools, and recipes adapted from the world of software development.

In Refactoring HTML, Elliotte Rusty Harold explains how to use refactoring to improve virtually any Web site or application. Writing for programmers and non-programmers alike, Harold shows how to refactor for better reliability, performance, usability, security, accessibility, compatibility, and even search engine placement. Step by step, he shows how to migrate obsolete code to today’s stable Web standards, including XHTML, CSS, and REST—and eliminate chronic problems like presentation-based markup, stateful applications, and “tag soup.”

The book’s extensive catalog of detailed refactorings and practical “recipes for success” are organized to help you find specific solutions fast, and get maximum benefit for minimum effort. Using this book, you can quickly improve site performance now—and make your site far easier to enhance, maintain, and scale for years to come.

Topics covered include

•    Recognizing the “smells” of Web code that should be refactored
•    Transforming old HTML into well-formed, valid XHTML, one step at a time
•    Modernizing existing layouts with CSS
•    Updating old Web applications: replacing POST with GET, replacing old contact forms, and refactoring JavaScript
•    Systematically refactoring content and links
•    Restructuring sites without changing the URLs your users rely upon

This book will be an indispensable resource for Web designers, developers, project managers, and anyone who maintains or updates existing sites. It will be especially helpful to Web professionals who learned HTML years ago, and want to refresh their knowledge with today’s standards-compliant best practices.
This book will be an indispensable resource for Web designers, developers, project managers, and anyone who maintains or updates existing sites. It will be especially helpful to Web professionals who learned HTML years ago, and want to refresh their knowledge with today’s standards-compliant best practices.

Customer Reviews

9 of 9 people found the following review helpful
4.0 out of 5 stars A good review of xHTML standards for those already familiar with HTML, June 23, 2008
By 
Michael Rimov (Corvallis, OR) - See all my reviews
(REAL NAME)   
This review is from: Refactoring HTML: Improving the Design of Existing Web Applications (Hardcover)
First the good:
It is an _excellent_ tutorial on modern xHTML for those that have used HTML from its tag-soup beginnings. He methodically gives examples on why we, as web programmers, need to utilize a particular technology (CSS, Accessibility, etc). For example, he doesn't just say "Use CSS" because its the new way of doing things. He gives no-nonsense specific examples in bandwidth savings, alternate devices, etc.

His writing style is easy to read for computer geeks: a signature trait of any Martin Fowler signature series book.

He also provides a series of regular expressions that you can use to search through your HTML code to find problem areas and does a good introduction to the program "tidy". Since I am definitely _NOT_ a Regex geek, these are highly appreciated.

And finally, he shows usage of some xHTML tags and attributes of which I was not aware: such as proper usage of <acronym/> and <abbr/> tags.

Onto the... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


4.0 out of 5 stars use CSS and XHTML, May 12, 2008
By 
W Boudville (Terra, Sol 3) - See all my reviews
(VINE VOICE)    (TOP 500 REVIEWER)    (HALL OF FAME REVIEWER)    (REAL NAME)   
This review is from: Refactoring HTML: Improving the Design of Existing Web Applications (Hardcover)
The Web means mostly webpages written in HTML. The popularity of HTML is overwhelming. Yet it has well known problems. There is no intrinsic separation of semantic content from presentation details. And the tag syntax is very sloppy.

Harold explains in clear and strong terms why you should clean up your webpages. Mostly by using CSS and by making [and checking] that the pages are well formed and valid under XHTML. This is not a text on CSS, and if you are going to follow the precepts of the book, you will need another book, dedicated to CSS. The strength of Harold's message is in the clarity. He is trying to influence you in a top-down manner. To make these strategic decisions.

For example, by going with CSS, you simplify maintenance. Because files are factored into CSS files, which layout people can work on, and semantic content files, which can be the purview of others who are more involved with intrinsic information processing. The latter files also have the... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


9 of 15 people found the following review helpful
3.0 out of 5 stars Mainly for hardcore techies, May 23, 2008
By 
James Stewart (Grand Rapids, MI, USA) - See all my reviews
(REAL NAME)   
This review is from: Refactoring HTML: Improving the Design of Existing Web Applications (Hardcover)
Despite years of progress by web standards advocates, and a significant improvement in the quality of the HTML on the web, many of us still end up grappling with outmoded, broken HTML on a regular basis. When confronted with a large site filled with broken pages it can be hard to know where to start. Elliotte Rusty Harold's Refactoring HTML offers a step by step recipe book for migrating such sites to clean, semantic code.

Harold's is a well known name in the XML world, and that background shows through in how he approaches the book. While a general audience will probably find useful content, the reader needs to be prepared for a series of command-line and Java-based examples. Tools like tidy are featured prominently, as is the use of regular expressions to seek out broken code to fix and, in the music-to-my-ears category, automated testing.

If you're equipped to do so, following these steps will lead to much cleaner, more manageable sites, but I found myself... Read more
Help other customers find the most helpful reviews 
Was this review helpful to you? Yes No


Share your thoughts with other customers:
 See all 4 customer reviews...

Online Sample Chapter

How to Assure a Well-Formed Website

Sample Pages

Download the sample pages

Table of Contents


Foreword by Martin Fowler xvii
Foreword by Bob DuCharme xix
About the Author xxi

Chapter 1 Refactoring 1
Why Refactor 3
When to Refactor 11
What to Refactor To 13
Objections to Refactoring 23
 
Chapter 2 Tools 25
Backups, Staging Servers, and Source Code Control 25
Validators 27
Testing 34
Regular Expressions  48 
Tidy  54 
TagSoup  60 
XSLT  62 

Chapter 3 Well-Formedness  65 
What Is Well-Formedness?  66 
Change Name to Lowercase  69 
Quote Attribute Value  73 
Fill In Omitted Attribute Value  76 
Replace Empty Tag with Empty-Element Tag  78 
Add End-tag  81 
Remove Overlap  85 
Convert Text to UTF-8  89 
Escape Less-Than Sign  91 
Escape Ampersand  93 
Escape Quotation Marks in Attribute Values  96 
Introduce an XHTML DOCTYPE Declaration  98 
Terminate Each Entity Reference  101 
Replace Imaginary Entity References  102 
Introduce a Root Element  103 
Introduce the XHTML Namespace  104 


Chapter 4  Validity  107 
Introduce a Transitional DOCTYPE Declaration  109 
Remove All Nonexistent Tags  111 
Add an alt Attribute  114 
Replace embed with object  117 
Introduce a Strict DOCTYPE Declaration  123 
Replace center with CSS  124 
Replace font with CSS  127 
Replace i with em or CSS  131 
Replace b with strong or CSS  134 
Replace the color Attribute with CSS  136 
Convert img Attributes to CSS  140 
Replace applet with object  142 
Replace Presentational Elements with CSS  146 
Nest Inline Elements inside Block Elements  149 

Chapter 5  Layout  155 
Replace Table Layouts  156 
Replace Frames with CSS Positions  170 
Move Content to the Front  180 
Mark Up Lists as Lists  184 
Replace blockquote/ul Indentation with CSS  187 
Replace Spacer GIFs  189 
Add an ID Attribute  191 
Add Width and Height to an Image  195 

Chapter 6 Accessibility  199 
Convert Images to Text  202 
Add Labels to Form Input  206 
Introduce Standard Field Names  210 
Turn on Autocomplete  216 
Add Tab Indexes to Forms  218 
Introduce Skip Navigation  222 
Add Internal Headings  225 
Move Unique Content to the Front of Links and Headlines  226 
Make the Input Field Bigger  228 
Introduce Table Descriptions  230 
Introduce Acronym Elements  235 
Introduce lang Attributes  236 

Chapter 7  Web Applications  241 
Replace Unsafe GET with POST  241 
Replace Safe POST with GET  246 
Redirect POST to GET  251 
Enable Caching  254 
Prevent Caching  258 
Introduce ETag  261 
Replace Flash with HTML  265 
Add Web Forms 2.0 Types  270 
Replace Contact Forms with mailto Links  277 
Block Robots  280 
Escape User Input  284 

Chapter 8 Content  287 
Correct Spelling  287 
Repair Broken Links  292 
Move a Page 298
Remove the Entry Page  302 
Hide E-mail Addresses  304 

Appendix A Regular Expressions  309 
Characters That Match Themselves  309 
Metacharacters  311 
Wildcards  312 
Quantifiers  313 

Index  327 





 
Best Value

Book + eBook Bundle  $76.98  $47.19

Book Price $35.99
eBook Price $11.20
eBook formats included

Buy

This book is temporarily out of stock, but will ship for free when in stock.

Buy

Book  $44.99  $35.99

We're temporarily out of stock, but order now and we'll send it to you later.

This book is temporarily out of stock, but will ship for free when in stock.

Buy

eBook (Watermarked)  $31.99  $25.59

Includes EPUB, MOBI, and PDF
About eBook Formats

This eBook includes the following formats, accessible from your Account page after purchase:

ePubEPUBThe open industry format known for its reflowable content and usability on supported mobile devices.

MOBIMOBIThe eBook format compatible with the Amazon Kindle and Amazon Kindle applications.

Adobe ReaderPDFThe popular standard, used most often with the free Adobe® Reader® software.

This eBook requires no passwords or activation to read. We customize your eBook by discretely watermarking it with your name, making it uniquely yours.

Purchase Reward: One Month Free Subscription
By completing any purchase on InformIT, you become eligible for an unlimited access one-month subscription to Safari Books Online.

Get access to thousands of books and training videos about technology, professional development and digital media from more than 40 leading publishers, including Addison-Wesley, Prentice Hall, Cisco Press, IBM Press, O'Reilly Media, Wrox, Apress, and many more. If you continue your subscription after your 30-day trial, you can receive 30% off a monthly subscription to the Safari Library for up to 12 months. That's a total savings of $199.