본문 바로가기
Dev

Code Convention

by Luigi.yoon 2023. 8. 21.

Camel case(카멜 케이스)

  • ex) testVariableOne
  • 기본적으로 두 단어를 합쳤을 때 두번째 단어의 첫 글자만 대문자로 바꾸는 것이 카멜케이스이지만
    세 단어를 합쳤을 때에는 첫번째 단어만 제외하고 나머지 단어들의 첫 글자를 대문자로 바꾸어 주는 것이 카멜케이스
  • java / javascript

 

Snake case(스네이크 케이스) or Lower snake case

  • ex) test_variable_one
  • 두 단어 이상을 합칠 때 언더바(언더스코어)로 구분해준다
  • python

 

Upper case (어퍼 케이스) or Upper snake case

  • ex) TEST_VARIABLE_ONE
  • 프로그래밍에서 많이 쓰이는 케이스는 아니지만, 보통 상수 중에서 여러 단어가 합쳐진 경우에는 대문자 스네이크 케이스를 사용하여 연결하는 경우가 많다.

 

Kebab case(케밥 케이스)

  • test-variable-one
  • 두 단어 이상을 합칠 때 바(대시)로 구분해준다
  • 꼬치에 꿰인 케밥 고기 모양이라 이 이름이 붙었다
  • url 

 

Pascal case(파스칼 케이스) 

  • ex) TestVariableOne
  • 카멜케이스와 비슷하지만, 첫 단어의 첫글자 까지 대문자로 바꾸어주는 것이 파스칼 케이스이다
  • java class

 

 

Google Style Guides

 

Google Style Guides

Style guides for Google-originated open-source projects

google.github.io

 

 

Google Java Style Guide

1 Introduction This document serves as the complete definition of Google's coding standards for source code in the Java™ Programming Language. A Java source file is described as being in Google Style if and only if it adheres to the rules herein. Like ot

google.github.io

 

Google JavaScript Style Guide

Google JavaScript Style Guide 1 Introduction This document serves as the complete definition of Google’s coding standards for source code in the JavaScript programming language. A JavaScript source file is described as being in Google Style if and only i

google.github.io

 

https://standardjs.com/

 

JavaScript Standard Style

JavaScript Standard Style Sponsored by         English • Español (Latinoamérica) • Français • Bahasa Indonesia • Italiano (Italian) • 日本語 (Japanese) • 한국어 (Korean) • Português (Brasil) • 简体中文 (Simplified Chin

standardjs.com

 

 

SQL style guide

 

https://www.sqlstyle.guide/ko/

 

SQL style guide by Simon Holywell

A consistent code style guide for SQL to ensure legible and maintainable projects

www.sqlstyle.guide

 

https://docs.telemetry.mozilla.org/concepts/sql_style.html

 

SQL Style Guide - Mozilla Data Documentation

From Pep8: A style guide is about consistency. Consistency with this style guide is important. Consistency within a project is more important. Consistency within one module or function is the most important. However, know when to be inconsistent -- sometim

docs.telemetry.mozilla.org

 

 

URL guide

 

https://developers.google.com/search/docs/crawling-indexing/url-structure?hl=ko 

 

Google URL 구조 가이드라인 | Google 검색 센터  |  문서  |  Google for Developers

사이트의 URL 구조는 최대한 단순하게 유지하는 것이 좋습니다. 하이픈, 밑줄, 도메인 구조 사용 등 Google에서 권장하는 URL 형식에 대해 자세히 알아보세요.

developers.google.com

 

 

https://www.ibm.com/docs/en/urbancode-release/6.1.1?topic=reference-rest-api-conventions 

 

REST API conventions

The IBM® UrbanCode Release REST API follows a set of conventions to make interacting with it more consistent. REST URLs Each element type on the server is represented as a top-level URL with a plural form. In most cases, the URL uses the same terms as in

www.ibm.com

 

  • 소문자를 사용하자. (도메인은 대소문자를 구분하지 않지만, 경로는 대소문자가 구분되는데 소문자로 통일)
  • Kebab case 를 사용하자. (대문자가 들어가는 case 를 사용하지 않고, Snake case 는 _ 언더바가 스타일상 생기는 밑줄과 혼동되거나 url 을 드래그 했을 때 가독성이 떨어져서 url 에서는 Kebab case 를 사용하자.)
  •  인코딩이 필요한 특수문자를 사용하지 말자. (특히 / 를 url 경로에 사용하지 말자. 톰캣에서는 보안상 / 를 인코딩해도 못 쓰게 할정도로 사람과 시스템을 헷갈리게 할 수 있다.)

 

 

변수명 이름짓기(Naming)

'Dev' 카테고리의 다른 글

pyenv virtualenv autoenv  (2) 2024.01.02
k8s 기본 용어  (0) 2023.08.28
순환 참조 (circular dependencies)  (0) 2023.08.22
Gitlab-flow branch 전략  (0) 2023.08.21
Git-Flow branch 전략  (0) 2023.08.09