Skip to content

Conversation

@JJM3485
Copy link

@JJM3485 JJM3485 commented Sep 18, 2025

일단 메인 외에 Car와 Racing을 추가했는데 혹시 더 세분화할 수 있는게 있으면 추천 부탁드립니다.

@taejinn
Copy link

taejinn commented Sep 23, 2025

수고하셨습니다!! 👍

일단 메인 외에 Car와 Racing을 추가했는데 혹시 더 세분화할 수 있는게 있으면 추천 부탁드립니다.
→ Car, Racing 클래스 두 개로 충분한 것 같습니다. 잘 구현해주셨습니다!

Comment on lines +29 to +31
final int MOVE_NUMBER = 4;
final int START_NUMBER = 0;
final int END_NUMBER = 9;
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 +15 to +17
if (carName.length() > MAX_NAME) {
throw new IllegalArgumentException("[ERROR] 이름은 5자 이하만 가능합니다.");
}
Copy link

Choose a reason for hiding this comment

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

for 문 안에 있는 조건문을 함수로 만들어 Depth를 줄이면 좋을 것 같습니다 👍


String winnerString = String.join(", ", winners);
System.out.println("최종 우승자 : " + winnerString);
}
Copy link

Choose a reason for hiding this comment

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

위와 마찬가지로 최대한 코드 Depth를 줄여보시면 좋을 것 같아요!

@JJM3485
Copy link
Author

JJM3485 commented Sep 26, 2025

리펙토링으로 Depth 부분을 줄이고 책임을 분리하였습니다. 혹여나 더 나눌 수 있다면 말씀 부탁드립니다.

Copy link

@asa9874 asa9874 left a comment

Choose a reason for hiding this comment

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

안녕하세요!
과제 고생하셨습니다.

Car 클래스의 사용에 대한 생각을 몇개 남겼습니다.

Comment on lines +6 to +10
Car car = new Car();
String[] carNames = car.getCarNames();
int rounds = car.getRounds();

Racing racing = new Racing(carNames, rounds);
Copy link

Choose a reason for hiding this comment

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

Car 클래스가 지금은 코드의 비즈니스 로직이 진행되는 Racing 클래스내부에서 활용되지않고 입력받는용도로 활용되고있는거같아요.
Car 객체 리스트 대신 String[] carNames로 사용되고있는데, Car 객체를 활용해서 해보는건 어떨까요?

Comment on lines +7 to +9
private final String[] carNames;
private final int rounds;
private final int[] positions;
Copy link

Choose a reason for hiding this comment

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

carNames, positions 를 Racing에서 따로 String[]으로 선언하지않고
각각 하나의 Car 객체를 만들어서 List을 통해 사용하는게 객체지향적일거같아요.

이렇게 하면 이름과 위치가 한 객체 안에서 함께 관리되기 때문에 데이터 일관성 유지 (인덱스 잘못 맞출 위험)면에서 좋을거같아요

}
}

public int getRounds() {
Copy link

Choose a reason for hiding this comment

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

Round는 Car 객체내부에서 사용되는 정보라기보다는 Racing 에서 사용되는 변수인거같아요. 이부분에 대해서는 생각해보시면 좋을거같습니다.

winners.add(carName);
}
}
} No newline at end of file
Copy link

Choose a reason for hiding this comment

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

EOF 에 대해 한번 알아보시면 좋을거같습니다.

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.

3 participants