研究最佳代码宽度? [英] Studies on optimal code width?

查看:202
本文介绍了研究最佳代码宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果在所选的IDE中启用查看右页边距,则可能默认为80个字符。我倾向于将其更改为120,无非是几年前我所在公司的标准,并且没有其他公司告诉我要不同地使用它。

If you enable the "View Right Margin" in your IDE of choice, it is likely that it will default to 80 characters. I tend to change it to 120 for no reason other than it was the standard at a company I was with a few years back, and no other company has told me to do it differently.

我的问题是,是否有任何研究表明80个字符实际上是代码可读性的最佳最大宽度,还是这个值仅仅是这就是它一直存在的方式,没有人真正知道为什么是这样道路?而且,一行代码的宽度是否应该成为您的编码标准的一部分?

My question is, are there any studies that actually show 80 characters to be the optimal maximum width for code readability, or is this value just a "that's the way it's always been" and no one really knows why it is that way? And, should the width of a line of code be part of your coding standard?

推荐答案

实际上,这80列长在DOS之前。它来自于80列设备的打卡机。

Actually, the 80-column thing long precedes DOS. It comes from card punches, which were 80-column devices.

为了回答OP的问题,一项研究已经进行了大约600年。 -印刷书籍。这些已经发展了数百年,首先考虑了可读性,到现在的位置,文本的平均行长约为60个字符。因此,为了提高可读性,请选择较窄的边距。

And to kind of answer the OP's question, one "study" has been going on for about 600 years now - the printed book. These have evolved over the centuries, with readbility foremost in mind, to the position we are at now where the average line length for text is around 60 characters. So for readability, go for narrower margins.

这篇关于研究最佳代码宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆