"Pascal Case"这个词是从哪里来的?
Where does the word "Pascal Case" come from?
一般来说,常见的有四种case styles。
驼峰式
帕斯卡大小写
snake_case
烤肉串
第一、第三和第四种风格的词源微不足道。但是第二个(即 PascalCase)呢?
根据wikitionary,
Etymology
Referring to the Pascal programming language.
而 link 只说
Letter case is ignored in Pascal source.
Rules for identifiers:
- Must begin with a letter from the English alphabet or an underscore (_).
- Can be followed by alphanumeric characters (alphabetic characters and numerals), or the underscore (_).
- May not contain special characters, such as: ~ ! @ # ...
(snip)
Pascal is not case sensitive! MyProgram
, MYPROGRAM
, and mYpRoGrAm
are equivalent. But for readability purposes, it is a good idea to use meaningful capitalization!
There are two possible methods you could choose to apply to your identifiers: CamelCase and underscore as space. CamelCase, as it appears, means that separate words in an identifier are capitalized, so that you have newPerson
or NewPerson
instead of newperson
. Using underscore as space means you separate words in an identifier with underscores, so that you have new_person
instead of newperson
. Or you could combine the two, so that you have new_Person
or New_Person
instead of newperson
.
,这意味着不需要使用驼峰标识符,例如 Whosebug
或 RedHatLinux
.
那么,“驼峰”一词是怎么来的呢? Pascal 程序员是否首先开始使用 PascalCase 风格?
使用大小写将单词组合在一起的历史可以追溯到很久以前。
CamelCase was primarily used in chemistry as a way to notate chemical compounds and formulas. In 1813, Berzelius, a Swedish chemist, suggested that the chemical elements should be represented consisting of one or two letters with the first one capitalized. The term used for this convention was medical capitals.
迈入二十世纪:
In the early twentieth century, medical capitals used in Chemistry has been adopted in product trademarks and corporate names. However, the use is not yet prevalent. Some examples of these products include DryIce Corporation, CinemaScope, a widescreen movie format, MisterRogers, and VistaVision, among others.
在编程语言中:
Around the 1970s and 1980s, the use of medical capitals was also adopted as an alternative naming convention for identifiers in various programming languages. For instance, on the General Purpose Macro Processor (GPM) by Christopher Strachey, a program includes identifiers using medical capitals. These include “WriteSymbol,” and “NextCh.”
1990 年代后期:
By the late 1990s, the lower camel case became a popular trend in many brands. The lowercase for “i” which may stand for internet, information, or intelligent, and “e” which stands for electronic, became prefixes to various words. Examples of these words include eBay, iMac, eBox, and iPod.
驼峰命名法:
The term CamelCase only came into existence in the 1990s. Before that, the term medical capitals was commonly used. In April 1990, the term “InterCaps” was used by Avi Rappoport to describe the manner of capitalization. In 1991, Eric S. Raymond made mention of BiCapitalization to identify it.
It was not until 1995, however, that its current name was used. In a post by Newton Love, he mentioned that the humpiness of the style made him call it HumpyCase at first, before settling with CamelCase.
PascalCasing 名称的由来(来自History around Pascal Casing and Camel Casing):
In the initial design of the Framework we had hundreds of hours of debate about naming style. To facilitate these debates we coined a number of terms. With Anders Heilsberg (the original designer of Turbo Pascal) a key member of the design team, it is no wonder that we chose the term Pascal Casing for the casing style popularized by the Pascal programming language.
We were somewhat cute in using the term camelCasing for the casing style that looks something like the humps on a camel. We used the term SCREAMING CAPS to indicate an all upper case style. Luckily this style (and name) did not survive in the final guideline.
>Did pascal programmers first started using PascalCase style?
不,这是当时编程语言发展的共同约定。
的更多参考
一般来说,常见的有四种case styles。
驼峰式
帕斯卡大小写
snake_case
烤肉串
第一、第三和第四种风格的词源微不足道。但是第二个(即 PascalCase)呢?
根据wikitionary,
Etymology
Referring to the Pascal programming language.
而 link 只说
Letter case is ignored in Pascal source.
Rules for identifiers:
- Must begin with a letter from the English alphabet or an underscore (_).
- Can be followed by alphanumeric characters (alphabetic characters and numerals), or the underscore (_).
- May not contain special characters, such as: ~ ! @ # ...
(snip)
Pascal is not case sensitive!
MyProgram
,MYPROGRAM
, andmYpRoGrAm
are equivalent. But for readability purposes, it is a good idea to use meaningful capitalization!There are two possible methods you could choose to apply to your identifiers: CamelCase and underscore as space. CamelCase, as it appears, means that separate words in an identifier are capitalized, so that you have
newPerson
orNewPerson
instead ofnewperson
. Using underscore as space means you separate words in an identifier with underscores, so that you havenew_person
instead ofnewperson
. Or you could combine the two, so that you havenew_Person
orNew_Person
instead ofnewperson
.
,这意味着不需要使用驼峰标识符,例如 Whosebug
或 RedHatLinux
.
那么,“驼峰”一词是怎么来的呢? Pascal 程序员是否首先开始使用 PascalCase 风格?
使用大小写将单词组合在一起的历史可以追溯到很久以前。
CamelCase was primarily used in chemistry as a way to notate chemical compounds and formulas. In 1813, Berzelius, a Swedish chemist, suggested that the chemical elements should be represented consisting of one or two letters with the first one capitalized. The term used for this convention was medical capitals.
迈入二十世纪:
In the early twentieth century, medical capitals used in Chemistry has been adopted in product trademarks and corporate names. However, the use is not yet prevalent. Some examples of these products include DryIce Corporation, CinemaScope, a widescreen movie format, MisterRogers, and VistaVision, among others.
在编程语言中:
Around the 1970s and 1980s, the use of medical capitals was also adopted as an alternative naming convention for identifiers in various programming languages. For instance, on the General Purpose Macro Processor (GPM) by Christopher Strachey, a program includes identifiers using medical capitals. These include “WriteSymbol,” and “NextCh.”
1990 年代后期:
By the late 1990s, the lower camel case became a popular trend in many brands. The lowercase for “i” which may stand for internet, information, or intelligent, and “e” which stands for electronic, became prefixes to various words. Examples of these words include eBay, iMac, eBox, and iPod.
驼峰命名法:
The term CamelCase only came into existence in the 1990s. Before that, the term medical capitals was commonly used. In April 1990, the term “InterCaps” was used by Avi Rappoport to describe the manner of capitalization. In 1991, Eric S. Raymond made mention of BiCapitalization to identify it.
It was not until 1995, however, that its current name was used. In a post by Newton Love, he mentioned that the humpiness of the style made him call it HumpyCase at first, before settling with CamelCase.
PascalCasing 名称的由来(来自History around Pascal Casing and Camel Casing):
In the initial design of the Framework we had hundreds of hours of debate about naming style. To facilitate these debates we coined a number of terms. With Anders Heilsberg (the original designer of Turbo Pascal) a key member of the design team, it is no wonder that we chose the term Pascal Casing for the casing style popularized by the Pascal programming language.
We were somewhat cute in using the term camelCasing for the casing style that looks something like the humps on a camel. We used the term SCREAMING CAPS to indicate an all upper case style. Luckily this style (and name) did not survive in the final guideline.
>Did pascal programmers first started using PascalCase style?
不,这是当时编程语言发展的共同约定。
的更多参考