-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Step2 - 로또(자동) #4207
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
Step2 - 로또(자동) #4207
Conversation
- 요구사항 추출 및 객체설계
- 요구사항에 맞게 각 객체별 기능 TDD로 구현 시도
- TDD로 작성한 로직 컨트롤러 클래스에서 조립 - 뷰 관련 기능 구현
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.
로또 미션 본격적으로 시작했네요. 👍
전체적인 객체 설계 잘 했네요.
특히 LottoFixture 추가한 것이 색다른 면이 있네요.
피드백 남기기는 했는데요.
전체적인 객체 설계에 큰 영향을 미치지 않을 것 같아 바로 merge해요.
3단계 진행할 때 함께 반영해 보세요.
단, 3단계 진행할 때 가능하면 컴파일 에러도 최소화하면서 점진적으로 리팩터링 및 기능 추가 도전해 볼 것을 추천합니다.
| import lottoGame.view.WinResultDto; | ||
|
|
||
| public class LottoStore { | ||
| public static final int PER_LOTTO_PRICE = 1000; |
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_000"와 같이 언더바를 통해 구분할 수 있다.
|
|
||
| private final List<LottoNum> lottoNums; | ||
|
|
||
| public Lotto(List<LottoNum> lottoNums) { |
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.
LottoNum 중복 값에 대한 유효성 처리도 해야하지 않을까?
|
|
||
| import java.util.Objects; | ||
|
|
||
| public class LottoNum implements Comparable<LottoNum>{ |
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 static List<LottoNum> createLotto(int numCount) { |
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.
Set으로 생성했으면 Set으로 반환해도 될 것 같은데 굳이 List로 변환한 필요 있을까?
| this.lottos = lottos; | ||
| } | ||
|
|
||
| public WinnerResult compareAndElectWinResult(BeforeWinNums beforeWinNums) { |
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.
Lotto와 BeforeWinNums가 가지는 책임이 같이 보이는데 굳이 분리할 필요 있을까?
둘을 합쳐서 구현해도 되지 않을까?
| import java.util.List; | ||
|
|
||
| public class BeforeWinNums { | ||
| private final List<Integer> winNums; |
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 List<Integer> winNums; | |
| private final List<LottoNum> winNums; |
LottoNum을 사용하지 않은 이유는?
|
|
||
| import java.util.Arrays; | ||
|
|
||
| public enum WinStandard { |
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 lottoGame.model.lotto.LottoNum; | ||
| import lottoGame.model.winner.BeforeWinNums; | ||
|
|
||
| public class LottoFixture { |
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.
LottoFixture 추가한 것이 색다름
로또 Step2 로또(자동) 결과물 입니다.
이번 훈련은 라이브 강의의 내용을 기반으로 객체설계 + TDD를 시도 해봤습니다.
다만 처음부터 TDD 할 기능들을 역순으로 만들어 놓고 이후 큰 흐름을 조립하는게 아직은 좀 낯서네요
그래도 TDD 와 좋은 객체설계가 왜 연관되어 있는지 약간은 체감할수 있었습니다.
아쉬운건 객체간의 대화 한다는 관점으로 컨트롤러 역할의 클래스를 작성해보려고 했는데.. 이부분은 좀더 연습이 필요할 것 같습니다.
확인후 많은 피드백 부탁드립니다! 감사합니다!