on Mar 2, 2007
In yesterday’s post I had some fun at the expense of XML coding standards. I linked Eric Meyer in that post. Upon later reflection, I thought this might be seen as a little rude – akin to linking Steven in a post lampooning anime as trivial cartoons and a waste of time. He was a good sport about it, and if I irritated him he didn’t let on.
I admit that my post was mostly just me mocking what I do not understand. A few people pointed out some perfectly good reasons for coding standards and what they have to offer a web developer. I know coding standards are very important in C++ (my day job, as it were) and and I would balk if someone suggested that coding style was just needless fussing. If you mean to maintain a couple of millions of lines of code, you had better have some sort of clearly-defined standards or those lines of code will very quickly devour you. You will be a lion tamer who just showed up without his whip and covered in barbecue sauce. You’re screwed.
I’m sort of getting my head around the concept of keeping the information seperate from formatting, and while I would never try that myself I admit that I’m not exactly dealing with a huge collection of pages here. (I coded this theme pretty much from scratch, and when I did so I thought of it as writing PHP, not HTML.) The need for this thing probably emerges as the job gets larger. Following strict standards for a site like mine would probably be like hiring an architect and a contractor to build a wooden crate.
Anyway, I pretty much get it up to a point, although there is one thig I don’t get, which is replacing TABLEs with DIVs. Maybe a CSS Jedi can explain this one to me. Most WordPress themes – as in, 99% of the themes I’ve seen – use DIVs for layout. The problem is that divs and tables have different failure modes. The typical theme is something like a page with a 500 pixel column and a 200 pixel sidebar. With divs, if the unwitting user posts an image that is 501 pixels wide, the sidebar gets bumped all the way to the bottom of the page. Or shift to the opposite side. Or suddenly go underneath the main column. This can be maddening for the user to figure out. Worse, this is really where browsers diverge in behavior. It might work just fine in Firefox, but in IE the sidebar will go missing. If that sidebar is used to help put other stuff into position, then very quickly the entire theme collapses like a house of cards and you’ve got content all over the place. But only in some browsers. This is very common, and the reason I abandoned public themes for something I made myself. I got tired of capricious puzzle themes that would spew content when they broke.
With tables, the wide image will just force the cell to go a little wider. Maybe this will introduce a seam elsewhere. Maybe it will bring about a few pixels of horizontal scrolling. Maybe it will work just fine. In any event, the cause of the problem is much easier to spot. I couldn’t figure out how you could reproduce this more graceful behavior using CSS. Maybe CSS isn’t robust enough to do this, or maybe there are attributes theme authors don’t know how to use properly. Keep in mind that when you’re designing a theme, you’re writing code to be used by people with a lot less expertise than yourself, who may not know the “rules” of your theme. Graceful failure with a clear cause becomes an important issue.
Maybe this isn’t so much a problem with standards as it it people adhering to standards when they shouldn’t.