-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
로또: 4단계 - 로또(수동) #4173
base: mia-developer
Are you sure you want to change the base?
로또: 4단계 - 로또(수동) #4173
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.
고생하셨습니다~ 간단한 피드백을 남겼으니 확인한번 부탁드리겠습니다!
private void validate(final TicketCount totalTicketCount, final TicketCount manualTicketCount) { | ||
if (totalTicketCount.getCount() < manualTicketCount.getCount()) { | ||
throw new IllegalArgumentException("수동으로 구매하려는 로또 수가 총 구매 가능한 로또 수를 초과합니다."); | ||
} | ||
} |
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.
이 validate의 의미가 조금 이상하네요.
로직이 틀렸다기 보단, 실제 "autoTicketCount"에 대해서도 필요하지 않을까 생각이 듭니다.
|
||
for (int i = 0; i < manualTicketCount.getCount(); i++) { | ||
tickets.add(new LottoTicket(inputLottoNumbers())); | ||
} |
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.
실제 도메인을 View단에서 만드는게 맞을까요?
public TicketCount inputManualTicketCount() { | ||
System.out.println("수동으로 구매할 로또 수를 입력해 주세요."); | ||
return new TicketCount(Integer.parseInt(scanner.nextLine())); | ||
} | ||
|
||
public List<LottoTicket> inputManualTicketNumbers(final TicketCount manualTicketCount) { |
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.
한번 디자인 패턴중 전략패턴을 고민해보셨으면 좋겠습니다.
티켓을 생성하는데에 있어 자동 생성, 수동 생성 두가지가 있는데 결국 이게 전략패턴으로 구분해서 할수 있지 않을까요?
로또: 4단계 - 로또(수동)