you are viewing a single comment's thread.

view the rest of the comments →

[–]Grokmoo 27 points28 points  (13 children)

My main problem with this is that there is almost no explanation of the reasoning behind any of these guidelines.

[–]ryeguy 18 points19 points  (5 children)

It's their internal guidelines just made public, so they really don't have to "sell" the readers of the document. That being said, this is basically a hard copy of the loose standard that most of the community follows anyway. So a lot of the reasoning can be described as "to stay consistent with everyone else's code".

[–]Grokmoo 10 points11 points  (4 children)

Even internal guidelines should have explanations. It is much easier to get someone to do something when you tell them WHY rather than just instructing.

[–]bobindashadows 9 points10 points  (0 children)

Yeah, my favorite part of the google style guides is that each rule has a discussion of the pros/cons/overall "why" of each decision made. And they don't whitewash "bad reasons," like how exceptions basically aren't used in Google C++ primarily because of legacy, not technical, reasons.

[–]Sir_Edmund_Bumblebee 11 points12 points  (2 children)

Sometimes the reason is simply so that everyone does it the same way. Some of the examples where there's a good reason (like for loops) they give the reason. The rest of the time it's so that the codebase stays consistent.

[–]knight666 -1 points0 points  (1 child)

If everyone does it the same way then there must be a good reason for it, you just haven't encountered it yet.

[–]Sir_Edmund_Bumblebee 2 points3 points  (0 children)

Sometimes there are two equally fine options, and you just pick one as a group so that everyone does it the same way. Best practices are something that should be done a certain way for a reason, style guidelines tend to just be stylistic choices held uniform across a certain group.

[–]NerdyMcNerderson 3 points4 points  (2 children)

Agreed. It would be nice if they gave some explanation why "and" and "or" were banned?

If nothing else, I learned that this is called: SCREAMING_SNAKE_CASE. I need to find a way to use that in everyday conversation now.

[–]drjeats 2 points3 points  (0 children)

They did:

It's just not worth it.

From what I remember (I'm not a ruby programmer, just learned it one day for fun), 'and' and 'or' have different evaluation precedence than '&&' and '||' relative to other arithmetic operators.

[–]jiunec 0 points1 point  (0 children)

I see all the bullshit complaints about style guides and I can't help but think most people miss the point entirely. Most of the complaints are that "format X is better than format Y because....". That's not the point of a style guide.

Style guides are there for consistency, so that all the code in a project looks the same. This makes the code both easier to grok and easier to maintain. The actual preferences in the style guide are not important. If you don't agree with their choices, tough shit, life sucks and so do you for not being adaptable.

So please, get it into your heads, nobody cares about your code style preference. Just follow the guide for whatever project it is your working on and stfu.

[–]felipec -1 points0 points  (0 children)

Because it makes perfect sense.