Skip to content

[손국균_BackEnd] 1주차 과제 제출합니다.#10

Open
manopickax wants to merge 4 commits intoBCSDLab-Edu:mainfrom
manopickax:main
Open

[손국균_BackEnd] 1주차 과제 제출합니다.#10
manopickax wants to merge 4 commits intoBCSDLab-Edu:mainfrom
manopickax:main

Conversation

@manopickax
Copy link
Copy Markdown

Java_Racingcar_test

@code6150
Copy link
Copy Markdown

안녕하세요 손국균님의 비기너 리뷰어 권민상이라고 합니다!
서로 열심히 배워보아요!

Copy link
Copy Markdown

@Soundbar91 Soundbar91 left a comment

Choose a reason for hiding this comment

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

첫 번째 과제 고생하셨습니다 !
실습 과제를 수행하면서 막히는 부분이나 질문이 있으시다면 PR에 작성해주시면 답변하겠습니다 👍

}
}

class Car {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Python은 파일 하나에 여러개의 클래스를 구현해서 사용하는 것으로 알고 있는데, Java는 해당 방식보다는 클래스 파일을 분리해서 개발을 하는 거 같아요 ! 2주차 과제에서는 한 번 쪼개보면 좋을 거 같습니다

}
}

class GameManager {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

함수(또는 메서드)가 한 가지 일만 하도록 최대한 작게 만들어라.

다음과 같은 요구사항이 존재합니다. GameManager 클래스에 정의된 메소드들은 너무 많은 일을 하고 있는 거 같아요 👀 왜 한 가지 일만 해야하는지, 현 상황에서 분리를 할려면 코드를 어떻게 작성해야하는지 고민해보면 좋을 거 같습니다 !

Comment on lines +52 to +55
int attempts = Integer.parseInt(inputNum);
if (attempts <= 0 ) {
throw new IllegalArgumentException ("0이상 입력하세요.");
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

XX.parseInt 메소드의 경우 String을 다른 형으로 변환해주는 메소드로 알고 있습니다. 만약에 String이 아닌 다른 자료형이 들어온다면 어떻게 될까요 👀

Comment on lines +74 to +83
for (String name : names) {
cars.add(new Car(name));
for (int i = 0; i < cars.size(); i++) {
for (int j = i + 1; j < cars.size(); j++) {
if (cars.get(i).getName().equals(cars.get(j).getName())) {
throw new IllegalArgumentException("중복된 값 입니다.");
}
}
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

indent(인덴트, 들여쓰기) depth를 3이 넘지 않도록 구현한다. 2까지만 허용한다.

depth가 지금 4인 거 같아요. 메소드로 분리하는 방법도 있고, Set를 통해 중복 검사를 하는 방법도 있을 거 같아요

Comment on lines +91 to +95
for (Car car : cars) {
if (car.getDistance() > maxdistance) {
maxdistance = car.getDistance();
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

자바에서 기본적으로 제공해주는 라이브러리 중 Math가 있습니다. max()메소드를 활용한다면 어떻게 개선될 지 고민해보시면 좋을 거 같아요 !

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