In college I worked at a bar. The bar had a small kitchen and served typical American bar food: burgers, wings, and soup. We had two soups, one would rotate, one was always chili. We hand-made the chili every week. Sometimes we would sell out, sometimes we’d have chili leftover at the end of the week. If there was leftover, we would either throw it out or take it home. It was still perfectly good to eat, just not a good policy to sell week old chili at a restaurant.
I worked at this bar with a friend of mine. He was a vegetarian. He wasn’t a vegetarian for taste or personal health reasons, but for global sustainability. The chili had meat in it. So, typically off the menu for my friend.
One particular end of the week rolls around and we have leftover chili. My friend is working. He could dump this pan of chili down the drain, or he could take it home. Now, if you’re a vegetarian and you are a vegetarian solely for the purpose of global sustainability, surely the correct choice here is to take the chili home and eat it. Throwing away food and consuming something else is wasteful.
Yes, he could bring it home for me or bring it to his grandmother’s house. We could think of 100 alternative paths for this chili to take, but let’s stay in the analogy here – it does come up where one’s personal ideals are challenged by practicality. Sometimes it involves chili.
When this conundrum was discussed with my friend, I thought he presented a good argument for his not eating the chili. He said: “it’s about drawing a line in the sand.”. In all likelihood, he was probably referencing The Big Lebowski, but he went on to make a good point.
This isn’t about one pan of chili and one guy at one bar. It’s about not compromising for the long term and greater good. Maybe next time the bar makes chili, the bar will make a bit less or make it in smaller batches due to known waste. Maybe next time the bar revises the menu there will be less meaty stuff because we know there are uncompromising vegetarians like my friend who spend a lot of time at bars too. If this attitude becomes the standard, it becomes about millions of pans of chili and a changed world.
Right, so, HTML classes.
You know that it’s generally best to style with classes right? This is what OOCSS and SMACSS and modern writing about CSS is teaching. Not just “use classes smartly” but also “don’t use ID’s”. CSS Lint event tosses you a warning for using ID’s in selectors. What? Really? An error for writing a perfectly valid selector?
Yes, really. ID’s are infinitely more specific than classes. Well almost. That’s so strong it can get out of control quickly in CSS. Yep, it can be a quick, easy, powerful override, but then how do you override that? (Who watches the Watchmen?) If you agree with yourself (and team) to never use them, you don’t get in these arms races. These override predicaments can always be solved another way – through code refactoring, nesting a class, or something else calmer and more intelligent.
Plenty of smart people disagree with this (see comment thread on another post). But to me, this again comes down to drawing a line in the sand. I’m not going to use ID’s to style things. No compromise. Even if an ID might seem like it could save me in a short term way, the long term benefits of never using them are greater.
One day I just decided to draw my own line in the sand and I haven’t styled with an ID since. Once in a while it might feel like it defies logic, but overall I feel like it has improved my work.