# 네이밍 규칙

## 📍Capitalization

**Casing Styles**

* 아래의 표기 형식을 사용하며, 식별자별로 구분하여 사용한다.

| Style                                 | Decription                                     |
| ------------------------------------- | ---------------------------------------------- |
| lowercase                             | 모든 단어를 띄어쓰기 하지 않은 소문자로 표기한다.                   |
| lower\_case\_with\_underscores        | 모든 단어를 소문자로 표기하고, 단어와 단어는 `_` 를 삽입하여 구분한다.     |
| UPPERCASE                             | 모든 단어를 띄어쓰기 하지 않은 대문자로 표기한다.                   |
| UPPER\_CASE\_WITH\_UNDERSCORES        | 모든 단어를 대문자로 표기하고, 단어와 단어는 `_` 를 삽입하여 구분한다.     |
| lowerCamelCase                        | 첫글자를 소문자로 표기하고, 나머지 단어의 첫글자는 대문자로 표기한다.        |
| UpperCamelCase                        | 첫글자를 대문자로 표기하고, 나머지 단어의 첫글자는 대문자로 표기한다.        |
| Capitalized\_Words\_With\_Underscores | 각 단어의 첫글자를 대문자로 표기하고, 단어와 단어는 `_` 를 삽입하여 구분한다. |

#### Style for Identifiers

* 추가적인 세부규칙은 각 항목에서 다루며, 기본 규칙은 아래와 같다.

| Indenfidier       | Style                                                          | Example                              |
| ----------------- | -------------------------------------------------------------- | ------------------------------------ |
| Variable          | lowerCamelCase, lowercase                                      | $fooBar, $i                          |
| Class             | UpperCamelCase                                                 | FooBar                               |
| Namespace         | UpperCamelCase                                                 | FooBar                               |
| Property          | lowerCamelCase                                                 | $fooBar                              |
| Method            | lowerCamelCase                                                 | fooBar                               |
| Constant          | UPPER\_CASE\_WITH\_UNDERSCORES                                 | FOO\_BAR                             |
| Internal Function | lower\_case\_with\_underscore                                  | mysql\_query                         |
| Database          | lower\_case\_with\_underscores, UPPER\_CASE\_WITH\_UNDERSCORES | gd\_goods, USP\_GET\_GD\_GOODS\_LIST |
| Column            | lower\_case\_with\_underscores                                 | goods\_name                          |

## 📍Filenames

#### PHP

* 클래스명과 파일명이 같아야 한다.

#### Resources

* Image : lower\_case\_with\_underscores 를 사용하되, 구분자는 \_ 대신 . 을 사용해도 된다.
* CSS : lower\_case\_with\_underscores 를 사용하되, 구분자는 \_ 대신 . 을 사용해도 된다.
* JS : lower\_case\_with\_underscores 를 사용하되, 구분자는 \_ 대신 . 을 사용해도 된다.

## 📍General

#### Word Choice

* 의미가 전달 될 수 있도록, 쉽고 간단한 단어를 사용하여 작명한다.
* 흔히 쓰이는 용어(ex: email, XML, file, error 등)를 사용할 경우, 반드시 1개 이상의 수식어를 함께 사용한다.
* [헝가리안 표기](http://en.wikipedia.org/wiki/Hungarian_notation)를 사용하지 않는다.
* Control Structures 에 i, j, k, v 등의 네이밍을 사용하는 것은 복잡한 중첩 구조가 아닌 경우에는 허용된다.

#### Abbreviations

* 약속된 약어 외에는 단어를 모두 풀어쓰도록 한다.

## 📍Namespaces & Classes

* UpperCamelCase 형태로 표기한다.
* Interface 는 접미사로 Interface 를 붙인다.
* Trait 는 접미사로 Trait 를 붙인다.
* Abstract 클래스는 접두사로 Abstract 를 붙인다.
* Exception 클래스는 접두사로 Exception 을 붙인다.

## 📍Methods

* lowerCamelCase 형태로 표기한다.
* 동사로 시작한다.
* Visibility를 반드시 지정한다.
* private method일 경우에만 \_ 로 시작한다.

## 📍Properties

* lowerCamelCase 형태로 표기한다.
* 명사로 시작한다.
* Visibility를 반드시 지정한다.
* private method일 경우에만 \_ 로 시작한다.

## 📍Constants

* UPPER\_CASE\_WITH\_UNDERSCORES 형태로 표기한다.
* true, false, null 은 소문자를 유지한다.

## 📍Internal Functions

* 내장 함수는 모두 소문자와 \_로 표기한다.
* PHP코드와 프로젝트 코드를 구분하기 위해 반드시 `gd_`를 prefix로 붙힌다.

## 📍Databases

**Table Name Prefix**

* 프로젝트별 구분을 위해 Table Name Prefix 를 사용할 수 있다.
* 고도몰의 Table Name Prefix 는 `es_` 이다.

**Tables**

* lower\_case\_with\_underscores 형태로 표기한다.
* DBMS 내장 키워드명, 함수명을 사용하지 않는다.
* 의미 없는 단어나, 약속되지 않은 약어를 사용하지 않는다.

**Columns**

* lower\_case\_with\_underscores 형태로 표기한다.
* DBMS 내장 키워드명, 함수명을 사용하지 않는다.
* 의미 없는 단어나, 약속되지 않은 약어를 사용하지 않는다.

**Indexes**

* lower\_case\_with\_underscores 형태로 표기한다.
* 인덱스에 포함된 모든 컬럼명을 모두 입력한다.
* 인덱스 형태별로 아래의 prefix 를 사용한다.
  * Unique : uidx
  * Index : idx

#### Tiggers / Stored Procedures / User Defined Functions / Views

* 사용금지<br>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://devcenter-help.nhn-commerce.com/guide/base-information/structure/naming-rules.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
