Skip to content

Conversation

@dbswl067
Copy link

@dbswl067 dbswl067 commented Apr 3, 2021

No description provided.

Copy link
Member

@PandaHun PandaHun left a comment

Choose a reason for hiding this comment

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

.idea 경로는 gitignore에 추가해주세요.

또한 몇몇 요구사항이 만족하지 않아서
피드백 드립니다

}


} No newline at end of file
Copy link
Member

Choose a reason for hiding this comment

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

다른 클래스 파일에서는 괜찮은데 마지막 줄이 생략됐습니다.
마지막 줄도 컨벤션 중에 한 종류입니다

public class Car {
private static final int FIRST_DIGIT = 0;
private static final int LAST_DIGIT = 9;
private static final int MOVING_NUMBER = 4;
Copy link
Member

Choose a reason for hiding this comment

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

3개의 상수 추출 좋습니다 👍
하지만 조금 더 잘 만들어진 네이밍이 있을 것 같습니다


import utils.RandomUtils;

public class Car {
Copy link
Member

Choose a reason for hiding this comment

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

상태 값을 전부 포장해 캡슐화를 한 것 처럼 보이지만
결국 게터를 통해 내부 상태가 다른 객체에게 다 노출되고 있습니다.
게터를 사용하지 않고 코드를 작성해보는 습관을 들이는 것이 좋을 것 같습니다

}

public Winner winner() {
return new Winner(cars ,cars.stream()
Copy link
Member

Choose a reason for hiding this comment

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

해당 내용이 과연 우승자일까요?
우승자가 직접 우승자를 찾는 걸까요?

public List<String> getWinnersName() {
List<String> winnerNames = new ArrayList<>();
for (int i = 0; i < cars.size(); i++) {
if(cars.get(i).getPosition() == maxPosition){
Copy link
Member

Choose a reason for hiding this comment

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

인덴트는 최대 1입니다

import java.util.List;
import java.util.Scanner;

public class InputView {
Copy link
Member

Choose a reason for hiding this comment

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

정적메서드 만을 제공하는 정적 클래스 입니다
생성자를 막아줘서 사용의 혼동을 막아주면 좋겠습니다.

import java.util.Scanner;

public class InputView {
private static final Scanner scanner = new Scanner(System.in);
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
private static final Scanner scanner = new Scanner(System.in);
private static final Scanner SCANNER= new Scanner(System.in);


public static List<String> inputCarName(){
System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,) 기준으로 구분)");
List<String> carName = Arrays.asList(scanner.nextLine().split(","));
Copy link
Member

Choose a reason for hiding this comment

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

불필요한 inline 변수 같습니다


import java.util.List;

public class ResultView {
Copy link
Member

Choose a reason for hiding this comment

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

InputView와 마찬가지

public static void printWinners(Winner winner) {
System.out.println("최종 우승자: " + winner.getWinnersName());
}
}
Copy link
Member

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