改善编码标准和质量

跳伞

工作人员
已加入
2019年4月6日
留言内容
2,487
地点
弗吉尼亚州切萨皮克
编程经验
10+
这自相矛盾:
制表符与空格,括号位置等
Who cares? We aren’t living in the 80’s. Most IDEs automatically detect and match indenting, it’s not like 您 need to 再按X次. Tools can catch and fix mismatches. Flip a coin, pick one, configure 您r tools, and be consistent.

正如Bill Sourour所说:

在过去的20多年中,我一直在关注每一个可以想象的趋势。我遵循了不同语言的不同约定。这些都不会影响我的错误计数或提高我的代码效率。
There are also plenty of tools dedicated to auto-formatting code. Many of these come as plugins for IDEs that auto-format as 您 go or when 您 save. I highly recommend finding a few of these and providing pre-tuned configs for 您r developers. Takes all the hassle out of it.

如果没有人在乎,那么开发人员应该没有任何预先调整的配置。然后应该允许开发人员选择他们的首选项(因为没人在乎,对吗?),然后提交该版本。让下一个人通过重新格式化为自己喜欢的样式而受苦。

But 您'll say: "这确实会弄乱源代码管理中的所有差异,并使检查代码变得更加困难。" And my answer is "Yes. Yes it will. But 您 said that 您 don't care."
 

金西尼

福彩12选5走势图论坛主持人
工作人员
已加入
2011年4月23日
留言内容
3,494
地点
悉尼,澳大利亚
编程经验
10+
这自相矛盾
I'm not sure it does. I think what it is saying is that it doesn't really matter which set of rules 您 pick but do pick a set of rules and stick to them. I don't think that that is referring to each individual developer within a team but rather the team as a whole, i.e. it doesn't matter what set of rules a team uses but the team should pick a set of rules and stick to it, all having their IDE keep them in line.
 

跳伞

工作人员
已加入
2019年4月6日
留言内容
2,487
地点
弗吉尼亚州切萨皮克
编程经验
10+
所以啊"you" was "you, the team", rather than "you, the individual"。因此,即使团队决策是即使违反语言约定也要在JavaScript中使用Allman风格,因为大多数开发人员都是福彩12选5走势图和前Pascal开发人员,并且只有10%的代码是JavaScript,而不是90%的福彩12选5走势图那太糟糕了,太可悲了。 (是的,我知道本文的开头是首选语言和框架约定。)
 
最佳 底部