-
Notifications
You must be signed in to change notification settings - Fork 2
Java baseball game 신채원 #9
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
base: java_baseball_game_신채원
Are you sure you want to change the base?
Java baseball game 신채원 #9
The head ref may contain hidden characters: "java_baseball_game_\uC2E0\uCC44\uC6D0"
Conversation
|
엇 뭔가 커밋 내용이 branch에 반영이 안된건가요...? 오늘 스터디에서 한번 같이 봐볼게요! |
shkisme
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.
어제 스터디에서 이야기 나왔던 부분들을 다시 한번 코드리뷰로 남겨봅니다! 😎
| baseballgame.Game(); | ||
| loop = input.ifContinue(); | ||
| } | ||
|
|
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.
말씀 드렸듯이 포메터를 적용해보세요! https://withhamit.tistory.com/411
| while(true) { | ||
| user = input.userNum(); | ||
| strike = answer.countStrike(user); | ||
| ball = answer.countSameNum(user) - strike; |
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.
필드, 메서드 네이밍을 할 때 축약은 최대한 지양하는게 좋은 것 같아요!
ex) countSameNum -> countSameNumber
src/main/java/baseball/Input.java
Outdated
| int user = scanner.nextInt(); | ||
| return user; | ||
| } | ||
| public boolean ifContinue() { |
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.
boolean을 반환하는 메서드 네이밍은 is~로 시작하는게 좋습니다!
ex) ifContinue -> isContinue
src/main/java/baseball/Input.java
Outdated
| public boolean ifContinue() { | ||
| System.out.println("게임을 새로 시작하려면 1, 종료하려면 2를 입력하세요."); | ||
| int ifContinue = scanner.nextInt(); | ||
| if (ifContinue == 1) return true; |
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.
자주 사용하거나, 의미가 명확할 필요가 있는 그런 상수들은, Enum을 활용해서 표현해보세요!
| public class randomInt { | ||
| int number; | ||
|
|
||
| randomInt() { |
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.
생성자는 클래스를 생성하는 역할만 해도 충분하다고 생각합니다! 생성자에서 랜덤 숫자를 만드는 것 보다, 랜덤 숫자 생성 메서드를 하나 만들어서 이를 활용해 보는 것은 어떨까요?
shkisme
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.
리뷰 드린거 수정하시면 로직이랑 코드에 대해서 더 자세하게 리뷰해드릴게요!
|
|
||
| import java.util.Random; | ||
|
|
||
| public class randomInt { |
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.
클래스 네이밍은 대문자로 시작하는게 좋습니다!
src/main/java/baseball/InOut.java
Outdated
|
|
||
| public boolean isContinue() { | ||
| System.out.println("게임을 새로 시작하려면 1, 종료하려면 2를 입력하세요."); | ||
| int ifContinue = scanner.nextInt(); |
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.
변수 네이밍이 조금 아쉬워요!
| return strike; | ||
| } | ||
|
|
||
| public int countSameNum(int user) { |
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.
아직 축약어인 메서드들이 존재해요!
src/main/java/baseball/InOut.java
Outdated
|
|
||
| import static baseball.ContinueOrNot.CONTINUE; | ||
|
|
||
| public class InOut { |
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.
클래스 네이밍이 명확하지 않은 것 같아요. InOut 클래스가 어떤 역할을 하는지 잘 와닿지 않습니다.
No description provided.