What are the different kinds of cases?

后端 未结 4 1262
梦如初夏
梦如初夏 2021-01-30 00:06

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?

  • myIde
相关标签:
4条回答
  • 2021-01-30 00:26
    +--------------------------+-------------------------------------------------------------+
    | Formatting               | Name(s)                                                     |
    +--------------------------+-------------------------------------------------------------|
    | namingidentifier         | flat case/Lazy Case                                         |
    | NAMINGIDENTIFIER         | upper flat case                                             |
    | namingIdentifier         | (lower) camelCase, dromedaryCase                            |
    | NamingIdentifier         | (upper) CamelCase, PascalCase, StudlyCase, CapitalCamelCase |
    | naming_identifier        | snake_case, snake_case, pothole_case, C Case                |
    | Naming_Identifier        | Camel_Snake_Case                                            |
    | NAMING_IDENTIFIER        | SCREAMING_SNAKE_CASE, MACRO_CASE, UPPER_CASE, CONSTANT_CASE |
    | naming-identifier        | Kebab Case/caterpillar-case/dash-case, hyphen-case,         |
    |                          | lisp-case, spinal-case and css-case                         |
    | NAMING-IDENTIFIER        | TRAIN-CASE, COBOL-CASE, SCREAMING-KEBAB-CASE                |
    | Naming-Identifier        | Train-Case, HTTP-Header-Case                                |
    | _namingIdentifier        | Undercore Notation (prefixed by "_" followed by camelCase   |
    | datatypeNamingIdentifier | Hungarian Notation (variable names Prefixed by metadata     |
    |                          | data-types which is out-dated)                              |
    |--------------------------+-------------------------------------------------------------+
    
    0 讨论(0)
  • 2021-01-30 00:27

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

    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 preprocessor macros)

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

    • c_case (used in K&R and in the standard library, like size_t)
    • lisp-case, css-case
    • COBOL-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 (initial capital), caravan-case, etc.

    0 讨论(0)
  • 2021-01-30 00:28

    MyVariable : Pascal Case => Used for Class

    myVariable : Camel Case => Used for variable at Java, C#, etc.

    myvariable : Flat Case => Used for package at Java, etc.

    my_variable : Snake Case => Used for variable at Python, PHP, etc.

    my-variable : Kebab Case => Used for css

    0 讨论(0)
  • 2021-01-30 00:42
    • flatcase
    • kebab-case. Also called caterpillar-case, dash-case, hyphen-case, lisp-case, spinal-case and css-case
    • camelCase
    • PascalCase or CapitalCamelCase
    • snake_case or c_case
    • MACRO_CASE or UPPER_CASE
    • COBOL-CASE or TRAIN-CASE
    0 讨论(0)
提交回复
热议问题