Unintended Consequences

In the comments to my last post, AC takes me to task for what is arguably some strange behavior in Word compared to the way other word processors behave. Rather than just reply to AC in the comments to my previous post, I thought I’d take the opportunity to illustrate how the law of unintended consequences is always there to bite you in the backside with any feature decision you make.

Basically, you can see what AC’s talking about through the following steps (items in angle brackets, <>, refer to keys on the keyboard or buttons in dialog boxes):

1) Boot Word

2) Type “This is a heading<return>”

3) Type “=rand()<return>”

4) Place the cursor in the first line of text that reads “This is a heading”

5) Format/Style, select “Heading 1” style,

6) Place the cursor at the beginning of the first paragraph after the “This is a heading” line.

7) Hit the <delete> key (<backspace> key if you are the one Win Word user reading my blog).

Result: The text of the paragraph after the “This is a heading line” takes on the formatting of the Heading 1 style.

To understand why this happens, we need to understand something about Word’s styles. Every paragraph in Word has a style. The default style is the “Normal” style. These styles are analagous to cascading style sheets in HTML. In fact, if you save a Word document as HTML (even display-only, or “filtered” in Win Word terminology) and look at the HTML in a text editor, you’ll see that Word wrote the styles as CSS.

Word’s style feature is as powerful as HTML’s CSS. In fact, if you think in terms of using styles to mark document structure (of which the Heading 1 style is an example), then you can use styles in much the same way someone might use XML tags in a document type definition. The power of this feature is that you can change the entire look of your document simply by changing the formatting that’s included in the styles you’ve used to mark the document’s structure. Word has a bevy of pre-defined styles that you can use to mark document structure. To see the list, select “Style…” from the Format menu, and select “All styles” in the “List” dropdown on the left-hand side of the dialog box.

OK, so back to AC’s problem. The line that contains “This is a heading” is in its own paragraph, and has its own paragraph style. The following paragraph is in the Normal style. The effect of step 7 above is to delete the paragraph mark at the end of the “This is a heading” line of text. To see this happening, there’s a button on the standard toolbar that will show paragraph marks. The icon on the button shows the paragraph mark symbol (a backwards “P” with two vertical extenders rather than one). If you click on that button, every paragraph mark in the document will be shown using the paragraph mark symbol.

This is where the law of unintended consequences comes into play. If the user deletes a paragraph mark that separates two paragraphs where each paragraph has a different style, Word can’t keep both styles applied to the text. A paragraph can have only one style. In this scenario, Word, essentially has three options:

1) Simply leave the resulting single paragraph with the style that was applied to the surviving paragraph mark. The problem with this solution is that the text before the insertion point (the blinking carat) suddenly takes on the formatting of the text that follows the insertion point.

2) Apply the style of the deleted paragraph mark to the surviving paragraph mark. The problem with this is that the formatting of the text after the insertion point suddenly takes on the formatting of the text that’s before the insertion point. This is Word’s current behavior, and I’ll explain why in a second.

3) Keep the font formatting from the style of the deleted paragraph mark, but change the underlying style to that of the text that’s after the paragraph mark. To see the problem with this approach, consider the steps above. The text that reads “This is a heading” would still look llike it had the Heading 1 style applied, but it wouldn’t. It would have the Normal style applied.

Option 3 might seem like the right thing to do, and, no doubt, it’s quite likely what AC wants Word to do, but it involves Word changing things in a way that’s not obvious to the user. The stuff that had been marked as a heading is no longer a heading, but it still looks like it is. Doing this runs counter to the very concept of styles, which is that the style should reflect the structure of the document, not the formatting that the user wants. Usually, if the user just wants the text to have a certain look, rather than have it reflect structure, then the user will apply direct formatting rather than use styles.

After rejecting option 3, it might seem like option 1 would be the right thing to do. And, in fact, a long time ago, Word used to behave this way. If you delete a paragrph mark, the formatting of both paragraphs took on the style of the surviving paragraph mark. However, during some usability studies we discovered that this is not what most users wanted to have happen.

Most users know that when they place the cursor at the beginning of a paragraph and hit the <delete> key (<backspace> on a Windwos PC keyboard), they’re joining two paragraphs, but, conceptually, they think they’re joining the text that’s after the insertion point to the text that’s before the insertion point. What they want, from a structure point of view, is for the text that’s after the insertion point to take on the structure role of the text that’s in front of the insertion point.

What does this have to do with the law of unintended consequences? Well, when we decided to add font formatting to paragraph styles, we created a situation where, no matter what Word does, some users aren’t going to be happy. It’s not something we intended to do, but it’s an unavoidable outcome of the design decision we made. As my father-in-law would say, “You'll have that.”

For those of you who don't use styles all that much, here’s a tip: select styles based on document structure not based on the “look” that the style gives you. If you don’t like the look of a style, modify the formatting attached to the style—a task we’ve made a lot easier and much more intuitive in Word 2004.

Rick