-
Notifications
You must be signed in to change notification settings - Fork 327
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
[1단계 - 로또 구현] 벡터(백승주) 미션 제출합니다. #580
base: byesol
Are you sure you want to change the base?
Conversation
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.
안녕하세요 벡터!
첫 리뷰를 맡게 된 샐리라고 합니다 🙇🏻♀️
시간이 많지 않으셨을텐데 첫 미션에 테스트까지 정말 잘 구현해주셨네요 👍
고생 많으셨습니다 👏
간단한 코멘트 몇개 남겨 두었어요 확인 부탁드릴게요 !
|
||
### 로또 구매 | ||
|
||
- [x] 구입금액 안내멘트를 출력한다. |
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.
todo 처리 좋네요 👍
@@ -0,0 +1,10 @@ | |||
package constant; | |||
|
|||
public class ErrorMessage { |
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.
에러 메시지 분리까지! 👏
private final Integer matchNumberCount; | ||
private final Boolean matchBonusNumber; | ||
private final Integer price; |
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.
reference type을 사용하신 이유가 있으실까요?
public static WinLottoInfo result(LottoNumbers purchasedLotto, WinLotto winLotto) { | ||
Integer matchNumberCount = winLotto.countMatchNumber(purchasedLotto); | ||
Boolean bonusMatch = winLotto.bonusMatch(purchasedLotto); | ||
if (matchNumberCount <= 2) { |
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.
상수화하신 기준이 궁금하네요!
public LottoNumbers() { | ||
this.numbers = generateLottoNumbers(); | ||
} | ||
|
||
public LottoNumbers(List<Integer> numbers) { | ||
this.numbers = numbers; | ||
} |
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.
이렇게 생성자를 나눠서 만들어주신 이유가 궁금하네요 👀
} | ||
|
||
public Integer readPurchaseAmount() { | ||
Scanner sc = new Scanner(System.in); |
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.
의미있는 변수명을 사용해보면 어떨까요?
for (Entry<WinLottoInfo, Integer> winLottoInfoIntegerEntry : result.entrySet()) { | ||
WinLottoInfo winLottoInfo = winLottoInfoIntegerEntry.getKey(); | ||
Integer count = winLottoInfoIntegerEntry.getValue(); | ||
sum += winLottoInfo.getPrice() * count; |
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.
이렇게 사칙연산으로 구현하게 되면 계산의 우선순위에 대해 검증이 어렵지 않을까요?
nullToZero(result.getCount(FIRST))); | ||
} | ||
|
||
public void printTotalReturn(Result result, Purchase purchase) { |
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.
우리가 코드에서 많이 사용하는 return이란 단어가 함수명에 들어가있으니 어색하게 느껴지는데 벡터는 어떠신가요?
import org.junit.jupiter.api.DisplayName; | ||
import org.junit.jupiter.api.Test; | ||
|
||
class WinLottoInfoTest { |
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.
테스트 작성까지 !! 💯
남겨주신 질문도 답변드립니다 ~ 같이 고민해봐요 !
|
리뷰 요청 및 질문 정리
1. MVC 구조 및 Service 역할
이번 미션에서 MVC 구조를 사용하여 구현했는데, 올바르게 작성된 구조인지 궁금합니다. 또한, 다른 크루들의 코드를 보니 서비스를 추가해서 구현하는 경우를 봤습니다.
View
코드 내부에서 유효성 검사(Validation)를 진행하고 있는데, 이를 별도의 Validator 클래스로 분리하는 것이 좋을까요?2. Enum을 활용한 당첨 결과 타입 정리와 그 개수 관리
현재 로또 당첨 결과를
Enum
타입으로 정의하고, 참가자의 1등, 2등 등의 당첨 결과에 대한 것들을 enummap으로 result란 클래스에서 해당 당첨지의 개수를 저장했는데 이렇게 result란 클래스를 만들어 저장하는것보다 아예 고객에 대한 구입 금액, 결과 등을 저장하는 방식이 더 괜찮을까요?https://prolog.techcourse.co.kr/studylogs/3872