Live data from Hacker News

Shame.css

csswizardry.com

51–57 of 57 posts

Re: Shame.css

#51

This is a great idea. Too bad code can't really be isolated this way. I feel that marking a hack is one of the few legitimate uses for comments in code: //TODO HACK HACK HACKITY HACK

I feel that marking a hack is one of the few legitimate uses for comments in code I'll take that as an offhand comment you didn't give much thought to, because wow, there most certainly are lots of legitimate uses for comments in code.

I'm pretty firmly in the "code as documentation" camp, what can I say? I think that most of the time, if you can describe an action with two or three words, you probably ought to be extracting that logic into a method by the same name.

IMHO comments are best used in a handful of situations, such as:

1) Marking hacks 2) Explaining unusual, non-obvious sections of code 3) Noting historical reasons for doing something in a non-obvious manner 4) Noting pitfalls to be avoided 5) Making passive aggressive remarks about the "business guy" who made you do something terrible

Not an exhaustive list of course, but I do think that it's best to think twice before writing a comment, asking yourself "how can I make this more obvious with my code?"

Re: Shame.css

#52

Pedantry: can we call it "guilt.css" instead? In psychological literature, guilt is defined as the "I did something bad" emotion, shame is the "I am bad" emotion. The crucial difference between them is that guilt can be fixed by making amends. That seems like exactly the mindset you want to encourage with this: guilt.css implies that you feel guilty about all the hacks you have and want to make amends, while shame.cs…

Or perhaps we could use i18 to detect whether the coder lives in a Guilt- or Shame-based culture, and dynamically load guilt.css or shame.css based on the results!

Re: Shame.css

#53
post #27

Earlier quoted context omitted.

I don't know about psychological literature, but in common usage where I'm from, "guilt" is what you feel when you know you've done something you shouldn't, whereas "shame" is what you feel when you believe others either do or will frown on something. In that context, I think "shame" is more appropriate — essentially, it's a collection of code that brings some degree of shame to the project, not code that you should…

how about bandaids.css or kludge.css? Get out of the psychology and name the noun.

I'm calling it hax.css

Re: Shame.css

#54
> The first bits of bad code set a precedent and make subsequent developers feel less bad about using poor code themselves.

This is really just another manifestation of the "Broken windows theory"[1], which I've witnessed in code many times over. I think it's just a fact of human nature, also similar to the "When in Rome..." adage; it doesn't make you feel nearly as dirty to do something awful (whether it's in code or in a run-down urban environment) when there's already lots of problems to begin with.

1. http://en.wikipedia.org/wiki/Broken_windows_theory

Re: Shame.css

#55

Earlier quoted context omitted.

how about bandaids.css or kludge.css? Get out of the psychology and name the noun.

I'm calling it hax.css

At where I work, we call it chance_2_buy_lunch.scss

Every Friday, we pick 3 random lines from chance_2_buy_lunch.scss (and another 3 from chance_2_buy_lunch.coffee) and the writers of those lines have to buy lunch for the rest of the team.

Re: Shame.css

#56

Pedantry: can we call it "guilt.css" instead? In psychological literature, guilt is defined as the "I did something bad" emotion, shame is the "I am bad" emotion. The crucial difference between them is that guilt can be fixed by making amends. That seems like exactly the mindset you want to encourage with this: guilt.css implies that you feel guilty about all the hacks you have and want to make amends, while shame.cs…

I also don't know the psych lingo, but I thought right away of the anthropological distinction between cultures of shame[1] (external disapproval from other people) and guilt[2] (internal disapproval from self). On that score, either could work: shame is certainly appropriate here since devs shame each other all the time. [1]: https://en.wikipedia.org/wiki/Shame_society [2]: https://en.wikipedia.org/wiki/Guilt_societ…

Interesting. The anthropological and psychological definitions aren't really at odds with each other. When you face primarily external disapproval, it's natural to feel "I am bad", because people's outside opinions are not something you can control. When you face internal disapproval, the natural response is "I did something bad", because you know your own reasoning, you have control over it, and you can resolve to do better next time. Same basic principle as "growth mindset vs. fixed mindset". [1]

I'd argue that if devs shame each other all the time, something about your culture is broken. Why? Because the normal response to shame is to want to hide it. You see that in the description of shame vs. guilt societies in the links you provided, where "Shame cultures are typically based on the concepts of pride and honour, and appearances are what counts, as opposed to individual conscience in guilt cultures." Shame is positively correlated with depression, addiction, violence, aggression, bullying, and all sorts of other nasty stuff; guilt is inversely correlated with all of them. [2]

[1] http://mindsetonline.com/whatisit/about/

[2] http://www.youtube.com/watch?v=psN1DORYYV0#t=840

Re: Shame.css

#57
post #7
post #3

This is a really indirect and complicated alternative to putting FIXME comments into the source.

I don't think it's either indirect or complicated. It's just a file concentrating the FIXME instances that would otherwise be scattered and require a project-wide search. Simple and elegant imho. That said, I wouldn't use something like that in a project without a build step that merge stylesheets together.

This is particularly easy to do in CSS because it is built up out of a set of rules that have no particular ordering or context. In a way, that's the beautiful part about the CSS. You can concatenate the files however you like and you can also pull out pieces from various components into one place. This certainly isn't possible in most programming where code behavior is highly dependent on the context that it is written.

There might be a subtle difference in the way people think about CSS vs. other programming that would push them to one solution or the other.

Post reply on HN