This is something I see a lot and I think this is a big reason why people have “weird” problems with CSS. Unless you’re 100% sure of the output, it’s much more risky to use shorthand or to do any other “trick” with CSS. More often than not, you’ll end up running into problems that will cause more trouble and time than just typing a few more characters per declaration.
I don’t completely buy the argument against margin: 0 auto;. Often when I’m centering an element by setting the left and right margins I also do intend to remove the top and bottom margins from the same element. I can’t recall any situation where all I cared about was centering the element while allowing rules elsewhere to govern its top and bottom margins.
margin: 0 auto;
Yep, I usually want to remove the margins at a level (and have that be inherited) so that I can specify the overrides I want later. I agree with the gist of the article, but going against all shorthand is to some extent throwing out the baby with the bathwater.
[Comment from banned user removed]
Just because that’s the definition of the term. You’re right that it doesn’t mean the opposite of a pattern.
tl;dr – I’m literally going to force you to read the rest of the text below.
It’s important to know the difference between descriptive and prescriptive norms.
Why can’t “anti-pattern” be prescriptive? It was coined in 1995 by a person who was writing a book on design patterns! It’s not descriptive because it was then “extended […] beyond the field of software design to refer informally to any commonly reinvented but bad solution to a problem”.¹ It caught on, and now that happens to be its colloquial definition. The English language, or nearly any other natural language, is a constantly mutating majority consensus on how to communicate, there will (most likely) always be times when it does not make sense.
That’s like saying “literally” is its own antonym because that’s the definition.
Why not? Such things have happened before. The verb “dust”: I can be dusting crops or dusting bookshelves; I’m either adding something akin to dust or I can be removing it, but I’m using the same word both times. Why? Because that happens to be its definition. I can turn an alarm off, or the alarm can go off. I can have oversight of a construction project, or an oversight on my part could have set it back several weeks. I’ve been left alone, or I have left a group. In colloquial English, even the word “literally” has become its own double (see the tl;dr above). There are several words that are effectively their own antonyms, just because of their definition. It’s not unthinkable.
While patterns may not be intrinsically good, people generally follow patterns, especially when they’re first exposed to something, because it’s something they consistently see.
That said, I think pattern and anti-pattern are the right terms here, and that in general you’d rather have sets of code that at least follow some internally consistent patterns, instead of just being collections of random styles all over the place, and that sometimes there are patterns used a whole lot that aren’t very good.
Implicit due to social context surrounding the word, is “design”. When you read anti-pattern or pattern, what you should mentally put in there is design. anti-design pattern, it’s an abbreviation because you can figure out that it’s a design pattern from context, so there’s no need to explicitly state “design”.
This has nothing to do with the linked post; this is both the descriptive (per the link) and prescriptive norm, so you’re really just trolling here.
“even you” — what is this even meant to mean? What are you appealing to with this “even you”? Obviously I don’t think that in this case. It’s not that I disagree with you in what you actually said — I’m inclined to agree that the term isn’t the best one.
It’s that you’re consistently an ass on this site and half of your comments aren’t contributing to the actual discussions going on. Opening with “why do people use X” when the answer is obviously “because they do” is just baiting for a circlejerk or pointless conversation.
I agree that you can talk about an expression used in the title even if it doesn’t have to do with the content of the linked post, but the way you did it didn’t actually open any interesting discussion; just a complaint to feel heard.
stefantalpalaru, you’re being an ass. I’ve seen you contribute positively to discussions, but more often you’re just being abraisive. You’re not “trying to discuss things outside the usual circlejerk”, you’re just being mean-spirited for your own vanity’s sake. If this was a mailinglist I would have killfiled you long ago. The comment I’m responding to is not the worst by a long mile, it’s just the straw that broke the camel’s back for me. Grow up please. This community doesn’t need your juvenile shit-stirring.
You have nothing to say when I make a technical comment,
Because I don’t have any issues with your technical comments.
but now you come out of the woodwork to insult me and inform me of your censorship fantasies and what this community really needs and I’m the bad guy?
What am I, a woodworm?
You’re good at twisting words, I’ll give you that. “Censorship fantasies” is a cool phrase, but I didn’t say that I fantasised about censoring you: I merely stated that if that option had been available to me, I would have used it. For the avoidance of doubt, I don’t fantasise about you at all: not even to censor you. (Don’t flatter yourself.)
I also did not try to claim what this community really needs. It feels like you’ve employed a fallacy of inversal to draw that conclusion. Knowingly or not I cannot say, but I’m leaning to the former based on your facility with words elsewhere.
Finally I don’t know if you’re a “bad guy”. My comment about you came a bit closer to ad-hominem than I normally hold myself to, and for that I apologise. I was referring to your behaviour, and should have made that more clear.
Next time just downvote me and spare me the bullshit.