Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Step2 - 볼링 점수판(그리기) #993

Open
wants to merge 3 commits into
base: mnyok
Choose a base branch
from
Open

Conversation

mnyok
Copy link

@mnyok mnyok commented Nov 17, 2022

No description provided.

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.

객체 지향 프로그래밍을 하기 위해 객체를 추출하고, 테스트를 추가하느라 노력한 흔적이 느껴지네요. 💯
단, 지금 구현 로직을 보면 각 상태에 따른 if문이 무수히 많이 등장하는데요.
자바의 다형성을 적용해 if문을 제거하기 위해 도전을 해보면 어떨까요?
다소 쉽지 않을 수 있는데요. 한번 도전해 보면 좋겠어요.

@@ -0,0 +1,16 @@
package bowling.domain;

public interface Frame {
Copy link
Contributor

Choose a reason for hiding this comment

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

인터페이스에 메서드 수가 너무 많다.
메서드 수를 줄일 수 있는 방법을 찾아보면 어떨까?

Comment on lines +7 to +9
FrameStatus getFirstStatus();
FrameStatus getSecondStatus();
FrameStatus getThirdStatus();
Copy link
Contributor

Choose a reason for hiding this comment

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

State getState()와 같이 하나로 합쳐서 구현해 보는 것은 어떨까?

Comment on lines +7 to +9


public Hit(int hit) {
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

}

@Override
public FrameStatus getThirdStatus() {
Copy link
Contributor

Choose a reason for hiding this comment

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

각 상태에 따른 if 문이 너무 많다.
자바의 다형성을 적용해 if문을 최소화하도록 도전해 보면 어떨까?

@@ -0,0 +1,83 @@
package bowling.domain;

public class NormalFrame implements Frame {
Copy link
Contributor

Choose a reason for hiding this comment

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

NormalFrame과 FinalFrame을 보면 중복 코드가 많다.
AbstractFrame과 같은 객체를 추가해 NormalFrame과 FinalFrame의 중복 로직을 제거해 보면 어떨까?

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants