4 ms·
While PSR-1 has pretty good universal guidelines, PSR-2 goes too far in insisting on subjective preferences (spaces over tabs, 80-char lines, bracketing styles)
by lukifer 14y ago
While PSR-1 has pretty good universal guidelines, PSR-2 goes too far in insisting on subjective preferences (spaces over tabs, 80-char lines, bracketing styles). We should not pretend that there is a "correct" answer to these choices, just as long as they stay consistent on a per-project basis.
All told, I love site, and I hope it keeps iterating. PHP may be ugly, but it's powerful, and most of its bad reputation comes from good coders having to pick up the pieces from bad coders.
- Jebus 14y ago+1 , I still don't know where this 'spaces over tabs' crap comes from. My guess is that it is good for things that must be done from a console (as opposed to using an IDE). But it has no place in PHP. Tabs + spaces break on different configurations? It's not because of tabs, it's because of spaces! Tabs are flexible, spaces are not. What's next, will I be forced to use a particular font size too?
- robertpateii 14y agoPSR-2 isn't trying to say that there is one correct answer. Instead they're trying to provide a single answer from the many valid possibilities. "When various authors collaborate across multiple projects, it helps to have one set of guidelines to be used among all those projects"
- chrismsnz 14y agoExactly, this is what infuriates me about the arguments and whining against PSR-2. Spaces, Tabs, OTBS, whatever. It doesn't matter which one was chosen, just that something was chosen. Ask the Pythonista's what PEP8 did for their developer's ecosystem. Also it's important to note that that PSR-2 was based off already existing coding standards like Zend's and Symfony's.
- lukifer 14y agoAnd what do you do with all the coders like me who would refuse to change their habits? Does the Python community have tabs holdouts who are github lepers because no one wants their code "infected"? (I don't do much in Python, I actually don't know what the community norms are.) I think it's silly to pursue per-language consistency; it's a pipe-dream that just leads to more religious wars over minutia. Per-project (or per-organization) more than suffices.
- FixThisPOSSite 14y ago"Does the Python community have tabs holdouts who are github lepers" This actually happens? People who don't understand tabs sure as hell shouldn't be lecturing other people about using them. Infantile.
- batista 14y ago>And what do you do with all the coders like me who would refuse to change their habits? Reformat their code. As for "per language consistency", Go does it just fine...
- lukifer 14y agoI'm not saying it shouldn't exist; I'm saying it shouldn't be recommended at all as part of "PHP The Right Way". It mixes up arbitrary personal preferences with universal best practices.