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

코드 리뷰용 pull request입니다. #245

Open
wants to merge 45 commits into
base: main
Choose a base branch
from

Conversation

zxcev
Copy link

@zxcev zxcev commented Oct 26, 2023

No description provided.

mainfn added 30 commits October 22, 2023 02:41
Copy link

@mouse0429 mouse0429 left a 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 사이의 숫자만 가능합니다.")

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 를 상수화 해두셨으니 에러 메세지에도 적용되면 좋을 것 같습니다!

Comment on lines +5 to +6
const val DEFAULT_START_INCLUSIVE = 1
const val DEFAULT_END_INCLUSIVE = 9

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 와 같은 용도의 상수라 둘을 하나로 통일시키는 것도 좋았을 것 같습니다!

Comment on lines +10 to +32
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"
}
}

Choose a reason for hiding this comment

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

[LGTM]
코드리뷰를 많이하진 않았지만 처음 보는 방식이라 너무 신선했고 class를 잘 활용하시다는 느낌을 받았습니다! 한 수 배워갑니다!

Comment on lines +5 to +7
class Reader {
fun readLine() = Console.readLine().trim()
}

Choose a reason for hiding this comment

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

[IMHO]
readline 을 InputView 에서도 한 번 재정의 하셨는데 Reader 클래스의 메소드로 또 재정의 하신 것 같아요!
한 번 재정의한 걸 반복적으로 사용하실 수 있도록 했어도 좋았을 것 같습니다!

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