
A Line In The Sand, A Story About Meaty Chili and Using Classes
A Line In The Sand, A Story About Meaty Chili and Using Classes êŽë š
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 (stubbornella/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 (chriscoyier
). 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.