Skip to content

Step1#73

Merged
javajigi merged 15 commits intocode-squad:david-learnerfrom
david-learner:step1
Apr 18, 2018
Merged

Step1#73
javajigi merged 15 commits intocode-squad:david-learnerfrom
david-learner:step1

Conversation

@david-learner
Copy link

TDD와 Commit 메세지 모두 제대로 작성하지 못 한 것 같아서 시원하게 갈아엎을 것 같습니다:)

Copy link
Contributor

@javajigi javajigi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

로직 구현이 너무 복잡하게 구현했네. 피드백을 남기기는 했는데 Frame, NormalFrame, LastFrame 등이 너무 복잡함. 이 3개의 객체가 모든 일을 하지 않고 다른 객체를 추가해 구현하도록 개선해 본다.

public class BowlingGame {
private static final int MAX_NO = 10;
private Player player;
private List<Frame> frames;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

굳이 이 인스턴스가 필요한가?

protected static final String SPARE = "/";
protected static final String GUTTER = "-";
protected static final String MIDDLE = "|";
protected static final int UNPLAYED = -1;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이렇게 상수가 많고, 서로 관련성이 높으면 enum으로 구현해도 좋겠다.

// }
// if (!isGutter(prevPins) && isGutter(nextPins)) {
// return false;
// }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

사용하지 않고 코드 제거

}

public boolean isOver() {
return firstPins != UNPLAYED && secondPins != UNPLAYED && thirdPins != UNPLAYED;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isFirst()에서 isOver()까지 4개의 메소드에 중복도 너무 많고, 복잡하다.
다른 방법은 없을까?

sb.append(middle);
sb.append(third);

return first + middle + second + middle + third;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메소드가 너무 많은 일을 하고 있다. 다음 원칙을 지켜 메소드를 구현한다.

작게 만들어라. - 함수를 만드는 첫 번재 규칙은 '작게'다. 함수를 만드는 두 번째 규칙은 '더 작게'다.
한 가지만 해라. - 함수는 한 가지를 해야 한다. 그 한 가지를 잘 해야 한다. 그 한 가지만 해야 한다.

sb.append(first);
sb.append(middle);
sb.append(second);
return sb.toString();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

메소드가 너무 많은 일을 하고 있다. 다음 원칙을 지켜 메소드를 구현한다.

작게 만들어라. - 함수를 만드는 첫 번재 규칙은 '작게'다. 함수를 만드는 두 번째 규칙은 '더 작게'다.
한 가지만 해라. - 함수는 한 가지를 해야 한다. 그 한 가지를 잘 해야 한다. 그 한 가지만 해야 한다.

@javajigi javajigi merged commit fb02472 into code-squad:david-learner Apr 18, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants