Skip to content

숫자 야구 게임 다시 구현#3

Open
SeonJuuuun wants to merge 17 commits intomainfrom
seonjjjun
Open

숫자 야구 게임 다시 구현#3
SeonJuuuun wants to merge 17 commits intomainfrom
seonjjjun

Conversation

@SeonJuuuun
Copy link
Owner

No description provided.

Comment on lines +14 to +22
private void validatePlayerNumber(List<Integer> playerNumber) {
validateSize(playerNumber);
}

private void validateSize(List<Integer> playerNumber) {
if(playerNumber.size() != 3){
throw new IllegalArgumentException("3자리를 입력 해야 합니다.");
}
}

Choose a reason for hiding this comment

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

validatePlayerNumber 메서드 내부에 직접 로직을 작성하시지않고 validateSize로 메서드 추출한 이유가 있을까요?

Copy link
Owner Author

Choose a reason for hiding this comment

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

예외가 2개 이상 작성하려다가 지우는걸 깜빡한거 같아요 ! 감사합니다

Copy link

Choose a reason for hiding this comment

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

재시도 역시 player의 입력에 해당하는 것인데 player domain에서 하지 않고 class를 모두 분리한 이유가 있을까요?

Copy link
Owner Author

Choose a reason for hiding this comment

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

안녕하세요 늦게 봐서 죄송해요.
제 생각은 Player domain에서 Retry값을 가지고 있다고 해도 그 값을 사용해서 뭔가 로직을 짤만한 생각이 안났어요!
근데, 생각해보면 논리적으로 Player가 Retry값을 가지고 있는게 맞는거 같기도 하네요??

}

private Computer generateComputerNumber() {
return randomNumberGenerator.generate();
Copy link

Choose a reason for hiding this comment

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

Computer 도메인이 있는데 RandomNumberGenerator는 computer 작업이니 computerService로 두는 것에 대해서는 어떻게 생각하세요?
실제 컴퓨터가 제공하는 기능으로 보고 구분하는것은 어떤가 싶어서 코멘트 남깁니다!

Copy link
Owner Author

Choose a reason for hiding this comment

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

그 생각은 못했는데, Computer에 작업이니 Computer가 담당하게 하는게 나을거 같네요 감사합니다 😁

@@ -0,0 +1,39 @@
package baseball.domain;

public class CountOfBalls {

Choose a reason for hiding this comment

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

Strike 카운트랑 Ball 카운트를 담당해주는 클래스라면 클래스 명을 CountOfBalls 말고 Strike까지 같이 담아주는 클래스명으로 지어보는 것이 어떨까요?

Copy link
Owner Author

Choose a reason for hiding this comment

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

제가 생각한 건 Strike와 ball의 카운트를 세는 Balls 였습니다.
근데 이 클래스 명은 오해할 소지가 있네요! 감사합니다.

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.

4 participants