-
Notifications
You must be signed in to change notification settings - Fork 26
2주차 미션 / 서버 2조 이찬양 #42
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
base: main
Are you sure you want to change the base?
Conversation
twkwon0417
left a comment
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.
꼼꼼히 잘 진행 하셨습니다. 💯
객체 지향적으로 짜시려 한게 느껴져서 코드 리뷰 하면서 저도 재밌었습니다 🥇
| void drawLine(Position row, Position col); | ||
|
|
||
| void drawLine(); |
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, col을 인자로 갖는 drawLine은 Default에서만 쓰이고 인자가 없는 drawLine은 Auto에서만 쓰이는데 abstract method로 선언힌 이유가 있을 까요?
| Position col = Position.from(randomInt % (ladderSize.getNumberOfPerson() - 1)); | ||
|
|
||
| try { | ||
| rows[row.getValue()].drawLine(col); |
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.
DefaultLadderCreator에서 drawLine 메서드와 같은 로직 인거 같아요! 재사용할수 있는 방법이 있지 않을까요?
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.
AutoLadderCreator가 사다리를 잘 생성했는지 unit testing하기 힘들어 보여요. 책임을 분리 하면 테스트를 더 쉽게 작성 할수 있을 것 같습니다!
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.
Enum으로 관리 하다니 멋져요!
| public LadderGame(LadderCreator ladderCreator) { | ||
| this.ladderCreator = ladderCreator; | ||
| } |
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.
DI 잘 활용하셨습니다!!
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.
출력의 책임을 LadderRunner에 위임한게 인상적이네요
| return position.getValue(); | ||
| } | ||
|
|
||
| private void printRows(int moveX, int moveY) { |
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.
position대신 int를 쓰셨는데, 이유가 뭔가요?
| public void setRightNode() { | ||
| direction = RIGHT; | ||
| } | ||
|
|
||
| public void setLeftNode() { | ||
| direction = LEFT; | ||
| } | ||
|
|
||
| public boolean isAlreadySetDirection() { | ||
| return !isNone(); | ||
| } |
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.
Node의 값이 변경될때, 새로운 node를 생성하는 방식으로 처리해도 될거 같은데, setter을 사용한 특별한 이유가 있나요?
| //given | ||
| Position position = Position.from(0); | ||
|
|
||
| //then | ||
| assertThat(ladderGame.run(position)).isEqualTo(2); | ||
|
|
||
| //given | ||
| position = Position.from(1); | ||
|
|
||
| //then | ||
| assertThat(ladderGame.run(position)).isEqualTo(1); | ||
|
|
||
| //given | ||
| position = Position.from(2); | ||
|
|
||
| //then | ||
| assertThat(ladderGame.run(position)).isEqualTo(0); |
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.
@ParmeterizedTest, @CsvSource 등 test관련 annotation에 대해 더 알아보면 좋을 거 같습니다 👍
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.
예외 상황도 빠짐 없이 테스트 하셨군요 💯
✨사다리 출력, 사다리 자동 생성 기능 추가
♻️ 객체지향성 추가
코드리뷰 부탁합니다..! 🥹