Skip to content

Conversation

@yu-so-young2
Copy link
Member

📝 작업 내용

  • PickService V2 신규 생성에 따른 PickService 인터페이스 분리
PickService ( 껍데기)
├── PickServiceV1 (기존 PickServiceV1 )
└── PickServiceV2 (신규 V2, 일부 메서드만)

V1: GuestPickService, MemberPickService (implements PickServiceV1)
V2: GuestPickServiceV2, MemberPickServiceV2 (implements PickServiceV2)

💬 리뷰 요구사항(선택)

  • PickService가 최상위 인터페이스다보니, PickController (V1), PickControllerV2 클래스에서 구현체 메서드를 호출하기 위해선 타입캐스팅이 필요합니다.
PickController (V1) → (PickServiceV1) 캐스팅 사용
PickControllerV2 (V2) → (PickServiceV2) 캐스팅 사용

그런데 타입캐스팅이 무조건 필요한 구조라면, 전략패턴에서 상위 인터페이스(PickService)를 반환하는 방식의 추상화 구조가 오히려 복잡성을 증가시키는 건 아닐까 하는 생각이 들기도 합니다.
차라리 PickServiceStrategy 에 V1, V2 메서드를 분리하는 건 어떨까..싶은데 세웅님께 조언을 구합니다~!!

@Component
public class PickServiceStrategy {
    
    // V1 전용 메서드들
    public PickServiceV1 getPickServiceV1() {
        return AuthenticationMemberUtils.isAnonymous() 
            ? applicationContext.getBean(GuestPickService.class)
            : applicationContext.getBean(MemberPickService.class);
    }
    
    // V2 전용 메서드들  
    public PickServiceV2 getPickServiceV2() {
        return AuthenticationMemberUtils.isAnonymous()
            ? applicationContext.getBean(GuestPickServiceV2.class)
            : applicationContext.getBean(MemberPickServiceV2.class);
    }
}

@yu-so-young2 yu-so-young2 requested a review from ssosee October 19, 2025 07:53
@yu-so-young2 yu-so-young2 self-assigned this Oct 19, 2025
Copy link
Member

@ssosee ssosee left a comment

Choose a reason for hiding this comment

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

고생하셨습니다.

@ssosee ssosee merged commit 31c7547 into develop Oct 19, 2025
1 check passed
@yu-so-young2 yu-so-young2 deleted the DP-563 branch October 22, 2025 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants