-
Notifications
You must be signed in to change notification settings - Fork 0
Common > Status Code: 비트에 의미를 담은 상태 코드 공급기 구현 #65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…h local variables 일부 필드가 지역적으로만 사용되기 때문에 개선합니다.
… in `CustomStatusParameters`
…StatusCodeUtil` - `StatusCodeUtil.getAsLong(CustomStatusParameters<Present, Present>)`
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merge-simpson 님 복잡한 설계 방식을 모두가 이해할 수 있도록 정리해주셔 한결 편하게 읽을 수 있었습니다! 정말 감사드립니다!!
코드를 리뷰하면서 몇 가지 궁금한 점이 있어 질문드립니다!
Q1. StatusParameters로 관리할 만큼 enum 인스턴스들이 여러 파라미터가 필요한지 궁금합니다.
Q2. 위 설계는 컴파일 타임에 일부 파라미터가 누락되는 것을 방지하기 위한 패턴으로 이해했습니다! 하지만 enum 특성상 모든 인스턴스에 미리 정의가 되어, static 블록에서의 유효성 검증으로도 충분히 누락 방지가 가능하지 않을까 의문이 들었습니다. 이 부분에 대해서도 의견이 있으신지 궁금합니다!
@wch-os 님, 예리하고 좋은 질문 감사합니다! Origin question
AnswerQ1. 반드시 그런 것은 아닙니다. 이 DB에 종속적인 관리 전략
각 비트 필드의 역할 부호 비트를 제외하고, 총 4개 구간으로 구분하였습니다.
Q2. 위 설계는 컴파일 타임에 일부 파라미터가 누락되는 것을 방지하기 위한 패턴으로 이해했습니다! 하지만 필요성
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
잘 구조화된 설계와 타입 안전성을 높이기 위한 시도가 인상적입니다.
특히 Type-Safe Marker 패턴을 활용해 "필수 필드가 채워졌는지"를 컴파일 타임에 강제하도록 설계된 점이 매우 인상 깊었고,
비트 구조를 통해 정교하게 상태 코드를 조립하는 Entity Status Code 전략도 응집력 있게 잘 구성되어 있습니다.
코드를 보면서 마치 리눅스의 chmod 명령어처럼,
비트 조합을 통해 권한이나 상태를 관리할 수 있다는 점이 흥미로웠습니다.
고생하셨습니다!
Pull Request
Issues
Description
우리가 사용할 3개 주요 아이템 작업에 집중해 주시면 좋습니다.
1. Type-Safe Markers
JDK 17
sealed
인터페이스와 마커 클래스를 만들어 활용합니다.2, 3. Entity Status Code
Example Use Case
StatusParameters
: 의미를 담은 코드 값을 생성하는 기본 전략을 적용한 파라미터 객체입니다.StatusCodeUtil
: 이하StatusParameters
인스턴스를 정수 코드 값으로 산출해 줍니다.StatusParameters
인스턴스만 입력받습니다. (제네릭 활용)Others
이하 항목은 각 비트 섹션의 크기를 커스텀할 수 있도록 추가한
long
타입 코드 생성 클래스들입니다.코드리뷰에서 집중하지 않아도 되는 부분이라고 생각합니다.
CustomStatusParameters
CustomStatusParametersSupplier
How Has This Been Tested?
StatusCodeUtilTest
에서StatusParameters
테스트를 겸했습니다.Additional Notes
자세한 설명은 다음 페이지를 참고하세요:
See Details (Click): https://nettee.notion.site/2025-type-safe-builder
Entity Status Code 설명
Dynamic Generated Test: 많은 경우의 수를 테스트하기 위해 Pair List를 활용했습니다.
General Purpose 기능 목록은 다양한 조합을 모두 테스트하기 위해 동적으로 테스트를 생성했습니다.