👀 Case Naming Convention
코딩할 때 클래스명이나 함수명, 변수명 등을 명명할 때 coding convention을 맞춰야 할 때가 있다.
camelCase를 쓰세요~ 이럴 때 어떻게 써야하는가?
모든 case들을 정리해봤다.
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, 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) |
*자주 쓰이는 Case naming convention에 대한 설명
1) lowerCamelCase: lowercase 문자로 시작하며, 연이은 단어의 첫 문자(letter)는 대문자로 표시함.
예) camelCaseVar
2) UpperCamelCase (=PascalCase): 모든 단어(word)의 시작은 대문자(uppercase)로 시작함.
예) PascalCaseVar
3) snake_case: 모든 공백(space)은 "_"로 표시하며, 모든 단어는 소문자(lowercase)임.
예) snake_case_var
4) UPPER_CASE_SNAKE_CASE: 모든 공백(space)은 "_"로 표시하며, 모든 문자(letter)는 대문자(capital)로 표시함.
예) UPPER_CASE_SNAKE_CASE_VAR
5) kebab-case: 모든 공백(space)은 "-"로 표시되며, 모든 문자(letter)는 소문자(lowercase)임.
예) kebab-case-var
-참고문헌
스택오버플로우, What are the different kinds of cases?
What are the different kinds of cases?
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 : Camel case (e.g. in java
stackoverflow.com
케이스 네이밍 컨벤션 (Case naming convention)
케이스 네이밍 컨벤션 (Case naming convention)
들어가며코드를 짤 때마다 변수에 어떻게 네이밍을 헤야 할 것인지가 고민이었다. 그 중에서도 가장 먼저 체계를 잡아줘야 하는 것이 케이스 문제인데, 언어마다 권장하는 케이스도 다르고, 하
guswnsxodlf.github.io
'Computer Science > 기타(시스템 설계 등)' 카테고리의 다른 글
웹/앱 서비스 기획 순서 (0) | 2021.08.27 |
---|---|
C, C++, 자바, 파이썬에서 사용할 수 있는 변수명 조건 (0) | 2021.06.30 |
[Porting] C++와 Python 차이점 정리 (C++ vs Python) (2) | 2021.06.11 |
시스템 설계 및 규모 확장성 문제들 (0) | 2021.02.06 |