Live data from Hacker News

The GitHub Styleguide

github.com

81–82 of 82 posts

Re: The GitHub Styleguide

#81
post #25

Earlier quoted context omitted.

And even if your team is superstars now it doesn't mean it always will be. What happens a few years down the road when you now have a team 5 or 10 times the size with people of varying skillsets and areas of expertise. Now that guy with mostly Python or Ruby experience needs to make some changes to your JavaScript code with what little knowledge of the language they have. It's helpful to write things to be as idiomat…

Well, the same thing could be said about "that guy with mostly C, PHP or Java experience".

I wasn't singling out any particular languages, just giving an example. It's a lot easier to understand code in an unfamiliar language if it's written in an idiomatic fashion as opposed to using all sorts of tricks.

Re: The GitHub Styleguide

#82
post #17

Earlier quoted context omitted.

Indeed, "and" and "or" are excellent for their intended use, for control flow. Like explained by the style guide the Github one is based on. https://github.com/bbatsov/ruby-style-guide # boolean expression if some_condition && some_other_condition do_something end # control flow document.saved? or document.save!

I'm not sold on tossing "and" and "or" out the window, but wouldn't "document.saved? or document.save!" read better as "document.save! unless document.saved?"

Agreed, it is not my example.
Post reply on HN