-
Notifications
You must be signed in to change notification settings - Fork 0
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
도서 대출 연장 기능 추가 및 테스트 #14
Merged
Changes from 1 commit
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
3221555
도서 대출 연장 기능 추가 및 테스트
shine-17 7a89eb5
연장 가능여부 확인 로직 변경
shine-17 23ec6b3
연장한 대출의 반납 일자 변경하는 책임을 Period로 변경
shine-17 886f768
- 연장 가능한 날짜인지 여부의 책임을 Period에 할당
shine-17 8a5658f
연장 가능한 날짜인지 판단하는 로직 변경
shine-17 fc84d63
예약이 있는지 판단하는 로직 변경
shine-17 559eeb4
Inventory 테스트셋 추가
shine-17 43abbc2
기간과 대출 기간의 도메인 분리
shine-17 0c0ee5e
기간과 대출 기간의 도메인 분리
shine-17 c9979b3
도메인 객체 Period -> BorrowPeriod 변경으로 인한 수정
shine-17 a472be3
메서드명 수정
shine-17 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Oops, something went wrong.
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.
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.
now 를 객체 내부에서 직접 얻으면 객체가 결정적이지 못하게 됩니다.
무슨 뜻일까요? 해결할 수 있나요?
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.
항상 동일한 입력 값에 동일한 출력이 나온다는 뜻입니다. (순수함수)
위 코드로는
now
가 시간이 지나면서 다른 결과를 응답해줄 수 있기 때문에 결정적이지 못한 메서드입니다.메서드에서
LocalDate
를 매개변수로 받는다면, 메서드를 호출할 때 파라미터로 오늘 날짜를 넣어야 하는데 다른 날짜를 넣어서 유효성 검사를 통과하여 검증이 제대로 이뤄지지도 않을 수도 있을 것 같아서now
를 내부에서 직접 얻었습니다.해결방법으로
2번이나 3번이 괜찮아보이는데,
만약 매개변수
now
가 오늘 날짜가 아닌 다른 날짜로 넘어왔지만 연장이 가능한 날짜라면 위 방법으로 유효성 검사를 진행했을 때 false 라는 결과를 응답해주는 것도 잘못된 것 같습니다.그럼 예외처리...? 한다고해도 매개변수를 오늘날짜로 강제한다는 건 지금의 코드랑 다를 게 없어 보입니다...😵
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.
ㅋㅋㅋㅋ 그럼 상상력이 등장할 때죠.
자 정리해봅시다. 먼저 연장가능하다 는 것은 Period 에 어울리는 역할일까요?
기간아 연장가능하니? 인지 대출기간아 연장가능하니? 인지 살펴봅시다.
기간이 곧 대출기간인가? 맞다면 이름을 좀 더 구체적으로 지을 필요가 있겠습니다.
따로 대출기간을 다루는 책임은 다른 객체에 있다면 기간은 좀 더 범용적으로 동작하는 방식을 고려해야 좋습니다.
연장 말고 기간에 입장에서 무엇을 검사하고 싶었나 하는거죠.
더.. 얘기하면 뭔가 상상이 줄어들 수 있으니 한번 고민해보세요