Skip to content

Conversation

@seryn6911-hub
Copy link

No description provided.

@seryn6911-hub seryn6911-hub changed the title [0주차] 6기 객체지향 코드 연습(최세린) [0주차] 6기 객체지향 코드 연습(최세린) Sep 21, 2025
Copy link

@0702Yoon 0702Yoon left a comment

Choose a reason for hiding this comment

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

특정 부분에서 잘짰다고 생각하는 부분도 존재하고 노력하신 게 보여서 좋습니다!
하지만 전체적으로 "매직넘버" 처리가 안되어있고, controller의 역할이 좀 많아보여요. 한번 분리해보시죠

Comment on lines +20 to +26
if (trimmed.isEmpty()) {
throw new IllegalArgumentException("자동차 이름이 공백");
}

if (trimmed.length() > 5) {
throw new IllegalArgumentException("이름 오류");
}

Choose a reason for hiding this comment

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

View에서 검사까지 하도록 일부로 노리신 건가요? 책임 분리 해볼까요?
또한 현재 예외 메시지만을 보고는 정확한 도메인 이해가 잘 되지 않아요.

//경주차 이름 입력
public String[] getMemberNames() {
System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,) 기준으로 구분)");
List<String> lst = List.of(scanner.nextLine().split(","));

Choose a reason for hiding this comment

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

split을 통해 배열로도 받을 수 있는 데 List로 받으신 이유가 특별히 있나요?


public class Controller {
private final View view;
private final List<Member> members = new ArrayList<>();

Choose a reason for hiding this comment

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

현재는 무조건 하나의 게임만 존재하기 떄문에 이렇게 구현해도 괜찮지만, 한번 이 Controller가 상태를 갖지 않도록 해볼까요?

Comment on lines +8 to +9
private String name;
private int go;

Choose a reason for hiding this comment

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

변수가 무엇을 의미하는 지 변수만을 보고 알기가 어려워요..

//경주차 간거 표시
public void printProgress(List<Member> members) {
for (Member m : members) {
System.out.println(m.getName() + " : " + "-".repeat(m.getGo()));

Choose a reason for hiding this comment

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

member에서 get을 사용하지 않고 값을 보여주도록 해볼까요?
get을 쓰면 안좋은 이유가 뭐가 있을까요?

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