Repository navigation
refactor: 거대 서비스에서 도달 불가 코드를 지운다 - #142
Merged
Merged
Conversation
HealthService 1011줄을 책임별로 쪼개려고 읽다 보니 상당 부분이 아무도 부르지 않는
코드였다. 부르는 곳이 없는 코드를 옮기는 건 옮긴 만큼만 일이 늘어난다. 컨트롤러에서
거꾸로 따라가 도달 가능한지 확인하고 지웠다.
HealthService / HealthFacade
- analyzeHealthStatus, generateHealthReport: 파사드에는 있는데 컨트롤러가 부르지
않는다. healthScore·riskLevel 같은 값을 만들어 내는데 공개된 적이 없다.
- getHealthGoals: 고정 문자열("모든 예방접종 완료")을 돌려준다. 도달 불가.
- getHealthChart: 도달 불가. 성장 곡선은 GrowthChartService 가 따로 한다.
- checkSystemHealth: {status: UP, version: 1.0.0} 하드코딩. Actuator 의
/actuator/health 와 중복이고 도달 불가.
- getHealthRecords, getHealthRecordsByDateRange: 파사드에도 없다.
- 위 메서드들만 쓰던 private 헬퍼 11개와 상수 3개.
CareFacilityService
- saveCareFacilitiesFromPublicData, countCareFacilities 와 헬퍼 5개는 #137 에서 지운
CareFacilityApiController 가 쓰던 잔재였다. 입구를 지우면 그 뒤에 남는 코드가
생기는데, 그때 같이 지우지 않으면 "쓰이는 코드" 처럼 보인다.
크기
- HealthService 1011 → 715줄
- CareFacilityService 580 → 411줄
- HealthFacade 338 → 309줄
- ArchUnit baseline 364 → 362
- 전체 테스트 632개, 실패 0
- OpenAPI 스펙 변화 없음 — 공개 API 를 하나도 건드리지 않았다. 지운 것은 전부 밖에서
부를 수 없던 코드다.
남은 분해(5b): HealthService 715줄은 아직 건강 기록 CRUD, 아이 조회, 접종·검진 일정,
알림, 통계·추천을 함께 들고 있다. 이 중 아이 조회 4개는 user 도메인 일이라 4a 의
입구로 옮기는 것이 다음 자리다.
Refs #132
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.
Refs #132 (5a 단계)
HealthService1011줄을 책임별로 쪼개려고 읽기 시작했는데, 나누다 보니 상당 부분이 아무도 부르지 않는 코드였습니다. 부르는 곳이 없는 코드를 옮기는 건 옮긴 만큼만 일이 늘어납니다. 컨트롤러에서 거꾸로 따라가 도달 가능한지 확인하고 지웠습니다.HealthService / HealthFacade
analyzeHealthStatus,generateHealthReporthealthScore·riskLevel같은 값을 만들어 내는데 공개된 적이 없다getHealthGoals"모든 예방접종 완료")을 돌려준다. 도달 불가getHealthChartGrowthChartService가 따로 한다checkSystemHealth{status: UP, version: 1.0.0}하드코딩. Actuator 의/actuator/health와 중복이고 도달 불가getHealthRecords,getHealthRecordsByDateRangecalculateHealthScore,determineRiskLevel,generateRecommendations,calculateVaccineStatus,calculateCheckupStatus,calculateProgress,generateHealthSummary,extractChartValue,validateChartType,validateMonths,validatePaginationParamsHEALTH_SCORE_HIGH_THRESHOLD등. 점수 계산이 사라지며 쓸 곳이 없어졌다CareFacilityService — 지운 입구의 잔재
saveCareFacilitiesFromPublicData,countCareFacilities와 헬퍼 5개는 #137 에서 지운CareFacilityApiController가 쓰던 코드였습니다. 입구를 지우면 그 뒤에 남는 코드가 생기는데, 그때 같이 지우지 않으면 "쓰이는 코드" 처럼 보입니다.숫자
HealthServiceCareFacilityServiceHealthFacade남은 분해 (5b)
HealthService715줄은 아직 다섯 가지를 함께 들고 있습니다 — 건강 기록 CRUD, 아이 조회(연령·성별·특별 요구·이름 검색), 접종·검진 일정, 알림, 통계·추천. 이 중 아이 조회 4개는user도메인 일이라 4a 에서 만든 입구로 옮기는 것이 다음 자리입니다.