Skip to content

Conversation

@chairoi
Copy link

@chairoi chairoi commented Nov 7, 2022

No description provided.

@chairoi chairoi self-assigned this Nov 7, 2022
@shkisme shkisme self-requested a review November 7, 2022 23:55
@shkisme
Copy link
Contributor

shkisme commented Nov 9, 2022

엇 뭔가 커밋 내용이 branch에 반영이 안된건가요...? 오늘 스터디에서 한번 같이 봐볼게요!

Copy link
Contributor

@shkisme shkisme left a comment

Choose a reason for hiding this comment

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

어제 스터디에서 이야기 나왔던 부분들을 다시 한번 코드리뷰로 남겨봅니다! 😎

baseballgame.Game();
loop = input.ifContinue();
}

Copy link
Contributor

Choose a reason for hiding this comment

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

말씀 드렸듯이 포메터를 적용해보세요! https://withhamit.tistory.com/411

while(true) {
user = input.userNum();
strike = answer.countStrike(user);
ball = answer.countSameNum(user) - strike;
Copy link
Contributor

Choose a reason for hiding this comment

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

필드, 메서드 네이밍을 할 때 축약은 최대한 지양하는게 좋은 것 같아요!
ex) countSameNum -> countSameNumber

int user = scanner.nextInt();
return user;
}
public boolean ifContinue() {
Copy link
Contributor

Choose a reason for hiding this comment

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

boolean을 반환하는 메서드 네이밍은 is~로 시작하는게 좋습니다!
ex) ifContinue -> isContinue

public boolean ifContinue() {
System.out.println("게임을 새로 시작하려면 1, 종료하려면 2를 입력하세요.");
int ifContinue = scanner.nextInt();
if (ifContinue == 1) return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

자주 사용하거나, 의미가 명확할 필요가 있는 그런 상수들은, Enum을 활용해서 표현해보세요!

public class randomInt {
int number;

randomInt() {
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
Contributor

@shkisme shkisme left a comment

Choose a reason for hiding this comment

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

리뷰 드린거 수정하시면 로직이랑 코드에 대해서 더 자세하게 리뷰해드릴게요!


import java.util.Random;

public class randomInt {
Copy link
Contributor

Choose a reason for hiding this comment

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

클래스 네이밍은 대문자로 시작하는게 좋습니다!


public boolean isContinue() {
System.out.println("게임을 새로 시작하려면 1, 종료하려면 2를 입력하세요.");
int ifContinue = scanner.nextInt();
Copy link
Contributor

Choose a reason for hiding this comment

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

변수 네이밍이 조금 아쉬워요!

return strike;
}

public int countSameNum(int user) {
Copy link
Contributor

Choose a reason for hiding this comment

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

아직 축약어인 메서드들이 존재해요!


import static baseball.ContinueOrNot.CONTINUE;

public class InOut {
Copy link
Contributor

Choose a reason for hiding this comment

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

클래스 네이밍이 명확하지 않은 것 같아요. InOut 클래스가 어떤 역할을 하는지 잘 와닿지 않습니다.

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