Please note: This site's design is only visible in a graphical browser that supports Web standards, but its content is accessible to any browser or Internet device. To see this site as it was designed please upgrade to a Web standards compliant browser.
 
Signal vs. Noise

Our book:
Defensive Design for the Web: How To Improve Error Messages, Help, Forms, and Other Crisis Points
Available Now ($16.99)

Most Popular (last 15 days)
Looking for old posts?
37signals Mailing List

Subscribe to our free newsletter and receive updates on 37signals' latest projects, research, announcements, and more (about one email per month).

37signals Services
Syndicate
XML version (full posts)
Get Firefox!

The importance of fixing "broken windows" in your code

28 Oct 2004 by Jason Fried

There’s been a lot of talk about the broken window theory — and rightfully so. It’s hard to dispute that the evidence of decay leads to more decay.

This theory also applies to your HTML/CSS. If you let your code get messy, you’re a lot more likely to continue to take shortcuts and apply hacks. Inline styles lead to more inline styles lead to more inline styles. And before you know it everything is a mess. It’s like your code is rotting — it eventually gets so bad you don’t want to go near it (or you pinch your nose, inch closer, and then just throw it all away).

And bad code spreads like a virus. You end up duplicating pages with bad code. You end up copying and pasting chunks of bad code into other documents. Shattered glass can cause a lot of damage.

So pay attention. Repair those “HTML/CSS windows” quickly. Remove inline styles. Remove unnecessary classes and ids. Keep your code clean from the beginning and it will pay off.

5 comments so far (Post a Comment)

28 Oct 2004 | Marc Hedlund said...

A friend suggests that one good metric to use in evaluating engineers is how many lines of code they delete from a project. The theory is that these are the people cleaning up your broken glass. (Doesn't work if you tell them you're measuring it, though!)

29 Oct 2004 | Ryan Mahoney said...

This is a delicate subject. A balance needs to be reached. I can see this easily leading to gold plating / pefectionism. I'm not advocating coding sloppily, just saying you have to pick your battles. If something is going to be re-used, well, make the investment. But I think a lot of HTML coding is for "one offs" - just random pages that will never be revisited. Better to just get them done and move onto other tasks.

29 Oct 2004 | Jonny Roader said...

'Broken window theory'. Every right-winger's favourite bit of cod sociology - a discipline many of them otherwise despise. :)

I agree with Ryan. Gold-plating is a worse problem than occasional inline styles. But both are signs of bad planning, which is the real problem.

29 Oct 2004 | Bob said...

One man's "window fix" is another man's " way too much talk about CSS and XHTML and Standards and Accessibility" ;-)

29 Oct 2004 | Sheldon said...

Yep - the "broken window theory" is quite a subject. Looks like some good reading there... and there's also the ' broken window fallacy' to check out.

For html/css-
Sloppy coding does lead to not wanting to go near it again. You create a dark forest. I have had to "gear up" and "psyche up" to go into some website area source code sometimes. All those timely shortcuts - that worked enuff... it's scary stuff! I find the need to 'Ghostbust' websites once in a while.

Lately, I have been focused on best practices. More and more people are looking at and embracing the ideas of web standards. (Molly talks about " What Is A Web Standard"...)

For individual designers... pick your poison, I guess.

In a team environment though, these 'broken windows' become unacceptable. Best Practices sometimes need to be agreed upon - like a ' manual of style'- for coding practices. A simple do's and don't list helps in group/team situations.

There is nothing worse than going into some area of a site that has been hacked together by someone not thinking like me! :)
It is hard enough to go back and try to remember what I was thinking when I hacked something together.

It is like many things- visualize who is coming after you... ('cause it might even be you!)


Comments on this post are closed

 
Back to Top ^