-
Notifications
You must be signed in to change notification settings - Fork 747
사다리타기 2단계 구현 #10
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
사다리타기 2단계 구현 #10
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.
기존과는 다른 객체 설계를 해보려면 처음부터 TDD로 설계해 보는 경험을 해볼 것을 추천한다.
피드백 남겼어요.
src/main/java/domain/Ladder.java
Outdated
import java.util.List; | ||
|
||
public class Ladder { | ||
List<Line> lines; |
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으로 구현한다.
src/main/java/domain/Ladder.java
Outdated
for (int i = 0; i < ladderHeight; i++) { | ||
lines.add(new Line(size)); | ||
} | ||
this.lines = lines; |
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.
생성자가 2개인데 정적 팩토리 메소드로 구현해 본다.
src/main/java/domain/Ladder.java
Outdated
} | ||
|
||
public List<Line> getLines() { | ||
return lines; |
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/domain/Line.java
Outdated
@@ -44,5 +40,29 @@ private String drawLine(Boolean bool) { | |||
return StringUtils.getReplace(StringUtils.SPACE, LINE_WIDTH); | |||
} | |||
|
|||
public int nextPosition(int index) { |
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.
이 메소드의 로직 구현을 좀 더 단순하게 구현할 수 없을까?
객체 설계를 개선해 단순화해본다.
import java.util.List; | ||
|
||
public class PlayerGroup { | ||
List<Player> players; |
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으로 구현한다.
1. 1인의 결과 요청 1. 모두의 결과 요청 Closes next-step#9, next-step#10
* 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: 리뷰내용 반영
* [ladder] step2: .gitignore * [ladder] step2: README.md * [ladder] step1: feedback #1 * [ladder] step1: feedback #2 * [ladder] step1: feedback #3 * [ladder] step2: README.md * [ladder] step2: init * [ladder] step2: Height * [ladder] step2: Name * [ladder] step2: PointX * [ladder] step2: Line * [ladder] step2: NameList * [ladder] step2: README.md * [ladder] step2: Ladder * [ladder] step2: PointX * [ladder] step2: Board * [ladder] step2: Typo * [ladder] step2: Typo * [ladder] step2: Typo * [ladder] step2: README.md * [ladder] step2: feedback #1 * [ladder] step2: feedback #2,3 * [ladder] step2: feedback #4,8 * [ladder] step2: README.md * [ladder] step2: #5 * [ladder] step2: #6,7 * [ladder] step2: README.md * [ladder] step2: README.md * [ladder] step2: #9 * [ladder] step2: #10 * [ladder] step2: README.md * [ladder] step2: Point, Bridge * [ladder] step2: README.md * [ladder] step2: feedback #1 * [ladder] step2: feedback #2,3,4,5,6,7 --------- Co-authored-by: bt.7274(김홍균)/kakao <[email protected]>
No description provided.