-
Notifications
You must be signed in to change notification settings - Fork 55
[전종민_BackEnd] 2주차 과제 제출합니다. #55
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
base: main
Are you sure you want to change the base?
The head ref may contain hidden characters: "feature/\uD074\uB798\uC2A4"
Conversation
kih1015
left a comment
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.
기능 단위로 작업한 커밋 메시지를 잘 작성해주셨네요.
커밋 메시지 컨벤션에 대해 더 알아보시면 좋아요.
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
사용자와 상호작용하는 기능과 게임 실행과 관련된 기능이 클래스 단위로 적절하게 잘 분리되어 있어서 좋습니다.
| private static final int MOVE_THRESHOLD = 4; | ||
| private static final String POSITION_MARK = "-"; |
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.
리터럴 값을 하드코딩하지 않고 상수로 선언한 점 좋아요
| return names.stream() | ||
| .map(String::trim) | ||
| .map(Car::new) | ||
| .collect(Collectors.toList()); | ||
| } |
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.
스트림을 사용하는 것은 코드의 유지보수성을 높여주는 등의 많은 이점이 있지만, 단순한 반복의 경우 일반 for문 또는 향상된 for문(foreach)이 속도에서 우수합니다.
단순한 반복일 경우 for문을 사용하는 것도 고려해보시면 좋을 것 같아요
| public static int getTryCount() { | ||
| System.out.println("시도할 회수는 몇회인가요?"); | ||
| return Integer.parseInt(Console.readLine()); | ||
| } | ||
| } |
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.
사용자가 숫자가 아닌 값을 입력할 경우를 고려해봐야 할 것 같아요.
사용자의 입력은 예측할 수 없기에 유효한 값을 검증하고 유효한 값이 아닐 경우 어떻게 할 것인지에 대한 고민이 필요해 보입니다.
| 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; | ||
| } |
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.
서비스(게임)와 모델(자동차)을 분리한 것 좋아요.
No description provided.