๋ณธ๋ฌธ ๋ฐ”๋กœ๊ฐ€๊ธฐ
Computer Science/๊ธฐํƒ€(์‹œ์Šคํ…œ ์„ค๊ณ„ ๋“ฑ)

"์ผ€์ด์Šค ๋„ค์ด๋ฐ ์ปจ๋ฒค์…˜ (Case naming convention)" ์ •๋ฆฌ

by sohyunwriter sohyunwriter 2021. 6. 10.
728x90

๐Ÿ‘€ 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

 

 

 

 

-์ฐธ๊ณ ๋ฌธํ—Œ

๋”๋ณด๊ธฐ

 

728x90

๋Œ“๊ธ€0