-
Notifications
You must be signed in to change notification settings - Fork 411
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
[1, 2단계 - 체스] 제이미(임정수) 미션 제출합니다. #470
Conversation
public static Row from(final int value) { | ||
validate(value); | ||
return new Row(value); | ||
} | ||
|
||
public static Row fromWithoutValidate(final int value) { | ||
return new Row(value); | ||
} | ||
|
||
private static void validate(final int value) { | ||
if (isOutOfRange(value)) { | ||
throw new IllegalArgumentException("[ERROR] 유효하지 않은 행의 값입니다."); | ||
} | ||
} |
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.
리뷰 답변 참고
row는 0 ~ 7 사이의 값이어야 한다는 조건에 대한 로직 및 두 가지로 정의한 팩토리 메서드입니다.
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 Coordinate(final Row row, final Column column) { | ||
this.row = row; | ||
this.column = column; | ||
} | ||
|
||
public static Coordinate fromOnBoard(final int row, final int column) { | ||
return new Coordinate(Row.from(row), Column.from(column)); | ||
} | ||
|
||
public static Coordinate from(final int row, final int column) { | ||
return new Coordinate(Row.fromWithoutValidate(row), Column.fromWithoutValidate(column)); | ||
} |
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.
리뷰 답변 참고
Coordinate에서 정의한 두 가지 방법의 팩토리 메서드입니다.
네이밍에 대한 의견도 궁금합니다..!
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.
네이밍에 관해선 권장되는 정적 팩토리 메서드 네이밍 컨벤션 이 있어서 참고하면 좋을 것 같습니다.
(+) 팩토리 메서드를 사용할 경우 생성자는 접근제어자는 private으로 돌려주세요!
안녕하세요 춘식! 해결 및 추가 궁금한 사항에 대해 코멘트 남겨두었습니다. 변경 사항
|
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.
안녕하세요 제이미, 춘식입니다!
고민을 많이 하면서 리팩토링을 많이 한게 느껴지네요. 수고하셨습니다 👍👍
이번 단계는 여기서 머지하도록 하겠습니다.
질문과 이전에 나눴던 코멘트에 부가 답변들이 있으니 확인 부탁드려요. 🔥
궁금한 점이 있으면 편하게 DM 주세요!
안녕하세요 춘식!☺️
이번 체스 게임 미션 리뷰이 제이미입니다!
아직 부족한 부분이 많지만 리뷰 잘 부탁드립니다. 감사합니다!
의문이 든 사항에 대해선 코드에 코멘트를 작성해 두었습니다.
천천히 확인해 주시면 감사하겠습니다!
추가적으로 이번 미션에서는 객체를 객체스럽게 구현하기 위해 많은 고민을 해보았습니다.
실제로 해당 미션에서 이를 잘 지켰는지에 궁금합니다!
지키려고 노력한 점은 다음과 같습니다.
"각 클래스의 상태에 대한 기능은 해당 클래스에서만 이루어져야 한다"