step3 Section과 Sections 구현 및 테스트 완료#826
Open
nocomet wants to merge 1 commit intonext-step:nocometfrom
Open
Conversation
jaeyeonling
requested changes
Jun 27, 2022
jaeyeonling
left a comment
There was a problem hiding this comment.
미션을 잘 진행해주셨습니다 👍
코멘트 남겨두었으니 확인 부탁드릴게요~
| Station upStation = stationService.findStationEntityById(lineRequest.getUpStationId()); | ||
| Station downStation = stationService.findStationEntityById(lineRequest.getDownStationId()); | ||
| Line line = lineRepository.save(new Line(lineRequest.getName(), lineRequest.getColor())); | ||
| line.initSections(new Section(upStation, downStation, lineRequest.getDistance(), line)); |
There was a problem hiding this comment.
Line의 생성과 initSections를 분리해주신 이유가 있을까요?
| } | ||
|
|
||
| public boolean canAddFirstSection(Section newSection) { | ||
| if (isNotValidNewSection(newSection)) { |
There was a problem hiding this comment.
Suggested change
| if (isNotValidNewSection(newSection)) { | |
| if (newSection.isNotValidNewSection()) { |
두 방식은 어떠한 차이가 있을까요?
| public void add(Section newSection) { | ||
| checkAlreadyExist(newSection); | ||
| if (addIfFirstSection(newSection)) { | ||
| return ; |
There was a problem hiding this comment.
Suggested change
| return ; | |
| return; |
공백을 추가해주신 이유가 있을까요?
| addIfIntersection(newSection); | ||
| } | ||
|
|
||
| private boolean addIfFirstSection(Section newSection) { |
There was a problem hiding this comment.
해당 메서드는 변경과 조회의 역할 두 가지 모두 하고 있는데요.
변경의 메서드와 조회의 메서드를 분리하여 유지보수성을 높여보면 어떨까요?
관련 키워드로는 CQS(Command Query Separation) 입니다 :)
| StationResponse 정자역 = StationTestHelper.지하철역_생성("정자역").as(StationResponse.class); | ||
|
|
||
| // when | ||
| ExtractableResponse<Response> addSectionResponse = SectionTestHelper.지하철에_노선_지하철역_등록(신분당선.getId(), new SectionRequest(강남역.getId(), 정자역.getId(), 신분당선_distance + 1)); |
| } | ||
|
|
||
| public boolean isSameSection(Section newSection) { | ||
| return isInterSection() |
There was a problem hiding this comment.
isSameSection이라는 메서드명으로 봤을 때 isInterSection을 검증하는 것은 오해의 소지가 될 것 같은데 어떻게 생각하시나요?
| @JoinColumn(name = "down_station_id", foreignKey = @ForeignKey(name = "fk_section_to_down_station")) | ||
| private Station downStation; | ||
|
|
||
| @Column(name = "distance") |
There was a problem hiding this comment.
Suggested change
| @Column(name = "distance") | |
| @Column |
변수명과 동일하다면 name을 따로 지정하지 않아도 됩니다 ㅎㅎ
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.
안녕하세요 멘토님~
단계가 진행될수록 재밌는 과제인 것 같습니다!
다대다 구조를 매끄럽게 처리하는 방법도 배운 것 같아 좋은 경험이 된 것 같아요!
게다가 atdd 방식을 계속해서 학습하고 있다는게 정말 좋은 것 같습니다!
피드백 주시면 잘 검토하도록 하겠습니다. 감사합니다.