-
Notifications
You must be signed in to change notification settings - Fork 225
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
코드 리뷰용 pull request입니다. #245
base: main
Are you sure you want to change the base?
Conversation
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.
1주차인데 3주차 미션 나오고 리뷰하려니 매우 부끄럽네요.. 부족한 코드 꼼꼼하게 리뷰해주셔서 많이 배웠기 때문에 저도 뭔가 도움이 되고 싶었는데 실력이 부족하여.. 그러진 못한 것 같습니다 오히려 짜두신 코드를 보며 제가 많이 배웠네요...!!
앞으로 남은 3주차, 4주차 미션도 같이 화이팅해봐요!!
|
||
private fun validateBallNumber(ballNumber: Int) { | ||
if (ballNumber < MIN_BALL_NUMBER || ballNumber > MAX_BALL_NUMBER) { | ||
throw IllegalArgumentException("BallNumber는 1~9 사이의 숫자만 가능합니다.") |
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.
[Nit]
진짜 사소하지만...!!! MIN_BALL_NUMBER 와 MAX_BALL_NUMBER 를 상수화 해두셨으니 에러 메세지에도 적용되면 좋을 것 같습니다!
const val DEFAULT_START_INCLUSIVE = 1 | ||
const val DEFAULT_END_INCLUSIVE = 9 |
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.
[IMHO]
MIN_BALL_NUM, MAX_BALL_NUM 와 같은 용도의 상수라 둘을 하나로 통일시키는 것도 좋았을 것 같습니다!
override fun render(): String { | ||
if (gameResult.ballCount + gameResult.strikeCount == 0) { | ||
return Hint.NOTHING.value | ||
} | ||
return listOf( | ||
renderHint(Hint.BALL, gameResult.ballCount), | ||
renderHint(Hint.STRIKE, gameResult.strikeCount), | ||
).joinToString(" ") | ||
.trim() + | ||
LINE_BREAK | ||
} | ||
|
||
private fun renderHint(hint: Hint, count: Int) = | ||
when (count) { | ||
0 -> EMPTY | ||
else -> "$count${hint.value}" | ||
} | ||
|
||
companion object { | ||
const val EMPTY = "" | ||
const val LINE_BREAK = "\n" | ||
} | ||
} |
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.
[LGTM]
코드리뷰를 많이하진 않았지만 처음 보는 방식이라 너무 신선했고 class를 잘 활용하시다는 느낌을 받았습니다! 한 수 배워갑니다!
class Reader { | ||
fun readLine() = Console.readLine().trim() | ||
} |
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.
[IMHO]
readline 을 InputView 에서도 한 번 재정의 하셨는데 Reader 클래스의 메소드로 또 재정의 하신 것 같아요!
한 번 재정의한 걸 반복적으로 사용하실 수 있도록 했어도 좋았을 것 같습니다!
No description provided.