Skip to content

Conversation

@jeongjeongming
Copy link

No description provided.

@jeongjeongming jeongjeongming changed the title Feature/클래스 [전종민_BackEnd] 2주차 과제 제출합니다. Mar 31, 2025
Copy link

@kih1015 kih1015 left a comment

Choose a reason for hiding this comment

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

기능 단위로 작업한 커밋 메시지를 잘 작성해주셨네요.

커밋 메시지 컨벤션에 대해 더 알아보시면 좋아요.

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());
Copy link

Choose a reason for hiding this comment

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

사용자와 상호작용하는 기능과 게임 실행과 관련된 기능이 클래스 단위로 적절하게 잘 분리되어 있어서 좋습니다.

Comment on lines +4 to +5
private static final int MOVE_THRESHOLD = 4;
private static final String POSITION_MARK = "-";
Copy link

Choose a reason for hiding this comment

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

리터럴 값을 하드코딩하지 않고 상수로 선언한 점 좋아요

Comment on lines +9 to +13
return names.stream()
.map(String::trim)
.map(Car::new)
.collect(Collectors.toList());
}
Copy link

Choose a reason for hiding this comment

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

스트림을 사용하는 것은 코드의 유지보수성을 높여주는 등의 많은 이점이 있지만, 단순한 반복의 경우 일반 for문 또는 향상된 for문(foreach)이 속도에서 우수합니다.

단순한 반복일 경우 for문을 사용하는 것도 고려해보시면 좋을 것 같아요

Comment on lines +24 to +28
public static int getTryCount() {
System.out.println("시도할 회수는 몇회인가요?");
return Integer.parseInt(Console.readLine());
}
}
Copy link

Choose a reason for hiding this comment

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

사용자가 숫자가 아닌 값을 입력할 경우를 고려해봐야 할 것 같아요.

사용자의 입력은 예측할 수 없기에 유효한 값을 검증하고 유효한 값이 아닐 경우 어떻게 할 것인지에 대한 고민이 필요해 보입니다.

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;
}
Copy link

Choose a reason for hiding this comment

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

서비스(게임)와 모델(자동차)을 분리한 것 좋아요.

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