[전종민_BackEnd] 2주차 과제 제출합니다.#55
Open
jeongjeongming wants to merge 9 commits intoBCSDLab-Edu:mainfrom
Hidden character warning
The head ref may contain hidden characters: "feature/\ud074\ub798\uc2a4"
Open
Conversation
kih1015
reviewed
Apr 2, 2025
kih1015
left a comment
There was a problem hiding this comment.
기능 단위로 작업한 커밋 메시지를 잘 작성해주셨네요.
커밋 메시지 컨벤션에 대해 더 알아보시면 좋아요.
Comment on lines
+7
to
+16
| List<String> carNames = InputView.getCarNames(); | ||
| int tryCount = InputView.getTryCount(); | ||
|
|
||
| List<Car> cars = CarFactory.createCars(carNames); | ||
|
|
||
| System.out.println(); | ||
| Race race = new Race(cars, tryCount); | ||
| race.start(); | ||
|
|
||
| ResultView.printWinners(race.getWinners()); |
There was a problem hiding this comment.
사용자와 상호작용하는 기능과 게임 실행과 관련된 기능이 클래스 단위로 적절하게 잘 분리되어 있어서 좋습니다.
Comment on lines
+4
to
+5
| private static final int MOVE_THRESHOLD = 4; | ||
| private static final String POSITION_MARK = "-"; |
Comment on lines
+9
to
+13
| return names.stream() | ||
| .map(String::trim) | ||
| .map(Car::new) | ||
| .collect(Collectors.toList()); | ||
| } |
There was a problem hiding this comment.
스트림을 사용하는 것은 코드의 유지보수성을 높여주는 등의 많은 이점이 있지만, 단순한 반복의 경우 일반 for문 또는 향상된 for문(foreach)이 속도에서 우수합니다.
단순한 반복일 경우 for문을 사용하는 것도 고려해보시면 좋을 것 같아요
Comment on lines
+24
to
+28
| public static int getTryCount() { | ||
| System.out.println("시도할 회수는 몇회인가요?"); | ||
| return Integer.parseInt(Console.readLine()); | ||
| } | ||
| } |
There was a problem hiding this comment.
사용자가 숫자가 아닌 값을 입력할 경우를 고려해봐야 할 것 같아요.
사용자의 입력은 예측할 수 없기에 유효한 값을 검증하고 유효한 값이 아닐 경우 어떻게 할 것인지에 대한 고민이 필요해 보입니다.
Comment on lines
+8
to
+15
| public class Race { | ||
| private final List<Car> cars; | ||
| private final int tryCount; | ||
|
|
||
| public Race(List<Car> cars, int tryCount) { | ||
| this.cars = cars; | ||
| this.tryCount = tryCount; | ||
| } |
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.