有哪些不同类型的案例? [英] What are the different kinds of cases?

查看:92
本文介绍了有哪些不同类型的案例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对不同类型的标识符案例以及人们所说的它们感兴趣.您是否知道此列表的任何补充内容或其他替代名称?

I'm interested in the different kinds of identifier cases, and what people call them. Do you know of any additions to this list, or other alternative names?

  • myIdentifier:驼峰式(例如,在Java变量名称中)
  • MyIdentifier:大写驼峰式大小写(例如,在Java类名称中)
  • my_identifier:蛇形字符(例如python变量名)
  • 我的标识符:烤肉串案例(例如球拍名称)
  • myidentifier:大写字母(例如,在Java包名称中)
  • MY_IDENTIFIER:大写字母(例如,使用C常量名称)

推荐答案

名称可以是通用的,仅是一种语言的名称,也可以是彩色的;大多数人在特定社区之外没有标准名称.

Names are either generic, after a language, or colorful; most don’t have a standard name outside of a specific community.

这些命名约定有很多名称(名称就是名称!);请参阅命名约定:多字标识符,尤其是对于 CamelCase (UpperCamelCase,lowerCamelCase).但是,许多没有标准名称.考虑一下Python样式指南 PEP 0008 –它通过"lower_case_with_underscores".

There are many names for these naming conventions (names for names!); see Naming convention: Multiple-word identifiers, particularly for CamelCase (UpperCamelCase, lowerCamelCase). However, many don’t have a standard name. Consider the Python style guide PEP 0008 – it calls them by generic names like "lower_case_with_underscores".

一个约定是用一种众所周知的用法来命名.结果是:

One convention is to name after a well-known use. This results in:

  • PascalCase
  • MACRO_CASE(C预处理程序宏)

...并建议使用这些名称,这些名称并未得到广泛使用:

…and suggests these names, which are not widely used:

  • c_case(在K& R和标准库中使用,例如size_t)
  • lisp-case,css-case
  • COBOL-CASE

或者,有一些说明性的名称,其中最著名的是CamelCase. snake_case 是最近的版本(2004年),但是现在已经很成熟了. kebab-case是较新的并且仍然没有建立,并且可能起源于Stack Overflow! (破折号分隔的名称是什么?)有很多更丰富多彩的建议,例如caterpillar_case,Train-case,caravan-case等.

Alternatively, there are illustrative names, of which the best established is CamelCase. snake_case is more recent (2004), but is now well-established. kebab-case is yet more recent and still not established, and may have originated on Stack Overflow! (What's the name for dash-separated case?) There are many more colorful suggestions, like caterpillar_case, Train-case, caravan-case, etc.

这篇关于有哪些不同类型的案例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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