-
Notifications
You must be signed in to change notification settings - Fork 1.1k
4단계 - 로또(수동) #4236
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
base: username0w
Are you sure you want to change the base?
4단계 - 로또(수동) #4236
Conversation
- 입력 형식 개선으로 불필요해진 메서드 삭제
javajigi
left a comment
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 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<>(); |
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.
👍
| import lotto.view.InputView; | ||
| import lotto.view.ResultView; | ||
|
|
||
| public class LottoApplication { |
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.
전체 로또 프로그램에 대한 Controller 역할(main)과 로또를 생성하는 책임이 혼재되어 있는 느낌이다.
로또 생성하는 부분을 다음과 같은 구조로 구현해 분리해 보면 어떨까?
3단계에서 4단계로 요구사항이 변경될 때 로또를 생성하는 부분의 요구사항만 변경됐다.
로또를 생성하는 부분을 다음과 같은 구조의 인터페이스로 분리해 보는 연습을 해보면 어떨까?
이와 같이 인터페이스로 구현했을 때의 잇점에 대해 고민해 보는 시간을 가져본다.
public interface LottosGenerator {
Lottos generate();
}
안녕하세요.
4단계 - 로또(수동) PR 입니다.