Skip to content

Comments

[1단계 - 로또(자동)] 레넌(조형래) 미션 제출합니다.#375

Merged
Laterality merged 63 commits intowoowacourse:broraefrom
brorae:step1
Mar 2, 2022
Merged

[1단계 - 로또(자동)] 레넌(조형래) 미션 제출합니다.#375
Laterality merged 63 commits intowoowacourse:broraefrom
brorae:step1

Conversation

@brorae
Copy link

@brorae brorae commented Feb 24, 2022

안녕하세요. 에단!
레넌입니다.

제 코드가 많이 부족하지만, 잘 부탁드리겠습니다 :)

Copy link

@Laterality Laterality left a comment

Choose a reason for hiding this comment

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

안녕하세요 레넌, 리뷰어 에단입니다 :)

미션 구현하시느라 고생하셨어요!

몇가지 피드백을 남겨드렸는데, 확인 부탁드릴게요.

전반적으로 모델에 있는 게 적절해보이는 지식들이 다른 영역에 흩어져 있는 것으로 보여요.

모델/뷰/컨트롤러가 각각 어떤 책임을 가져야 할지 고민해보시면 좋겠어요.

Copy link

@Laterality Laterality left a comment

Choose a reason for hiding this comment

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

안녕하세요 레넌,

피드백을 잘 반영해주셨어요.

가독성과 컨벤션 관점에서 몇가지 피드백을 추가로 남겨드렸는데, 확인 부탁드릴게요 :)

Copy link

@Laterality Laterality left a comment

Choose a reason for hiding this comment

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

안녕하세요 레넌,

질문 주신 부분과 추가로 몇군데에 코멘트 남겨드렸어요.

질문주신 부분도 확인해보시고, 추가로 궁금하신 점 있으시면 말씀해주세요 :)

@brorae brorae mentioned this pull request Mar 1, 2022
Closed
@brorae
Copy link
Author

brorae commented Mar 1, 2022

실수로 issue를 만들어버렸네요..
Lottos에서 자동로또를 만들어서 처리했었는데, 그러다보니 Lottos에 제가 테스트해보고 싶은 Lotto번호들을 넣기가 어려웠습니다. 자동 로또를 생성하는 부분을 상위로 옮겨보았는데 어느정도 해결된 것 같습니다. (Lottos -> LottoMachine -> LottoController)
LottoController에서 자동로또생성 메소드를 만들어 처리해도 괜찮을까요?
LottoMachine 모델을 따로 만들어서 그 안에서 로또를 자동으로 만들어준다고 하면, 테스트는 어떻게 진행하면 될까요??

Copy link

@Laterality Laterality left a comment

Choose a reason for hiding this comment

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

안녕하세요 레넌,

피드백을 잘 반영해주셨어요.

몇군데 추가로 고쳐볼 만한 부분에 코멘트 남겨드렸으니 확인 부탁드릴게요 :)

자동 로또를 생성하는 구현체를 어디서 만들어야 할지 고민이신 것 같아요.

구현체를 외부에서 전달받아 사용하는 접근은 좋습니다 💯

LottoController를 포함해 관련된 클래스들까지 로또 번호를 생성하는 방식과 무관하게 테스트할 수 있도록 만들려면 구현체를 LottoController 외부에서 전달해야겠네요. 모델의 모든 코드를 테스트해야 한다면 애플리케이션의 main 함수에서 LottoController를 생성할 때 생성자의 인자로 구현체를 전달하게 되겠지요.

@brorae
Copy link
Author

brorae commented Mar 1, 2022

LottoController를 포함해 관련된 클래스들까지 로또 번호를 생성하는 방식과 무관하게 테스트할 수 있도록 만들려면 구현체를 LottoController 외부에서 전달해야겠네요. 모델의 모든 코드를 테스트해야 한다면 애플리케이션의 main 함수에서 LottoController를 생성할 때 생성자의 인자로 구현체를 전달하게 되겠지요.
-> application에서 따로 makeLottos메소드를 사용해서 만든 로또들을 LottoController에 전해주라는 말씀이 맞을까요?? application에서 따로 메소드를 만들어서 사용하는 방식도 괜찮은 방법일까요??
이 방식이 깔끔한 방식은 아닌 것 같아서 테스트만을 위한 LottoGenerator의 구현체 CustomLottoGenerator를 만들어서 테스트하는 방식으로 진행하였는데 괜찮을까요?

@Laterality
Copy link

로또 생성 전략을 전달한다는 의미였습니다.

로또 번호 생성 전략을 컨트롤러 내부에서 생성하는 대신 아래처럼 외부에서 전달하면 컨트롤러도 테스트할 수 있지 않을까요?

new LottoController(new AutoLottoNumbersGenerator());

Copy link

@Laterality Laterality left a comment

Choose a reason for hiding this comment

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

안녕하세요 레넌,

깔끔하게 잘 수정해주셨네요 💯

1단계 미션은 이만 머지하도록 할게요. 정말 고생 많으셨어요!

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