Skip to content

Conversation

@username0w
Copy link

안녕하세요.
4단계 - 로또(수동) PR 입니다.

Copy link
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

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

앞 단계의 객체 설계를 잘 구현해 놓다보니 최종 결과 값과 수익률 계산 등의 객체에 영향을 주지 않으면서 구현 잘 했네요. 👍
단, 로또를 생성하는 부분에 변화가 많았는데요.
로또 생성하는 부분도 요구사항 변화에 유연하게 대응하기 위해 도전해 봤으면 하는 부분이 있어 피드백 남겼어요.

private static final String ERROR_OUT_OF_RANGE = "로또 번호는 1~45 범위의 숫자여야 한다";

private static final LottoNumber[] CACHE = new LottoNumber[MAX_NUMBER + 1];
private static final Map<Integer, LottoNumber> CACHE = new HashMap<>();
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

import lotto.view.InputView;
import lotto.view.ResultView;

public class LottoApplication {
Copy link
Contributor

Choose a reason for hiding this comment

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

전체 로또 프로그램에 대한 Controller 역할(main)과 로또를 생성하는 책임이 혼재되어 있는 느낌이다.
로또 생성하는 부분을 다음과 같은 구조로 구현해 분리해 보면 어떨까?


3단계에서 4단계로 요구사항이 변경될 때 로또를 생성하는 부분의 요구사항만 변경됐다.
로또를 생성하는 부분을 다음과 같은 구조의 인터페이스로 분리해 보는 연습을 해보면 어떨까?
이와 같이 인터페이스로 구현했을 때의 잇점에 대해 고민해 보는 시간을 가져본다.

public interface LottosGenerator {
    Lottos generate();
}

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