Skip to content
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

Open
wants to merge 1 commit into
base: mia-developer
Choose a base branch
from

Conversation

mia-developer
Copy link

로또: 4단계 - 로또(수동)

  • 현재 로또 생성기는 자동 생성 기능만 제공한다. 사용자가 수동으로 추첨 번호를 입력할 수 있도록 해야 한다.
  • 입력한 금액, 자동 생성 숫자, 수동 생성 번호를 입력하도록 해야 한다.

Copy link

@ksy90101 ksy90101 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

고생하셨습니다~ 간단한 피드백을 남겼으니 확인한번 부탁드리겠습니다!

Comment on lines +16 to +20
private void validate(final TicketCount totalTicketCount, final TicketCount manualTicketCount) {
if (totalTicketCount.getCount() < manualTicketCount.getCount()) {
throw new IllegalArgumentException("수동으로 구매하려는 로또 수가 총 구매 가능한 로또 수를 초과합니다.");
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이 validate의 의미가 조금 이상하네요.
로직이 틀렸다기 보단, 실제 "autoTicketCount"에 대해서도 필요하지 않을까 생각이 듭니다.

Comment on lines +25 to +28

for (int i = 0; i < manualTicketCount.getCount(); i++) {
tickets.add(new LottoTicket(inputLottoNumbers()));
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

실제 도메인을 View단에서 만드는게 맞을까요?

Comment on lines +17 to +22
public TicketCount inputManualTicketCount() {
System.out.println("수동으로 구매할 로또 수를 입력해 주세요.");
return new TicketCount(Integer.parseInt(scanner.nextLine()));
}

public List<LottoTicket> inputManualTicketNumbers(final TicketCount manualTicketCount) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

한번 디자인 패턴중 전략패턴을 고민해보셨으면 좋겠습니다.
티켓을 생성하는데에 있어 자동 생성, 수동 생성 두가지가 있는데 결국 이게 전략패턴으로 구분해서 할수 있지 않을까요?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants