-
Notifications
You must be signed in to change notification settings - Fork 748
사다리게임 Step1 완료했습니다 #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
객체 설계와 테스트 구현 💯
피드백 남겼어요.
|
||
public List<Line> getLines(String height, int countOfPerson); | ||
|
||
public String[] split(String participants); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인터페이스 성격에 3개 메소드가 있는 것이 맞는가?
List<Line> getLines(String height, int countOfPerson);
만 있는 것이 맞지 않을까?
다른 메소드는 분리하면 어떨까?
src/main/java/model/Line.java
Outdated
return true; | ||
} | ||
|
||
public ArrayList<Boolean> getPoints() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ArrayList를 외부에 공개할 때 ArrayList대신 List를 사용할 것을 추천한다.
ArrayList대신 List를 사용하는 것이 좋은 이유는 무엇인지 검토해 본다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
의존성 역적 원칙 때문인 것 같습니다.
interface에 의존하면 결합도가 낮아지고 코드가 유연해집니다
src/main/java/model/Line.java
Outdated
} | ||
|
||
public ArrayList<Boolean> getPoints() { | ||
return points; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
List를 외부에 공개하는 경우 외부에서 수정/삭제할 위험성이 있다.
따라서 외부에 공개할 때는 수정하지 못하도록 java.util.Collections.unmodifiableList() 사용해 반환할 것을 추천한다.
src/main/java/model/Positive.java
Outdated
public static Positive of(int num) { | ||
if (num < 0) { | ||
throw new IllegalArgumentException("양수를 입력하십시오."); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이런 예외를 확실히 하려면 생성자에 구현하는 것이 가장 확실한 유효성 체크가 되지 않을까?
* refactor: 리뷰내용 반영 메소드명 동사화 사다리 폭 테스트 * refactor: 모든 원시값과 문자열을 포장한다. Boolean to Point * feat: Line 에서의 분석기 (#7) Closes #7 * refactor: Point 클래스 position 필드 추가에 대한 기존 클래스 변경 * refactor: 모든 원시값과 문자열을 포장한다. 현재 위치 값 index 를 Chessmen 으로 포장함. * feat: Ladder 에서의 분서기 Closes #6 * feat: 실행 결과 입력하기 Closes #8 * feat: 결과 요청 메시지 Closes #12 * bugfix: LineAnalysis 버그 LineAnalysis 에서 상태 계산 버그. LineAnalysis 에서 속도 개선을 위한 선택가능한 라인만 추출 * feat: 결과 요처어 1. 1인의 결과 요청 1. 모두의 결과 요청 Closes #9, #10 * refactor: 실행결과 유효성 체크 * feat: 1. 실행 결과 출력하기 Closes #12 * feat: 사다리에 결과값 출력하기 Closes #13 * feat: 일급 일급컬렉션으로 - Players Closes #14 * feat: 일급 일급컬렉션으로 - Prizes Closes #15 * feat: 결과를 만드는 행위를 Line, Ladder 에서 하도록 수정하자. Closes #16 * refactor: Analysis class 삭제 및 중복 제거 * refactor: 리뷰내용 반영
사다리게임 Step1 완료했습니다