Skip to content

refactor: DI container 식별자 상수명 변경#922

Merged
nxnaxx merged 2 commits into
githru:mainfrom
nxnaxx:refactor/#866_rename-di-tokens
Oct 7, 2025
Merged

refactor: DI container 식별자 상수명 변경#922
nxnaxx merged 2 commits into
githru:mainfrom
nxnaxx:refactor/#866_rename-di-tokens

Conversation

@nxnaxx

@nxnaxx nxnaxx commented Oct 1, 2025

Copy link
Copy Markdown
Contributor

Related issue

#898

Result

DI 컨테이너에서 사용하는 식별자 상수의 네이밍을 개선하였습니다.

기존 문제점

  • TOKEN 이라는 용어가 Github API 토큰 등의 인증 토큰과 혼동할 수 있음
  • SERVICE라는 네이밍 역시 DI 컨테이너 식별자임을 명확하게 드러내지 못함

-> DI_IDENTIFIERS라는 이름으로 변경함으로써 DI 컨테이너에서 사용하는 식별자임을 명확하게 표현합니다.

Work list

  • 상수명 변경: SERVICE_TOKENS -> DI_IDENTIFIERS (view/engine)
  • 파일명 변경
    • view: container/tokens.tscontainer/identifiers.ts
    • engine: src/tokens.tssrc/diIdentifiers.ts
  • 참조 업데이트: 관련 임포트/사용처 교체

패키지별 파일명 차이

view - container/identifiers.ts

  • container/ 디렉터리가 이미 DI 관련임을 명시하고 있음
  • 상수명 자체가 DI 식별자임을 나타내고 있음
    import { DI_IDENTIFIERS } from "container/identifiers";
    -> 파일명은 간결하게 표기

engine - src/diIdentifiers.ts

  • engine 패키지 가이드라인에 따르면 타입 파일을 제외한 나머지 파일들은 src 하위 1-depth로 관리함 -> 디렉터리 생성 X
  • src 루트 하위에 위치하므로 파일명 자체에서 DI 관련임을 명시할 필요가 있음

각 패키지가 이미 고유 컨벤션을 따르고 있고 패키지 간 이동보다는 개별 패키지 내에서 작업하는 경우가 많아, 통일된 파일명보다는 패키지별 기존 패턴을 따르는 것이 자연스럽다고 생각하였습니다.

Discussion

nxnaxx added 2 commits October 2, 2025 00:14
- Clarify naming of DI container identifiers
- Rename tokens.ts to identifiers.ts to better reflect intent
- Update related imports/usages across the codebase
- Clarify naming of DI container identifiers
- Rename serviceTokens.ts to diIdentifiers.ts to better reflect intent
- Update related imports/usages across the codebase
@nxnaxx
nxnaxx requested review from a team as code owners October 1, 2025 17:56
@nxnaxx nxnaxx added the refactor label Oct 1, 2025

@ytaek ytaek left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

친절한 PR description 덕분에 바로 수정사항이 이해가 되었습니다!! 💯💯💯💯💯
사소해보일지라도 코드의 가독성이 올라가면 인지부하를 줄여주는 부분이 작지 않기 때문에, 이런 리팩토링 류 활동이 너무 좋은 것 같습니다!

@@ -1,3 +1,3 @@
export const SERVICE_TOKENS = {
export const DI_IDENTIFIERS = {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(완전 취향) identifiers 를 복수로 하냐 단수로 하냐 이런것도 재밌는(?) 논의사항이 될 수 있습니다 ㅎㅎ

변수 사용시에
DI_IDENTIFIERS.Otcokit 으로 보이는게 맞느냐
DI_IDENTIFIER.Otcokit 으로 보이는게 맞느냐

이걸 하나의 type으로 생각한다면 단수가 맞을 수 있고.
(그룹이라고 생각하면 그룹이름인거죠)
여러개 다른 성격의 뭉침이라고 생각하면 복수가 맞을 수도 있을 것 같구요.

너무 사소하지만 한번쯤 말해보고 싶었습니다 😈😈😈😈

@nxnaxx nxnaxx self-assigned this Oct 2, 2025

@Zy0ung Zy0ung left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !!!!
덕분에 코드 가독성이 더 좋아진 것 같습니다 ㅎㅎ 고생하셨습니다!!

@Kyoungwoong Kyoungwoong left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!!

@nxnaxx
nxnaxx merged commit 0f35ed7 into githru:main Oct 7, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants