Skip to content
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

1단계 미션 제출합니다. #9

Open
wants to merge 26 commits into
base: mincheolkk
Choose a base branch
from

Conversation

mincheolkk
Copy link

안녕하세요! 리뷰 부탁드립니다 :)

@mincheolkk mincheolkk self-assigned this May 30, 2024
Copy link
Contributor

@ksy90101 ksy90101 left a comment

Choose a reason for hiding this comment

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

살짝 큰 건에 대한 리뷰를 남겼어요!
수정다하시면 맨션주시면 리뷰 할게요!

src/main/java/baseball/BaseballGame.java Outdated Show resolved Hide resolved
Comment on lines 11 to 21
public List<Integer> generateRandomDigits() {
List<Integer> digits = new ArrayList<>();

while (digits.size() < COMPUTER_DIGITS_SIZE) {
Random random = new Random();
int randomNumber = random.nextInt(9) + 1;
addToDigits(digits, randomNumber);
}

return digits;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

이러면 테스트하기가 어려운거 같습니다.
https://tecoble.techcourse.co.kr/post/2020-05-17-appropriate_method_for_test_by_interface/
이글을 참고해서 한번 변경해보면 어떨까요?

Copy link
Contributor

Choose a reason for hiding this comment

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

이걸 변경하면 테스트 코드를 많이 추가할수 있을거 같아요.

Copy link
Author

Choose a reason for hiding this comment

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

숫자 생성을 외부에서 주입 받게 변경해봤습니다. 랜덤 주입이 아닐 경우에 무한루프를 타게 되는데, 코드를 변경할지 고민하다가 '비정상일때는 무한루프를 돈다' 이걸 검증하는 테스트 코드를 만들어봤습니다. 특정 시간안에 끝나지 못하면 무한루프라 판정하고 테스트를 성공으로 종료하게 만들었는데요. 이런식으로 구현해도 괜찮을까요 ??

Comment on lines 7 to 9
private static final String BALL_CALL = "볼";
private static final String STRIKE_CALL = "스트라이크";
private static final String NOTHING_CALL = "낫싱";
Copy link
Contributor

Choose a reason for hiding this comment

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

이런 경우 enum을 이용해보는것도 방법일거 같아요.


import java.util.List;

public class Referee {
Copy link
Contributor

Choose a reason for hiding this comment

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

한번 PlayerBalls를 만들고 Ball이라는것을 객체로 만들어보면 어떨까요?
좀더 객체지향적인 설계를 해보면 좋을거 같습니다.

Copy link
Author

Choose a reason for hiding this comment

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

컴퓨터와 유저가 입력한 숫자들을 저장할 수 있는 객체들을 추가해봤습니다!

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