3 ms·
The difficulty with such "standards" and "best practices" is that what is standard can often be subjective. For example, under Indentation, they have: For al
by melvinram 16y ago
The difficulty with such "standards" and "best practices" is that what is standard can often be subjective. For example, under Indentation, they have:
For all code languages, we require indentation to be
done via soft tabs (using the space character). Hitting
Tab in your text editor shall be equivalent to four spaces.
Umm, who died and made you king? <tongue and cheek> I don't like using 4 spaces. I find it a waste of space, literally. In ruby community, 2 spaces is generally accepted.
With that said, it's probably not a bad idea to have discussions around such standards with the understanding that there may be more than one good way to skin a cat.
- shoeless 16y agoBut they have a standard, and this is good for consistency across their development. What may be better is "follow the standard that you are working on", meaning, don't change coding style because you prefer your own, adopt what is already there, or the norms for a project (e.g. 2 space indents for all that Ruby code we have).
- pstinnett 16y agoAgreed. Maintaining consistency is key.
- insin 16y agoOn that note, I like the parting words in Google's JavaScript Style Guide ( http://google-styleguide.googlecode.com/svn/trunk/javascriptguide.xml http://google-styleguide.googlecode.com/svn/trunk/javascript... ): BE CONSISTENT. If you're editing code, take a few minutes to look at the code around you and determine its style. If they use spaces around all their arithmetic operators, you should too. If their comments have little boxes of hash marks around them, make your comments have little boxes of hash marks around them too. The point of having style guidelines is to have a common vocabulary of coding so people can concentrate on what you're saying rather than on how you're saying it. We present global style rules here so people know the vocabulary, but local style is also important. If code you add to a file looks drastically different from the existing code around it, it throws readers out of their rhythm when they go to read it. Avoid this.
- bauderjoshua 16y agoI second that consistency is something that is lacking in web development at the moment
- deleted 16y ago[deleted]
- technomancy 16y agoCount your blessings that you work in a language that doesn't have ambiguity around indentation rules. These poor fellas obviously don't.
- Seth_Kriticos 16y agoI agree. I personally like 8 spaces, but I code in a way so others can choose their own preferences. Meaning, I use the tab character and avoid ASCII art in my source / comments. This way people can set up their tab width in their editor as they like and don't have to put up with my style de jure. That's part of collaboration basics: * Try to find an acceptable middle ground for the minor things and focus on coding and not politics. * Don't be a douche. ~2¢
- ldh 16y agoCoding standards are helpful and not uncommon when collaborating within a team. As much as you don't like using 4 spaces, it's much worse to have a codebase littered with some sections using 4 spaces, some sections using tabs, some sections using 2 spaces, some sections using 8 spaces, and some sections using a random assortment of nothing in particular. Just as you accept the apparent standard of 2 spaces when working within the Ruby community, for consistency's sake I'd hope you would accept the standard of whatever other team you're working with.
- rob_react 16y agoHey, Isobar front end engineer here... What you're looking at is a document that serves as OUR internal standard. We just made it public because we think people might find it useful. We understand what we do internally may not work for everyone, but that's part of the fun of sharing documents like this. We learn too.