# Coding Horrors
Home   Submit Random All Snippets Lessons/Resources

"Alive!"

This is a place to showcase horrific code, as one might suspect. The name was of course inspired by Steve McConnell's classic and indispensable software development tome, Code Complete. Throughout the book, he offers snippets of code demonstrating the wrong way to do things, and he calls these snippets "coding horrors." They are accompanied by the horrified face of a "victim," perhaps a code reviewer, who has just read the offending code.

Little did I know when I first read his book that I would encounter even more terrifying code in my workplace. Code that actually ran in production.

I decided there had to be a place to publish this utter crap as a way to vent, and as a learning tool. So here you have a gallery of hideous "don'ts" from the real world of software development.

Any fool can write code that a computer can understand. Good programmers write code that humans can understand.

Martin Fowler, Refactoring Refactoring: Improving the Design of Existing Code

Featured Horrifying Code Snippet

"CSS abortion"

Language: HTML/CSS

Written in 2004

Submitted by Chris, 01.07.2005 12.44.44

<font class="BlueCopyrightFont" size="-2">
Submitter's comments:

What's Wrong

This is just a terrible misapplication of CSS to HTML. The idea of CSS is to separate presentation and content. For starters, the font tag is deprecated. To apply a class to a font tag...well, it's almost unspeakably horrible. Also, to name a CSS class as BlueFont whatever is nonsense.

Suggested Fix

Get rid of the font tag! Use styles properly! Apply a style to the p element or whatever that contains the text that you want blue.

view/add comments