为什么Java程序员喜欢命名变量“clazz”? [英] Why do Java programmers like to name a variable "clazz"?

查看:205
本文介绍了为什么Java程序员喜欢命名变量“clazz”?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我见过很多代码都声明像 Class clazz ,这来源于哪里?这是某种惯例吗?我认为'clazz'甚至不是英文单词,根本没有任何意义,这么多程序员怎么会巧妙地命名一个错误的名字?

I've seen lots of codes have declaration like Class clazz , where does this originate from ? Is this some kind of convention ? I think 'clazz' is not even an English word , has no meaning at all , how can so many programmers name a wrong name coincidentally ?

推荐答案

clazz 已在Java中用于代替自JDK 1.0以来的保留字class。 class是你想要的,但缩写或插入垃圾(a,the,_等)会降低清晰度。 clazz 只是说课。 国际英语使用者(阅读英语和美国人)用于转置s和z。

clazz has been used in Java in place of the reserved word "class" since JDK 1.0. "class" is what you want, but abbreviating or inserting junk ("a", "the", "_", etc) reduces clarity. clazz just says class. "International" English speakers (those reading both English and American) are used to transposing 's' and 'z'.

由于Java已经披露了来源和合适的文化从一开始,有价值的Java代码和教程就会采用相同的约定。这是Java生态系统的一大优势,我认为这是其成功的重要部分。

Since Java has had disclosed source and a suitable culture right from the start, worthwhile Java code and tutorials pick up the same conventions. That's one of the great things about the Java ecosystem, which I think has been an important part of its success.

这篇关于为什么Java程序员喜欢命名变量“clazz”?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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