Repository navigation
refactor: 위임만 하는 UseCase 6개 제거 (Phase F, 21 → 15) - #370
Merged
Merged
Conversation
조합도 규칙도 없이 호출만 위임하는 계층을 걷어낸다. 결정표 기준으로 UseCase는
①여러 Repository 조합을 2개 이상 화면이 쓰거나 ②화면 무관 비즈니스 규칙이 있거나
③팀이 커서 변경 차단이 필요할 때 값을 한다. ③은 개발자 2~3명이라 전원 미달이므로
①②로만 판정했다.
## 제거 (6개)
ObserveAlarmUseCase events.updates() 1줄
ObserveAlarmChangeUseCase events.changes() 1줄
RequestAlarmSyncUseCase requesting.syncNow() 1줄
GetUserProfileUseCase userRepository.fetchMe()
GetLastRouteDetailUseCase repository.lastRoute(id:)
UpdateAlertFrequencyUseCase **프로덕션 사용처 0곳 — 죽은 코드**
앞의 셋을 지워도 Feature가 App을 알게 되지 않는다 — `AlarmSyncEvents` 등은 이미
Domain 프로토콜이라 ViewModel이 직접 주입받으면 된다. 같은 프로토콜에 이름만 하나
더 입힌 계층이었다.
`UpdateAlertFrequencyUseCase`는 테스트조차 없었다. 알림 빈도가 레거시처럼 미노출
상태라 화면에서 쓸 일이 없었는데, 계층이 있으니 살아 있는 것처럼 보였다.
## 테스트 스텁이 오히려 단순해졌다
StubObserveAlarmUseCase → StubAlarmSyncEvents
StubGetUserProfileUseCase → StubUserRepository
한 겹이 사라지면서 스텁이 실제 계약을 직접 구현한다.
검증: HomeFeature 66 / SettingsFeature 18 / Debug 빌드
## 남은 것
`SearchPlaces`·`ReverseGeocode`·`GetCurrentLocation`·`RecentSearches` 4개도 같은
위임 계층이지만, 각각 10~13개 파일이 참조한다. 별도로 진행한다.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
조합도 규칙도 없이 호출만 위임하는 계층을 걷어냅니다.
결정표 기준으로 UseCase는 ①여러 Repository 조합을 2개 이상 화면이 쓰거나 ②화면 무관 비즈니스 규칙이 있거나 ③팀이 커서 변경 차단이 필요할 때 값을 합니다. ③은 개발자 2~3명이라 전원 미달이므로 ①②로만 판정했습니다.
제거한 6개
ObserveAlarmUseCaseevents.updates()1줄ObserveAlarmChangeUseCaseevents.changes()1줄RequestAlarmSyncUseCaserequesting.syncNow()1줄GetUserProfileUseCaseuserRepository.fetchMe()GetLastRouteDetailUseCaserepository.lastRoute(id:)UpdateAlertFrequencyUseCase앞의 셋을 지워도 Feature가 App을 알게 되지 않습니다 —
AlarmSyncEvents등은 이미 Domain 프로토콜이라 ViewModel이 직접 주입받으면 됩니다. 같은 프로토콜에 이름만 하나 더 입힌 계층이었습니다.UpdateAlertFrequencyUseCase는 테스트조차 없었습니다. 알림 빈도가 레거시처럼 미노출 상태라 화면에서 쓸 일이 없었는데, 계층이 있으니 살아 있는 것처럼 보였습니다.테스트 스텁이 오히려 단순해졌습니다
한 겹이 사라지면서 스텁이 실제 계약을 직접 구현합니다.
검증
남은 것
SearchPlaces·ReverseGeocode·GetCurrentLocation·RecentSearches4개도 같은 위임 계층이지만, 각각 10~13개 파일이 참조합니다(ViewModel·DIContainer·Example·테스트 스텁). 한 PR에 묶으면 리뷰가 어려워 별도로 진행합니다.목표는 UseCase 11개 — 남기는 것은 전부 다중 포트 조합이거나 비즈니스 규칙을 가진 것들입니다(
RegisterAlarm5포트,RefreshAlarm재스케줄 정책,EvaluateAlarmChange순수 판정 등).🤖 Generated with Claude Code