Open
Conversation
0702Yoon
reviewed
Sep 22, 2025
0702Yoon
left a comment
There was a problem hiding this comment.
특정 부분에서 잘짰다고 생각하는 부분도 존재하고 노력하신 게 보여서 좋습니다!
하지만 전체적으로 "매직넘버" 처리가 안되어있고, controller의 역할이 좀 많아보여요. 한번 분리해보시죠
Comment on lines
+20
to
+26
| if (trimmed.isEmpty()) { | ||
| throw new IllegalArgumentException("자동차 이름이 공백"); | ||
| } | ||
|
|
||
| if (trimmed.length() > 5) { | ||
| throw new IllegalArgumentException("이름 오류"); | ||
| } |
There was a problem hiding this comment.
View에서 검사까지 하도록 일부로 노리신 건가요? 책임 분리 해볼까요?
또한 현재 예외 메시지만을 보고는 정확한 도메인 이해가 잘 되지 않아요.
| //경주차 이름 입력 | ||
| public String[] getMemberNames() { | ||
| System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,) 기준으로 구분)"); | ||
| List<String> lst = List.of(scanner.nextLine().split(",")); |
There was a problem hiding this comment.
split을 통해 배열로도 받을 수 있는 데 List로 받으신 이유가 특별히 있나요?
|
|
||
| public class Controller { | ||
| private final View view; | ||
| private final List<Member> members = new ArrayList<>(); |
There was a problem hiding this comment.
현재는 무조건 하나의 게임만 존재하기 떄문에 이렇게 구현해도 괜찮지만, 한번 이 Controller가 상태를 갖지 않도록 해볼까요?
Comment on lines
+8
to
+9
| private String name; | ||
| private int go; |
| //경주차 간거 표시 | ||
| public void printProgress(List<Member> members) { | ||
| for (Member m : members) { | ||
| System.out.println(m.getName() + " : " + "-".repeat(m.getGo())); |
There was a problem hiding this comment.
member에서 get을 사용하지 않고 값을 보여주도록 해볼까요?
get을 쓰면 안좋은 이유가 뭐가 있을까요?
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.
No description provided.