Merged
Conversation
javajigi
suggested changes
Apr 12, 2018
Contributor
javajigi
left a comment
There was a problem hiding this comment.
로직 구현이 너무 복잡하게 구현했네. 피드백을 남기기는 했는데 Frame, NormalFrame, LastFrame 등이 너무 복잡함. 이 3개의 객체가 모든 일을 하지 않고 다른 객체를 추가해 구현하도록 개선해 본다.
| public class BowlingGame { | ||
| private static final int MAX_NO = 10; | ||
| private Player player; | ||
| private List<Frame> frames; |
src/main/java/domain/Frame.java
Outdated
| protected static final String SPARE = "/"; | ||
| protected static final String GUTTER = "-"; | ||
| protected static final String MIDDLE = "|"; | ||
| protected static final int UNPLAYED = -1; |
Contributor
There was a problem hiding this comment.
이렇게 상수가 많고, 서로 관련성이 높으면 enum으로 구현해도 좋겠다.
src/main/java/domain/Frame.java
Outdated
| // } | ||
| // if (!isGutter(prevPins) && isGutter(nextPins)) { | ||
| // return false; | ||
| // } |
src/main/java/domain/LastFrame.java
Outdated
| } | ||
|
|
||
| public boolean isOver() { | ||
| return firstPins != UNPLAYED && secondPins != UNPLAYED && thirdPins != UNPLAYED; |
Contributor
There was a problem hiding this comment.
isFirst()에서 isOver()까지 4개의 메소드에 중복도 너무 많고, 복잡하다.
다른 방법은 없을까?
src/main/java/domain/LastFrame.java
Outdated
| sb.append(middle); | ||
| sb.append(third); | ||
|
|
||
| return first + middle + second + middle + third; |
Contributor
There was a problem hiding this comment.
메소드가 너무 많은 일을 하고 있다. 다음 원칙을 지켜 메소드를 구현한다.
작게 만들어라. - 함수를 만드는 첫 번재 규칙은 '작게'다. 함수를 만드는 두 번째 규칙은 '더 작게'다.
한 가지만 해라. - 함수는 한 가지를 해야 한다. 그 한 가지를 잘 해야 한다. 그 한 가지만 해야 한다.
| sb.append(first); | ||
| sb.append(middle); | ||
| sb.append(second); | ||
| return sb.toString(); |
Contributor
There was a problem hiding this comment.
메소드가 너무 많은 일을 하고 있다. 다음 원칙을 지켜 메소드를 구현한다.
작게 만들어라. - 함수를 만드는 첫 번재 규칙은 '작게'다. 함수를 만드는 두 번째 규칙은 '더 작게'다.
한 가지만 해라. - 함수는 한 가지를 해야 한다. 그 한 가지를 잘 해야 한다. 그 한 가지만 해야 한다.
State 자식 클래스들은 각각의 조건에 따라 Pins를 가진다. Ready와 NotFinish와의 차이는 멤버변수 Pins의 유무다.
State 자식 클래스들 step2의 힌트를 토대로 구현 현재 state 저장을 위한 Cloneable 구현
컨벤션 수정 및 불필요한 클래스(코드) 제거
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TDD와 Commit 메세지 모두 제대로 작성하지 못 한 것 같아서 시원하게 갈아엎을 것 같습니다:)