Skip to content

Conversation

@qwer920414-ctrl
Copy link

step5 피드백 요청드립니다.

전부 지우고 다시 시작해보니, 접근이 조금 달라진거 같습니다.
결국은 비슷한 결과물이 나왔던거 같은데, 조금 더 하나의 객체에 역할을 부여하는 방향으로 접근해봤습니다.

다만, 마지막 RacingResult는 'MVC 패턴구조로 구현해본 샘플코드'를 보고 접근해봤습니다.
저는 RacingGame으로 끝냈던 상황이었는데, RacingResult를 보니 Game은 play의 역할에만, Result는 결과물에 대한 역할을 부여할 수 있을거 같아서 나누어 보았습니다.

아직 모든 원시값과 문자열을 포장하는데에 익숙하진 않은거 같은데, 아마 너무 절차지향적인 방법으로 많이 개발해와서 그런거 같습니다.
조금씩 적응하며 적용해보려고 합니다.

피드백 주시면 다시 한번 확인해보겠습니다.
감사합니다!

Copy link
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

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

전체 코드를 삭제하고 다시 구현하는 것이 쉽지 않았을텐데요.
다시 구현하면서 새로운 인사이트를 느낀 점이 인상적이네요. 💯
확실히 기존에 비해 전체적인 설계가 개선된 것을 느낄 수 있네요.
추가로 "규칙 8: 일급 콜렉션을 쓴다." 원칙까지 적용하면서 마무리하면 좋을 것 같아 피드백 남겨 봅니다.
이제 자동차 경주 미션은 충분히 도전한 만큼 5단계는 시간 나는 짬짬히 도전해 보시고요.
로또 미션을 병행해 보면 어떨까요?

this.value = value;
}

private void vaildation(String value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private void vaildation(String value) {
private void vaildate(String value) {

명사보다는 동사로

return "Position{" +
"value=" + value +
'}';
public Position increase() {
Copy link
Contributor

Choose a reason for hiding this comment

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

불변 객체로 구현 👍

import java.util.List;

public class RacingGame {
private List<RacingCar> racingCars;
Copy link
Contributor

Choose a reason for hiding this comment

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

한 단계 더 나아가 "규칙 8: 일급 콜렉션을 쓴다." 적용해 구현해 보면 어떨까?

Comment on lines 8 to 9
private List<RacingCar> racingCars;
private TryCount tryCount;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
private List<RacingCar> racingCars;
private TryCount tryCount;
private final List<RacingCar> racingCars;
private final TryCount tryCount;

Comment on lines 34 to 36
if (racingCar.isGreaterThanPosition(maxPosition)) {
maxPosition = racingCar.getPosition();
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
if (racingCar.isGreaterThanPosition(maxPosition)) {
maxPosition = racingCar.getPosition();
}
maxPosition = racingCar.max(maxPosition);

객체의 값을 꺼내지 말고 메시지를 보낸다.

public class TryCount {
private final int value;

public TryCount(int value) {
Copy link
Contributor

Choose a reason for hiding this comment

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

이 값은 유효성 체크가 필요없을까?

Comment on lines 17 to 19
for (int i = 0; i < position.value(); i++) {
System.out.print("-");
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
for (int i = 0; i < position.value(); i++) {
System.out.print("-");
}
"-".repeat(position.value());

- 명사 -> 동사(validation -> validate)
- Cars에 관련된 역할부여
- moveAll 테스트 -> NumberGenerator 생성
- TryCount는 값의 변동이 있어 처리 x
- 객체 접근 -> 메시지
- stream 적용
- 유효성 체크 추가
- 테스트코드 추가
- printPosition 반복문 repeat 적용
@qwer920414-ctrl
Copy link
Author

자동차경주 step5 리뷰요청 드립니다.
피드백 주셨던 부분들 위주로 수정해보았습니다.
아직 멀었지만, 지금 구현한걸 다시 보니 조금 다르게 보이네요ㅎ

확인 부탁드립니다.
감사합니다!

Copy link
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

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

그냥 무시할 수도 있을텐데 마지막에 자동차 경주 미션까지 마무리했네요. 👍
이 교육 과정이 준혁님이 한 단계 성장하는데 도움이 되었기를 바랍니다.
또 다른 기회를 통해 뵐 수 있기를 바랍니다.

@javajigi javajigi merged commit 302587c into next-step:qwer920414-ctrl Jan 20, 2026
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