Identifiers
Use of case and underscore
Identifiers used as feature names often consist of several words expressing what the feature does, e.g., a feature to parse an integer would use some combination of parse and integer in its name. The question is how to create such a composed name.
style
aspect
|
lowercase | UPPERCASE | camelCase | PascalCase | snake_case | Snake_Pascal_Case | SCREAMING_SNAKE_CASE | kebab-case |
---|---|---|---|---|---|---|---|---|
examples | parseinteger | PARSEINTEGER | parseInteger | ParseInteger | parse_integer | Parse_Integer | PARSE_INTEGER | parse-integer |
asstring | ASSTRING | asString | AsString | as_string | As_String | AS_STRING | as-string | |
dataoutputstream | DATAOUTPUTSTREAM | dataOutputStream | DataOutputStream | data_output_stream | Data_Output_Stream | DATA_OUTPUT_STREAM | data-output-stream | |
searchablelist | SEARCHABLELIST | searchableList | SearchableList | searchable_list | Searchable_List | SEARCHABLE_LIST | searchable-list | |
Short | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | ❌ No | ❌ No | ❌ No |
Easy to type | ✅ Yes | ✅ Yes (w/ caps lock) | ✅ Yes | ✅ Yes | ✅/❌ Yes/No name is easy _ is harder (US/DE: ⇧+'-') |
❌ No | ❌ No | ✅ Yes |
Easy to read | ❌ No | ❌ No | ✅ Yes | ✅ Yes | ✅✅ Yes | ✅✅ Yes | ❌ No | ✅✅ Yes |
Words separated | ❌ No | ❌ No | ✅ Yes | ✅ Yes | ✅✅ clearly | ✅✅ clearly | ✅✅ clearly | ✅✅ clearly |
Quiet | ✅ Yes | ❌ No | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ❌ No | ✅ Yes |
Used in | - | - | Java, Pascal | Java, Pascal | C++, C, Eiffel, Python | Ada | Java | - |
Suggestion for Fuzion | ❌ | ✅ type parameters | ❌ | ❌ | ✅ features and value types | ✅ ref types and their constructor features |
❌ | ❌ |