Spatacoli
Jeff Atwood blogged about a problem he is having with HTML sanitization on Stack Overflow. The argument that Dare Obasanjo and Jon Galloway were trying to make to Jeff is that it doesn’t make sense to re-invent the wheel. People have solved this problem before and their code is available for re-use. Jeff’s argument is that he’s a professional developer and he should be able to solve this problem. He punctuates his argument with a quote from Richard Feynman, “what I cannot create, I do not understand.”
This is a fine argument if Jeff were a Nobel Prize winning Physicist working on the fundamental building blocks of the Universe. However, and I’m sad to report this, he isn’t. Software Development is not science. Some of us may use the scientific process for finding and fixing bugs, but at its heart software development is an engineering profession. What that means is that most of the hard problems have been solved before. Although it is important to understand how the solution works, it isn’t necessary to re-invent the wheel.
For example, given the inspiration and the need I could rewrite jQuery, but I don’t. Why? Because someone else who does have the time and inspiration already did it. More importantly, many thousands of people have already used it and reported enough bugs on it to make that library very stable and robust. The important part of this example though is that at any time I can, and have, opened it up and read through the code to make sure that it makes sense to me. I’m not proposing that Jeff use someone else’s HTML scrubber blindly, I’m saying he should use someone else’s HTML scrubber after reviewing it for himself to ensure that it meets his quality bar.
I also chose jQuery for this example because Jeff uses it extensively on Stack Overflow. He did not go out and write his own. In fact Jeff also uses the ASP.NET MVC framework, the ASP.NET framework, and the .NET Framework. All of these are software that he could have written given enough time and inspiration. At some point it comes down to ego. An HTML scrubber is a simple enough thing that he should be able to write it, but he really shouldn’t.
Posted: 17 October 2008 by Todd Anthony Spatafore
Hello out there in Internet-land. There is a shocking number of you coming to my web sites using Internet Explorer 6. I don’t think that you realize that a lot has happened in browser technology since August 27, 2001. You see, that date almost 7 years ago is the day that Internet Explorer 6 was released. At the time it was a fine browser, but that time has passed. It is time to move on.
Please note that on this blog, the navigation on the side does not appear in IE6. You may be wondering when I’m going to fix that. The answer is simple, I’m not planning on fixing it. There are 3 other released browsers out there that run perfectly well on the Internet today. I would suggest you download one of them. There are 2 browsers coming in the very near future that will hopefully make massive changes to the way the web works, but most developers still have to account for the lowest common denominator, and that would be you IE6. You are the lowest common denominator.
I drink the Microsoft Kool-aid every single day and even in my sleep, but just like I don’t run Windows 2000 anymore (and only use XP begrudgingly at work) I also don’t use IE6. From this day forward I’m going to take the Apple approach to IE6. If it doesn’t work, oh well. (notice all the transparent PNG’s that don’t work in IE6)
So what browser do I recommend you upgrade to? Well of course I’m going to suggest Internet Explorer 7. You already use IE6, you may as well stay in the family. If you are falling into that trap of the haters out there that say all IE’s are evil (they aren’t) and you don’t trust me on IE7 (although you should) then I suggest Safari 3. “Like OMG! Todd just suggested an Apple product, and now has more links to Apple on this blog than to Microsoft.” Yes, I use Safari. I use it a lot. It’s a really good browser, and I like the way it renders fonts. However, Silverlight is not officially supported on it (the Windows version anyway, the Mac version is supported). Finally, I’ll give you the obligatory link to Firefox. I don’t like Firefox. I used to use it exclusively before they released version 1, but now there are too many fanboys out there that think this is the greatest thing since Tim Berners-Lee invented HTMLD.
So, now you have no excuse. I’ve given you the links, and I’m thinking that sometime between now and August 27 I will just redirect all IE6 users to this blog entry.
Next up, I’ll try and find out why some people are still on Firefox 1.5. There is no reason for that mess either. Upgrade! This is the Internet, anything older than 3 years is ancient.
Posted: 14 June 2008 by Todd Anthony Spatafore
A friend of mine just launched a new business venture called stackoverflow. Jeff will be doing what he does best, and hopefully that will mean that we can contract him out to help us from time to time.
The reason I'm blogging about it here is his web site was clearly just thrown together to get it up on the web. For someone who spends his day finding new ways of dampening the sound on his Rock Band drum kit, I would think he'd be a little bit more 21st century (or even Web 2.0) about his web site.
Granted the web site is just an image and some text, the interesting thing here is the code. View source on his web site and you will find an example of an HTML technique that I thought was left back in 1996. That is he is using an unclosed paragraph element for spacing the text blocks on his page. Paragraph elements are for paragraphs.
"The P element represents a logical paragraph"
Although in HTML it does not need to be closed, it seems to have been the best practice since about the time people were really hot on migrating to XHTML.
Because my wife is standing here telling me I can't just insult Jeff's new web site, I've decided to correct the HTML. Jeff, if you read any of my blogs, this is for you:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>stackoverflow</title>
<meta name="description" content="Stackoverflow is sort of like
the anti-experts-exchange (minus the nausea-inducing sleaze and
quasi-legal search engine gaming) meets wikipedia meets
programming reddit." />
</head>
<body>
<div style="text-align:center; margin-top:100px;">
<img src=
"http://img510.imageshack.us/img510/7056/
thenamiracleoccursbx8.png" width="435" height="496"
alt="I think you should be more explicit here in step two."
title="I think you should be more explicit here in step two." />
</div>
<h2>Wondering what stackoverflow.com will be?</h2>
<p>Listen to <a href="http://www.stackoverflow.com/audio/
stackoverflow-podcast-001.mp3">the first stackoverflow
podcast</a> with <a href="http://www.joelonsoftware.com/">Joel
Spolsky</a> and <a href="http://www.codinghorror.com/blog/">Jeff
Atwood</a>. (MP3 file, 8.32 MB, 46:12).</p>
<p>If you'd like to submit a question to be answered in our next
episode, record an audio file and mail it to <a
href="mailto:podcast@stackoverflow.com">
podcast@stackoverflow.com</a>. Remember, it <em>must</em> be an
audio question -- 90 seconds or less, please.</p>
</body>
</html>
Posted: 16 April 2008 by Todd Anthony Spatafore
Last time I explained why you shouldn't use <B> and <I> and alternatives that are semantically correct. Today I'd like to complain about the over-use of <BR /> in the web.
<BR /> is a line break. Some people just type <BR> and they shouldn't do that. You should always close your tags, even if they are empty. I'm happy that more than half of the BR's that I see are closed, but at the end of the day they shouldn't even be used.
<BR /> is a line break. Yeah, I know I just said that but the thing is that <BR /> is a line break. Was the third time the charm on that one? No? Well, how about this: A line break isn't data. It is formatting. There is no semantic value in <BR />. You wouldn't sell a stock because the stock price had a line break in it. You wouldn't change medication because the news report on it had a line break in it. It is purely formatting.
What have I said about formatting? It belongs in the CSS, not in the HTML. HTML is for data only. For that reason the next tag that I am going to eliminate from my vocabulary is:
<BR />
(Bonus cool points if you found my ironic use of a line break above funny.)
Posted: 26 September 2007 by Todd Anthony Spatafore
In the first of what I am sure will be many posts regarding HTML, I would like to bid farewell to my old friends <B> and <I>.
You may find them in various places on my current web sites, but from now on they will just be elements that I once ran with. The reason is that they hold no semantic value, and they really are just elements for styling the data. The web is comprised of three legs: HTML, CSS, and JavaScript. (I really need a graphic for that... maybe I'll work on that as well.) These three legs nicely separate data, style, and function. There really shouldn't be any mixing of rights between them.
Some people may think that the proper usage is to replace <B> with <strong> and <I> with <em>. In most cases that is correct, but not for the reason they are thinking. Although many browsers default to displaying <strong> as bold text, the reason to use <strong> over <B> is that semantically you are marking that bit of data as important. The same is true with <em>, you are trying to emphasize that bit of data so you surround it with the <em> element.
You should not rely on the browser's default for styling these two elements. Proper use of CSS will ensure that these two tags appear the way you want them to, but that is a CSS discussion. Remember, HTML should only contain data. HTML is not the place for style or functionality.
Posted: 24 September 2007 by Todd Anthony Spatafore