Everything your user types is important, even whitespace

A lot of software acts like it knows better than the user operating it

GUI HTML editors are especially bad at this, they will happily take the user’s input and completely rewrite it into something completely different that is supposed to look the same when viewed in a browser, most of the time nobody notices because after all HTML is supposed to be viewed in browsers.

But sometimes this HTML is part of a sample and I need the HTML itself to be nicely formatted in the “view source” window, sometime I have some special CSS or JavaScript and what you see in the browser for <b> (the HTML code for bold)will be completely different from what you see for <strong> (the HTML code that specifies – in a formatting independent way – that this text should be displayed using a “stronger” font, or in other words bold).

I often post source code on this blog, I copy paste the code into the editor and than I can spend significant amount of time trying to get the code to display just right right – and every time I carelessly switch the editor to preview mode in order to see if my latest change has the desired effect the editor will happily rewrite my code from the current partially formatted state to complete gibberish that looks a lot like partially formatted code when viewed in a browser.

While this post is mostly a rant about an unnamed HTML editor there is an important lesson here, two actually:

First, I should get a better HTML editor for posting to the blog, I’m working on that.

And second, if you write software treat everything the user enters into your software as important, preserve the user’s input formatting even if it has no effect on your programs output and whatever you do - don’t change anything without giving the user a way to undo your changes (Microsoft Word is pretty good at that, every time it automatically does something it will show a small symbol you can click on to undo the change).

posted @ Thursday, July 16, 2009 10:57 AM

Comments on this entry:

No comments posted yet.

Your comment:



 (will not be displayed)


 
 
Please add 6 and 7 and type the answer here: