Uh oh!
There was an error while loading. Please reload this page.
[8주차] nyj - #54
Conversation
PandaHun
left a comment
There was a problem hiding this comment.
.idea 경로는 gitignore에 추가해주세요.
또한 몇몇 요구사항이 만족하지 않아서
피드백 드립니다
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
다른 클래스 파일에서는 괜찮은데 마지막 줄이 생략됐습니다.
마지막 줄도 컨벤션 중에 한 종류입니다
| public class Car { | ||
| private static final int FIRST_DIGIT = 0; | ||
| private static final int LAST_DIGIT = 9; | ||
| private static final int MOVING_NUMBER = 4; |
There was a problem hiding this comment.
3개의 상수 추출 좋습니다 👍
하지만 조금 더 잘 만들어진 네이밍이 있을 것 같습니다
| import utils.RandomUtils; | ||
| public class Car { |
There was a problem hiding this comment.
상태 값을 전부 포장해 캡슐화를 한 것 처럼 보이지만
결국 게터를 통해 내부 상태가 다른 객체에게 다 노출되고 있습니다.
게터를 사용하지 않고 코드를 작성해보는 습관을 들이는 것이 좋을 것 같습니다
| } | ||
| public Winner winner() { | ||
| return new Winner(cars ,cars.stream() |
There was a problem hiding this comment.
해당 내용이 과연 우승자일까요?
우승자가 직접 우승자를 찾는 걸까요?
| public List<String> getWinnersName() { | ||
| List<String> winnerNames = new ArrayList<>(); | ||
| for (int i = 0; i < cars.size(); i++) { | ||
| if(cars.get(i).getPosition() == maxPosition){ |
| import java.util.List; | ||
| import java.util.Scanner; | ||
| public class InputView { |
There was a problem hiding this comment.
정적메서드 만을 제공하는 정적 클래스 입니다
생성자를 막아줘서 사용의 혼동을 막아주면 좋겠습니다.
| import java.util.Scanner; | ||
| public class InputView { | ||
| private static final Scanner scanner = new Scanner(System.in); |
There was a problem hiding this comment.
| privatestaticfinalScannerscanner= newScanner(System.in); | |
| privatestaticfinalScannerSCANNER= newScanner(System.in); |
| public static List<String> inputCarName(){ | ||
| System.out.println("경주할 자동차 이름을 입력하세요.(이름은 쉼표(,) 기준으로 구분)"); | ||
| List<String> carName = Arrays.asList(scanner.nextLine().split(",")); |
| import java.util.List; | ||
| public class ResultView { |
| public static void printWinners(Winner winner) { | ||
| System.out.println("최종 우승자: " + winner.getWinnersName()); | ||
| } | ||
| } |
There was a problem hiding this comment.
모두 해당 객체의 내부 구조를 잘 알고 있어야 가능 할 것 같네요
몰라도 가능하도록 구현을 개선해야 할 것 같습니다.
No description provided.