Jump to content

A few words about errors


jeffman

Recommended Posts

Not sure.Browsers are supposed to do everything possible to parse code that contains errors. That's pretty easy when a body tag is missing after a head element is closed, or when a closing body tag is missing, stuff like that.It's more difficult in other situations. As an example, some browsers really fall apart when you put stuff in non-existent places, like this: </td>illegal location; these words might get displayed anywhere<td>.It's also likely that different browsers use different algorithms for parsing bad HTML, and that they change their algorithms for doing so over time. If your HTML has errors, but you kludge the page so it looks right anyway, next year's browser may parse the errors differently. Suddenly your page doesn't look right anymore.I think the bigger issue, if there is one, is that the very forgiving nature of browsers encourages many developers to never correct sloppy habits. If browsers continue to be forgiving, again, this may not be a problem.Or consider this. A lot of people get into programming with HTML as their gateway. HTML leads to JavaScript or PHP, which in turn may lead to Java or C++. If you're accustomed to an environment that tolerates sloppiness, you may have a hard time adjusting to an environment that tolerates zero or almost zero sloppiness.Maybe I'm like a lot of programmers and I just have OCD when it comes to sloppy code of any kind. This could be an unwarranted prejudice when it comes to HTML. Don't know. Mostly I found the "statistic" interesting.

Link to comment
Share on other sites

Maybe I'm like a lot of programmers and I just have OCD when it comes to sloppy code of any kind. This could be an unwarranted prejudice when it comes to HTML. Don't know. Mostly I found the "statistic" interesting.
Count me in that category! :) Error messages just plain bug the crap out of me. I'm also very particular about spacing and indenting my code to make it as readable as possible. I even have to write my DTD's a specific way:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

I can't stand it all on one line.And, yes, the statistic is interesting. Not really surprising, but interesting.

A lot of people get into programming with HTML as their gateway. HTML leads to JavaScript or PHP, which in turn may lead to Java or C++. If you're accustomed to an environment that tolerates sloppiness, you may have a hard time adjusting to an environment that tolerates zero or almost zero sloppiness.
I actually started the other way around. :) I got into programming through Visual Basic first, then C#, and then I started dabbling in HTML, JavaScript, and PHP. So that's part of the reason I'm so particular with my code.
Link to comment
Share on other sites

Well... in university, when they (tried to) teach us HTML, they did go on to saying that writing this in "a way that doesn't follow these rules" is not a good practice, invalid, and we should avoid it, even if the browser appears to display it fine... now if only they omitted the "font" element, the "background" body attribute and others, that would've been great. It's a good thing everyone already knew HTML better or knew who to ask for a better resource (guess who told them what :) ).

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...