[숫자 야구 게임] 장대영 미션 제출합니다.#4
Open
hururu1234 wants to merge 16 commits intogdgoc-skhu-missions:hururu1234from
Open
[숫자 야구 게임] 장대영 미션 제출합니다.#4hururu1234 wants to merge 16 commits intogdgoc-skhu-missions:hururu1234from
hururu1234 wants to merge 16 commits intogdgoc-skhu-missions:hururu1234from
Conversation
HanHyunsoo
requested changes
Apr 1, 2024
Collaborator
HanHyunsoo
left a comment
There was a problem hiding this comment.
느낀점
- 코틀린 문법을 잘 몰라서 문법에 대한 조언 드리기 힘들다고 먼저 말씀 드릴 수 있을 것같습니다. 양해 주시면 감사하겠습니다.
- object 개념이 되게 신기하네요 내부적으로 어떻게 동작해서 싱글톤 패턴을 지킬 수 있는지 저도 한번 공부해봐야겠습니다 ㅎ
- MVC 패턴으로 구분한 것이 좋네요. 역할이 애매한 클래스도 있으니 각 레이어에 맞게 재배치하시면 좋을 것 같습니다.
- 테스트코드를 작성해서 성공, 실패 케이스를 모두 테스트하면 완성도있는 코드에 가까워질 것 같습니다! 한번 시도해보세요~
| private val inputView: Input, | ||
| private val outputView: Output, | ||
| ) { | ||
| private var user = User() |
Collaborator
There was a problem hiding this comment.
-
모델에 해당하는 데이터들이 바뀌지 않기 때문에 val을 쓰시는게 더 좋을 것 같습니다.
-
컨트롤러가 여러개 만들어진다면 그만큼 모델들도 만들어지기 때문에 객체간의 결합도를 줄이는 방법을 고려해보세요.
| package baseball.util | ||
|
|
||
| object Constants { | ||
| const val START_MESSAGE = "숫자 야구 게임을 시작합니다." |
Collaborator
There was a problem hiding this comment.
각 변수들에 대한 타입 지정을 하시는 게 좋을 것 같습니다. val 키워드가 값을 변경하지 않더라도 명시해두면 가독성이 더 높아질 것 같아요.
| import baseball.util.Validator.validateNumber | ||
| import camp.nextstep.edu.missionutils.Console | ||
|
|
||
| class Input { |
Collaborator
There was a problem hiding this comment.
Input 클래스의 역할은 입력을 처리하는데 해당 역할을 컨트롤러가 수행하는게 MVC 패턴에 더 맞지 않을까요?
Collaborator
There was a problem hiding this comment.
입력의 역할은 Controller만 하는 줄 알았는데 제가 잘 못 알고 있던 것 같습니다. 그대로 가시면 될 것 같습니다.
| } | ||
|
|
||
| fun printResultMessage(ball: Int, strike: Int) { //매칭 결과 문구 출력 | ||
| when { |
Collaborator
There was a problem hiding this comment.
각 케이스별로 println을 쓸 수 있지만 case문을 통해 문자열을 반환해서 println문 한번만 쓰면 좀더 가독성잇게 바뀔 수 있을 것 같습니다.
|
|
||
| fun generateNumber() { | ||
| val number = mutableListOf<Int>() | ||
| while(number.size < NUMBER_SIZE) { |
Collaborator
There was a problem hiding this comment.
리스트 대신 다른 자료구조로 시간복잡도를 개선할 수 있을것같아요.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
어려웠던 점
-코틀린을 처음 접해서 코드를 이해하는데 어려움을 겪었습니다.
-객체 지향적, 캡슐화 코드에 적용하고 이해하는데 어려움을 겪었습니다.
-아키텍처 디자인이라는 개념이 어려웠습니다.
궁금한 점