Skip to content

Step1#72

Merged
javajigi merged 37 commits intocode-squad:krapeajfrom
krapeaj:step1
Apr 13, 2018
Merged

Step1#72
javajigi merged 37 commits intocode-squad:krapeajfrom
krapeaj:step1

Conversation

@krapeaj
Copy link
Copy Markdown

@krapeaj krapeaj commented Apr 12, 2018

No description provided.

krapeaj added 30 commits April 9, 2018 16:56
Copy link
Copy Markdown
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.

테스트 코드도 잘 구현했고, 전체적으로는 깔끔하게 구현했네. 👍
피드백 몇 개 남긴다.

this.playerName = playerName;
}

public boolean updateScores(int frameNumber, int pinsKnocked) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

너무 프로그램의 상태를 변경하는 관점으로 보지 말고 볼링 공을 투구한다는 의미의 메소드 이름이면 좋겠음.

import bowling.domain.score.Scores;

public abstract class Frame {
Scores scores = new Scores();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

인스턴스 변수는 특별한 이유는 없는 한 private으로 구현한다.
객체 외부에서 상태 값을 임의로 변경할 수 있도록 하는 것은 캡슐화 위반이다.

부모 클래스이지만 이 인스턴스도 private으로 구현해 본다.

return scores.isSpare();
}

public abstract boolean updateScore(int pinsKnocked);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

너무 프로그램의 상태를 변경하는 관점으로 보지 말고 볼링 공을 투구한다는 의미의 메소드 이름이면 좋겠음.

}

public boolean isSpare(int frameNumber) {
return frames.get(frameNumber).isSpare();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

메소드의 frames.get(frameNumber) 중복도 제거한다.


public abstract int updateScore(int pinsKnocked);

public abstract String toString(boolean allPinsDown);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

구현 부가 없는 경우 interface로 구현 가능함.

public interface Score {
    boolean isPlayed();

    int updateScore(int pinsKnocked);

    String toString(boolean allPinsDown);
}


private Score firstScore = new FirstScore();
private Score secondScore = new SecondScore();
private int pinsStanding = ALL;
Copy link
Copy Markdown
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 f6137a1 into code-squad:krapeaj Apr 13, 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