Comments are the Devil

I recently read Chris Coyier’s article entitled Show Markup in CSS Comments. I was actually a bit angry that so many responses praised this and so few were turned off from the idea. I appreciate the idea of making things easier for working with CSS, but there are just so many better alternatives.

Some were quick to point out that this is a maintenance nightmare. That is my biggest concern with the coding style. Coyier does well to say:

Yes, this would require maintenance. If it doesn’t make it easier for yourself or for the people you are providing the code to, don’t do it.

I’m guessing that those who attempt this “technique” will soon find out that they won’t be doing it for long, likely due to the intense headaches it will induce. Coyier also mentions that a tool could be created to automate this. Am I way off here, but isn’t there a tool already for this? Another window? Split view? A second (or third) monitor?

Like I mentioned earlier, making things easier is great, but whenever you’re considering using comments to make things easier, try again, “Comments are always failures.”1

1. Robert Martin – Clean Code

About Chris Missal

Oh hey, I'm a Senior Consultant for Headspring in Austin, TX. I've been working in software professionally since 2006 and I really, really love it. I'm mostly in the Microsoft world, but enjoy building computer things of all sorts (to be vague). When I'm not slinging code, I'm probably out and about slinging discs, bowling balls, or good beer with great friends.
This entry was posted in Comments, CSS, Design, DRY. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • Comments appear to be just as fallable as citations.

  • @DeanG

    Looks like I typed the wrong title, should be fixed soon. Thanks for the constructive feedback!

  • Sean Stapleton

    I understand the visceral reaction, but here is a fair question: In what ways is the sample markup likely to change without a requisite change in the css?

  • @Sean

    One way I can think of is adding a new block of data/info to a comment, blog post or article listing of some sort. You might want to show the number of comments and/or an added date time using CSS classes that already exist. This wouldn’t require CSS changes at all.